<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.
<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: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: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. </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>
</table>
</dd>
</dl>
</div>
</div>
<h2class="groupheader">Member Function Documentation</h2>
<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>
<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>
<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>
<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>
<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>
<p>Sets or returns if default values of member variables should be encoded. </p>
<p>Referenced by <aclass="el"href="classcom_1_1mxgraph_1_1mxObjectCodec.html#a126ab2aba3fd6743cc55474b8044296e">com.mxgraph.mxObjectCodec.EncodeValue()</a>.</p>