<ahref="classcom_1_1mxgraph_1_1mxCodec-members.html">List of all members</a></div>
<divclass="headertitle">
<divclass="title">com.mxgraph.mxCodec Class Reference</div></div>
</div><!--header-->
<divclass="contents">
<p>XML codec for .NET object graphs. In order to resolve forward references when reading files the XML document that contains the data must be passed to the constructor. Here is an example for parsing an existing XML document into a graph model:
<trclass="memdesc:a07e453ed963ab7bc07639091b9e371cb"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Constructs an XML encoder/decoder with a new owner document. <ahref="#a07e453ed963ab7bc07639091b9e371cb">More...</a><br/></td></tr>
<trclass="memdesc:abc2542faf421e95e1074c8b4c8b88b21"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Constructs an XML encoder/decoder for the specified owner document. The document is required to resolve forward ID references. This means if you parse a graphmodel that is represented in XML you must also pass the document that contains the XML to the constructor, otherwise forward references will not be resolved. <ahref="#abc2542faf421e95e1074c8b4c8b88b21">More...</a><br/></td></tr>
<trclass="memdesc:a662c18d5b7a3c7d31031653baec1c9fa"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Assoiates the given object with the given ID. <ahref="#a662c18d5b7a3c7d31031653baec1c9fa">More...</a><br/></td></tr>
<trclass="memdesc:af7284e48f4139e92b75c38598bec683e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the decoded object for the element with the specified ID in document. If the object is not known then lookup is used to find an object. If no object is found, then the element with the respective ID from the document is parsed using decode. <ahref="#af7284e48f4139e92b75c38598bec683e">More...</a><br/></td></tr>
<trclass="memdesc:abda3b8202fd04cb2e3730d3dd2560f9b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Hook for subclassers to implement a custom lookup mechanism for cell IDs. This implementation always returns null. <ahref="#abda3b8202fd04cb2e3730d3dd2560f9b">More...</a><br/></td></tr>
<trclass="memdesc:a1910f4beb57b5515cfd5a16119d78de0"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the element with the given ID from the document. <ahref="#a1910f4beb57b5515cfd5a16119d78de0">More...</a><br/></td></tr>
<trclass="memdesc:ae259ea85ae98f767a6ebfb15468652ca"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the ID of the specified object. This implementation calls reference first and if that returns null handles the object as an <aclass="el"href="classcom_1_1mxgraph_1_1mxCell.html"title="Cells are the elements of the graph model. They represent the state of the groups, vertices and edges in a graph. ">mxCell</a> by returning their IDs using mxCell.getId. If no ID exists for the given cell, then an on-the-fly ID is generated using mxCellPath.create. <ahref="#ae259ea85ae98f767a6ebfb15468652ca">More...</a><br/></td></tr>
<trclass="memdesc:a9e373d85a134b3b71d0969fa0faa0e4c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Hook for subclassers to implement a custom method for retrieving IDs from objects. This implementation always returns null. <ahref="#a9e373d85a134b3b71d0969fa0faa0e4c">More...</a><br/></td></tr>
<trclass="memdesc:a3088b2e442dd7ea6f92a7ccba3b12251"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Encodes the specified object and returns the resulting XML node. <ahref="#a3088b2e442dd7ea6f92a7ccba3b12251">More...</a><br/></td></tr>
<trclass="memdesc:aa0ad136f46f6a2b29360bd1537ff30fc"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decodes the given XML node using decode(XmlNode, Object). <ahref="#aa0ad136f46f6a2b29360bd1537ff30fc">More...</a><br/></td></tr>
<trclass="memdesc:aa4d103574f3b6b379d7d7cca995a2a3d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decodes the given XML node. The optional "into" argument specifies an existing object to be used. If no object is given, then a new instance is created using the constructor from the codec. The function returns the passed in object or the new instance if no object was given. <ahref="#aa4d103574f3b6b379d7d7cca995a2a3d">More...</a><br/></td></tr>
<trclass="memdesc:a52442cecf5ce690681d95496c9673f87"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Encoding of cell hierarchies is built-into the core, but is a higher-level function that needs to be explicitely used by the respective object encoders (eg. <aclass="el"href="classcom_1_1mxgraph_1_1mxModelCodec.html"title="Codec for mxGraphModels. This class is created and registered dynamically at load time and used impli...">mxModelCodec</a>, mxChildChangeCodec and mxRootChangeCodec). This implementation writes the given cell and its children as a (flat) sequence into the given node. The children are not encoded if the optional includeChildren is false. The function is in charge of adding the result into the given node and has no return value. <ahref="#a52442cecf5ce690681d95496c9673f87">More...</a><br/></td></tr>
<trclass="memdesc:a824d4ca6eaa4cf228e055c4485b7ea52"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decodes cells that have been encoded using inversion, ie. where the user object is the enclosing node in the XML, and restores the group and graph structure in the cells. Returns a new <aclass="el"href="classcom_1_1mxgraph_1_1mxCell.html"title="Cells are the elements of the graph model. They represent the state of the groups, vertices and edges in a graph. ">mxCell</a> instance that represents the given node. <ahref="#a824d4ca6eaa4cf228e055c4485b7ea52">More...</a><br/></td></tr>
<trclass="memdesc:ae58f38afc74452857f2e339eba51f6b6"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Inserts the given cell into its parent and terminal cells. <ahref="#ae58f38afc74452857f2e339eba51f6b6">More...</a><br/></td></tr>
<trclass="memdesc:a799403c766d5a6c12525fb0278c50e74"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the attribute on the specified node to value. This is a helper method that makes sure the attribute and value arguments are not null. <ahref="#a799403c766d5a6c12525fb0278c50e74">More...</a><br/></td></tr>
<trclass="memdesc:ae6bbe6707e3a49bf948be41572871e52"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Adds the given element to <elements> if it has an ID. <ahref="#ae6bbe6707e3a49bf948be41572871e52">More...</a><br/></td></tr>
<trclass="memdesc:aad8ec158a71d86cd392af0f7dc519b63"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Holds the owner document of the codec. <ahref="#aad8ec158a71d86cd392af0f7dc519b63">More...</a><br/></td></tr>
<trclass="memitem:a04522d7a38095efb6263bd10518fc6cc"><tdclass="memItemLeft"align="right"valign="top">Dictionary< string, object > </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classcom_1_1mxgraph_1_1mxCodec.html#a04522d7a38095efb6263bd10518fc6cc">objects</a> = new Dictionary<string, Object>()</td></tr>
<trclass="memdesc:a04522d7a38095efb6263bd10518fc6cc"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Maps from IDs to objects. <ahref="#a04522d7a38095efb6263bd10518fc6cc">More...</a><br/></td></tr>
<trclass="memdesc:a6c80fd7a3130d830317a255b41758f30"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Maps from IDs to elements. <ahref="#a6c80fd7a3130d830317a255b41758f30">More...</a><br/></td></tr>
<trclass="memdesc:a32a5c223e9e716534ee445271ca770ff"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Specifies if default values should be encoded. Default is false. <ahref="#a32a5c223e9e716534ee445271ca770ff">More...</a><br/></td></tr>
<trclass="memdesc:ad62be275d2f44acaf2e8be0a4a07ee4e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets or returns the owner document of the codec. <ahref="#ad62be275d2f44acaf2e8be0a4a07ee4e">More...</a><br/></td></tr>
<trclass="memdesc:ab1f1547969b60eaf71b1aa5ac686ea2a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets or returns if default values of member variables should be encoded. <ahref="#ab1f1547969b60eaf71b1aa5ac686ea2a">More...</a><br/></td></tr>
<divclass="textblock"><p>XML codec for .NET object graphs. In order to resolve forward references when reading files the XML document that contains the data must be passed to the constructor. Here is an example for parsing an existing XML document into a graph model: </p>
<p><aclass="el"href="classcom_1_1mxgraph_1_1mxCodec.html"title="XML codec for .NET object graphs. In order to resolve forward references when reading files the XML d...">mxCodec</a> codec = new mxCodec(doc); <aclass="el"href="classcom_1_1mxgraph_1_1mxGraph.html"title="Implements a graph object that allows to create diagrams from a graph model and stylesheet. ">mxGraph</a> graph = new mxGraph(); codec.Decode(doc.DocumentElement, graph.Model); </p>
</div><h2class="groupheader">Constructor & Destructor Documentation</h2>
<p>Constructs an XML encoder/decoder for the specified owner document. The document is required to resolve forward ID references. This means if you parse a graphmodel that is represented in XML you must also pass the document that contains the XML to the constructor, otherwise forward references will not be resolved. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">document</td><td>Optional XML document that contains the data. If no document is specified then a new document is created using mxUtils.createDocument</td></tr>
<pclass="reference">Referenced by <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#a7690c0e1b9d4e2e3a84d5811dca5ed10">com.mxgraph.mxObjectCodec.DecodeChild()</a>, and <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#ac5c143df7b7b7c9d8b7a77681b2b9815">com.mxgraph.mxObjectCodec.ProcessInclude()</a>.</p>
<p>Decodes the given XML node. The optional "into" argument specifies an existing object to be used. If no object is given, then a new instance is created using the constructor from the codec. The function returns the passed in object or the new instance if no object was given. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">node</td><td>XML node to be decoded.</td></tr>
<tr><tdclass="paramname">into</td><td>Optional object to be decodec into.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns an object that represents the given node.</dd></dl>
<pclass="reference">References <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#a1ecf4a9e08d688c9041d97b6af1c2df0">com.mxgraph.mxObjectCodec.Decode()</a>, and <aclass="el"href="classcom_1_1mxgraph_1_1mxCodecRegistry.html#a26a31214cadf077d0acb37f3f0295c6c">com.mxgraph.mxCodecRegistry.GetCodec()</a>.</p>
<p>Decodes cells that have been encoded using inversion, ie. where the user object is the enclosing node in the XML, and restores the group and graph structure in the cells. Returns a new <aclass="el"href="classcom_1_1mxgraph_1_1mxCell.html"title="Cells are the elements of the graph model. They represent the state of the groups, vertices and edges in a graph. ">mxCell</a> instance that represents the given node. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">node</td><td>XML node that contains the cell data.</td></tr>
<tr><tdclass="paramname">restoreStructures</td><td>Boolean indicating whether the graph structure should be restored by calling insert and insertEdge on the parent and terminals, respectively. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Graph cell that represents the given node.</dd></dl>
<pclass="reference">References <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#a1ecf4a9e08d688c9041d97b6af1c2df0">com.mxgraph.mxObjectCodec.Decode()</a>, and <aclass="el"href="classcom_1_1mxgraph_1_1mxCodecRegistry.html#a26a31214cadf077d0acb37f3f0295c6c">com.mxgraph.mxCodecRegistry.GetCodec()</a>.</p>
<pclass="reference">Referenced by <aclass="el"href="classcom_1_1mxgraph_1_1mxModelCodec.html#a87ebd28e84d602ec87f411744bbe0ef8">com.mxgraph.mxModelCodec.BeforeDecode()</a>.</p>
<pclass="reference">References <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#af54fb528308bc68c772398c0f42862ff">com.mxgraph.mxObjectCodec.Encode()</a>, <aclass="el"href="classcom_1_1mxgraph_1_1mxCodecRegistry.html#a26a31214cadf077d0acb37f3f0295c6c">com.mxgraph.mxCodecRegistry.GetCodec()</a>, and <aclass="el"href="classcom_1_1mxgraph_1_1mxCodecRegistry.html#a26bc2c27208d17e5419e1964c73f1e92">com.mxgraph.mxCodecRegistry.GetName()</a>.</p>
<pclass="reference">Referenced by <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#af82997a9553b5ef4c4c72e22ce89aab2">com.mxgraph.mxObjectCodec.WriteComplexAttribute()</a>.</p>
<p>Encoding of cell hierarchies is built-into the core, but is a higher-level function that needs to be explicitely used by the respective object encoders (eg. <aclass="el"href="classcom_1_1mxgraph_1_1mxModelCodec.html"title="Codec for mxGraphModels. This class is created and registered dynamically at load time and used impli...">mxModelCodec</a>, mxChildChangeCodec and mxRootChangeCodec). This implementation writes the given cell and its children as a (flat) sequence into the given node. The children are not encoded if the optional includeChildren is false. The function is in charge of adding the result into the given node and has no return value. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">cell</td><td><aclass="el"href="classcom_1_1mxgraph_1_1mxCell.html"title="Cells are the elements of the graph model. They represent the state of the groups, vertices and edges in a graph. ">mxCell</a> to be encoded.</td></tr>
<tr><tdclass="paramname">node</td><td>Parent XML node to add the encoded cell into.</td></tr>
<tr><tdclass="paramname">includeChildren</td><td>Boolean indicating if the method should include all descendents</td></tr>
<pclass="reference">References <aclass="el"href="interfacecom_1_1mxgraph_1_1mxICell.html#a36e9eb9110b62095cdce78caf919c6f4">com.mxgraph.mxICell.ChildCount()</a>, and <aclass="el"href="interfacecom_1_1mxgraph_1_1mxICell.html#a4d8537b8b40c0fb6ae718d97b647ea5e">com.mxgraph.mxICell.GetChildAt()</a>.</p>
<pclass="reference">Referenced by <aclass="el"href="classcom_1_1mxgraph_1_1mxModelCodec.html#acc086a36b6e6fe3119a4db05c73b68c9">com.mxgraph.mxModelCodec.EncodeObject()</a>.</p>
<pclass="reference">Referenced by <aclass="el"href="classcom_1_1mxgraph_1_1mxCellCodec.html#afef8d0281b5a8a7bc75fdf897c5d31b7">com.mxgraph.mxCellCodec.BeforeDecode()</a>.</p>
<p>Returns the ID of the specified object. This implementation calls reference first and if that returns null handles the object as an <aclass="el"href="classcom_1_1mxgraph_1_1mxCell.html"title="Cells are the elements of the graph model. They represent the state of the groups, vertices and edges in a graph. ">mxCell</a> by returning their IDs using mxCell.getId. If no ID exists for the given cell, then an on-the-fly ID is generated using mxCellPath.create. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">obj</td><td>Object to return the ID for.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns the ID for the given object.</dd></dl>
<pclass="reference">Referenced by <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#a9f6a46c7f5d672663352742e7379f042">com.mxgraph.mxObjectCodec.EncodeObject()</a>, and <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#a126ab2aba3fd6743cc55474b8044296e">com.mxgraph.mxObjectCodec.EncodeValue()</a>.</p>
<p>Returns the decoded object for the element with the specified ID in document. If the object is not known then lookup is used to find an object. If no object is found, then the element with the respective ID from the document is parsed using decode. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">id</td><td>ID of the object to be returned.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns the object for the given ID.</dd></dl>
<pclass="reference">Referenced by <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#a438a81b33fc988dc9e43e76cf2f1a248">com.mxgraph.mxObjectCodec.DecodeAttribute()</a>.</p>
<pclass="reference">Referenced by <aclass="el"href="classcom_1_1mxgraph_1_1mxCellCodec.html#afef8d0281b5a8a7bc75fdf897c5d31b7">com.mxgraph.mxCellCodec.BeforeDecode()</a>.</p>
<pclass="reference">Referenced by <aclass="el"href="classcom_1_1mxgraph_1_1mxStylesheetCodec.html#a0b91a548bbfba3a0c29b929ca223f7a4">com.mxgraph.mxStylesheetCodec.Decode()</a>, and <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#a27db4f4c90305c7707198e7e29ba1d09">com.mxgraph.mxObjectCodec.Decode()</a>.</p>
<pclass="reference">Referenced by <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#a9f6a46c7f5d672663352742e7379f042">com.mxgraph.mxObjectCodec.EncodeObject()</a>, <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#af82997a9553b5ef4c4c72e22ce89aab2">com.mxgraph.mxObjectCodec.WriteComplexAttribute()</a>, and <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#ad6b38c3626995256419d0d7f9d537b28">com.mxgraph.mxObjectCodec.WritePrimitiveAttribute()</a>.</p>
<pclass="reference">Referenced by <aclass="el"href="classcom_1_1mxgraph_1_1mxCellCodec.html#a97e9e569ab7a4116d4b91f9ac2f17447">com.mxgraph.mxCellCodec.AfterEncode()</a>, <aclass="el"href="classcom_1_1mxgraph_1_1mxStylesheetCodec.html#a0d1d57effb1d0827d40ef39af0f4a5aa">com.mxgraph.mxStylesheetCodec.Encode()</a>, <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#af54fb528308bc68c772398c0f42862ff">com.mxgraph.mxObjectCodec.Encode()</a>, <aclass="el"href="classcom_1_1mxgraph_1_1mxModelCodec.html#acc086a36b6e6fe3119a4db05c73b68c9">com.mxgraph.mxModelCodec.EncodeObject()</a>, and <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#ad6b38c3626995256419d0d7f9d537b28">com.mxgraph.mxObjectCodec.WritePrimitiveAttribute()</a>.</p>
<pclass="reference">Referenced by <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#a126ab2aba3fd6743cc55474b8044296e">com.mxgraph.mxObjectCodec.EncodeValue()</a>.</p>
<pclass="reference">Referenced by <aclass="el"href="classcom_1_1mxgraph_1_1mxCellCodec.html#afef8d0281b5a8a7bc75fdf897c5d31b7">com.mxgraph.mxCellCodec.BeforeDecode()</a>, <aclass="el"href="classcom_1_1mxgraph_1_1mxStylesheetCodec.html#a0b91a548bbfba3a0c29b929ca223f7a4">com.mxgraph.mxStylesheetCodec.Decode()</a>, and <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#a27db4f4c90305c7707198e7e29ba1d09">com.mxgraph.mxObjectCodec.Decode()</a>.</p>