<!-- saved from url=(0026)http://www.naturaldocs.org -->
<divid=Content><divclass="CClass"><divclass=CTopicid=MainTopic><h1class=CTitle><aname="mxObjectCodec"></a>mxObjectCodec</h1><divclass=CBody><p>XML codec for PHP object graphs.</p><h4class=CHeading>Implementation note</h4><p>The passing of the argument by reference in <ahref="#mxObjectCodec.decode"class=LFunctionid=link43onMouseOver="ShowTip(event, 'tt23', 'link43')"onMouseOut="HideTip('tt23')">decode</a>, <ahref="#mxObjectCodec.decodeNode"class=LFunctionid=link44onMouseOver="ShowTip(event, 'tt24', 'link44')"onMouseOut="HideTip('tt24')">decodeNode</a>, <ahref="#mxObjectCodec.decodeAttributes"class=LFunctionid=link45onMouseOver="ShowTip(event, 'tt25', 'link45')"onMouseOut="HideTip('tt25')">decodeAttributes</a>, <ahref="#mxObjectCodec.decodeAttribute"class=LFunctionid=link46onMouseOver="ShowTip(event, 'tt27', 'link46')"onMouseOut="HideTip('tt27')">decodeAttribute</a>, <ahref="#mxObjectCodec.decodeChildren"class=LFunctionid=link47onMouseOver="ShowTip(event, 'tt26', 'link47')"onMouseOut="HideTip('tt26')">decodeChildren</a>, <ahref="#mxObjectCodec.decodeChild"class=LFunctionid=link48onMouseOver="ShowTip(event, 'tt28', 'link48')"onMouseOut="HideTip('tt28')">decodeChild</a>, <ahref="#mxObjectCodec.beforeDecode"class=LFunctionid=link49onMouseOver="ShowTip(event, 'tt32', 'link49')"onMouseOut="HideTip('tt32')">beforeDecode</a> and <ahref="#mxObjectCodec.afterDecode"class=LFunctionid=link50onMouseOver="ShowTip(event, 'tt33', 'link50')"onMouseOut="HideTip('tt33')">afterDecode</a> is required since the object may be an array instance, which needs an explicit reference operator even in PHP 5 to be changed in-place.</p><!--START_ND_SUMMARY--><divclass=Summary><divclass=STitle>Summary</div><divclass=SBorder><tableborder=0cellspacing=0cellpadding=0class=STable><trclass="SMain"><tdclass=SEntry><ahref="#mxObjectCodec">mxObjectCodec</a></td><tdclass=SDescription>XML codec for PHP object graphs.</td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxObjectCodec.Variables">Variables</a></td><tdclass=SDescription></td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxObjectCodec.template"id=link1onMouseOver="ShowTip(event, 'tt1', 'link1')"onMouseOut="HideTip('tt1')">template</a></td><tdclass=SDescription>Holds the template object associated with this codec.</td></tr><trclass="SVariable SIndent2"><tdclass=SEntry><ahref="#mxObjectCodec.exclude"id=link2onMouseOver="ShowTip(event, 'tt2', 'link2')"onMouseOut="HideTip('tt2')">exclude</a></td><tdclass=SDescription>Array containing the variable names that should be ignored by the codec.</td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxObjectCodec.idrefs"id=link3onMouseOver="ShowTip(event, 'tt3', 'link3')"onMouseOut="HideTip('tt3')">idrefs</a></td><tdclass=SDescription>Array containing the variable names that should be turned into or converted from references. </td></tr><trclass="SVariable SIndent2"><tdclass=SEntry><ahref="#mxObjectCodec.mapping"id=link4onMouseOver="ShowTip(event, 'tt4', 'link4')"onMouseOut="HideTip('tt4')">mapping</a></td><tdclass=SDescription>Maps from from fieldnames to XML attribute names.</td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxObjectCodec.reverse"id=link5onMouseOver="ShowTip(event, 'tt5', 'link5')"onMouseOut="HideTip('tt5')">reverse</a></td><tdclass=SDescription>Maps from from XML attribute names to fieldnames.</td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxObjectCodec.Functions">Functions</a></td><tdclass=SDescription></td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxObjectCodec.mxObjectCodec"id=link6onMouseOver="ShowTip(event, 'tt6', 'link6')"onMouseOut="HideTip('tt6')">mxObjectCodec</a></td><tdclass=SDescription>Constructs a new codec for the specified template object. </td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mxObjectCodec.getName"id=link7onMouseOver="ShowTip(event, 'tt7', 'link7')"onMouseOut="HideTip('tt7')">ge
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.template"></a>template</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>var $template</td></tr></table></blockquote><p>Holds the template object associated with this codec.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.exclude"></a>exclude</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>var $exclude</td></tr></table></blockquote><p>Array containing the variable names that should be ignored by the codec.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.idrefs"></a>idrefs</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>var $idrefs</td></tr></table></blockquote><p>Array containing the variable names that should be turned into or converted from references. See <ahref="mxCodec-php.html#mxCodec.getId"class=LFunctionid=link51onMouseOver="ShowTip(event, 'tt34', 'link51')"onMouseOut="HideTip('tt34')">mxCodec.getId</a> and <ahref="mxCodec-php.html#mxCodec.getObject"class=LFunctionid=link52onMouseOver="ShowTip(event, 'tt35', 'link52')"onMouseOut="HideTip('tt35')">mxCodec.getObject</a>.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.mapping"></a>mapping</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>var $mapping</td></tr></table></blockquote><p>Maps from from fieldnames to XML attribute names.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.reverse"></a>reverse</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>var $reverse</td></tr></table></blockquote><p>Maps from from XML attribute names to fieldnames.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.mxObjectCodec"></a>mxObjectCodec</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function mxObjectCodec(</td><tdclass=PParameternowrap>$template,</td><tdclass=PDefaultValuePrefix> </td><tdclass=PDefaultValuewidth=100%></td></tr><tr><td></td><tdclass=PParameternowrap>$exclude</td><tdclass=PDefaultValuePrefix> = </td><tdclass=PDefaultValuewidth=100%> array(),</td></tr><tr><td></td><tdclass=PParameternowrap>$idrefs</td><tdclass=PDefaultValuePrefix> = </td><tdclass=PDefaultValuewidth=100%> array(),</td></tr><tr><td></td><tdclass=PParameternowrap>$mapping</td><tdclass=PDefaultValuePrefix> = </td><tdclass=PDefaultValuewidth=100%> array()</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Constructs a new codec for the specified template object. The variables in the optional exclude array are ignored by the codec. Variables in the optional idrefs array are turned into references in the XML. The optional mapping may be used to map from variable names to XML attributes.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>template</td><tdclass=CDLDescription>Prototypical instance of the object to be encoded/decoded.</td></tr><tr><tdclass=CDLEntry>exclude</td><tdclass=CDLDescription>Optional array of fieldnames to be ignored.</td></tr><tr><tdclass=CDLEntry>idrefs</td><tdclass=CDLDescription>Optional array of fieldnames to be converted to/from references.</td></tr><tr><tdclass=CDLEntry>mapping</td><tdclass=CDLDescription>Optional mapping from field- to attributenames.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.getName"></a>getName</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>function getName()</td></tr></table></blockquote><p>Creates a new instance of the template for this codec.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.cloneTemplate"></a>cloneTemplate</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>function cloneTemplate()</td></tr></table></blockquote><p>Creates a new instance of the template for this codec.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.getFieldName"></a>getFieldName</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function getFieldName(</td><tdclass=PParameternowrap>$attributename</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the fieldname for the given attributename. Looks up the value in the <ahref="#mxObjectCodec.reverse"class=LVariableid=link53onMouseOver="ShowTip(event, 'tt5', 'link53')"onMouseOut="HideTip('tt5')">reverse</a> mapping or returns the input if there is no reverse mapping for the given name.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.getAttributeName"></a>getAttributeName</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function getAttributeName(</td><tdclass=PParameternowrap>$fieldname</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the attributename for the given fieldname. Looks up the value in the <ahref="#mxObjectCodec.mapping"class=LVariableid=link54onMouseOver="ShowTip(event, 'tt4', 'link54')"onMouseOut="HideTip('tt4')">mapping</a> or returns the input if there is no mapping for the given name.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.isExcluded"></a>isExcluded</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function isExcluded(</td><tdclass=PParameternowrap>$obj,</td></tr><tr><td></td><tdclass=PParameternowrap>$attr,</td></tr><tr><td></td><tdclass=PParameternowrap>$value,</td></tr><tr><td></td><tdclass=PParameternowrap>$write</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns true if the given attribute is to be ignored by the codec. This implementation returns true if the given fieldname is in <ahref="#mxObjectCodec.exclude"class=LVariableid=link55onMouseOver="ShowTip(event, 'tt2', 'link55')"onMouseOut="HideTip('tt2')">exclude</a> or if the fieldname equals <mxObjectIdentity.FIELD_NAME>.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>obj</td><tdclass=CDLDescription>Object instance that contains the field.</td></tr><tr><tdclass=CDLEntry>attr</td><tdclass=CDLDescription>Fieldname of the field.</td></tr><tr><tdclass=CDLEntry>value</td><tdclass=CDLDescription>Value of the field.</td></tr><tr><tdclass=CDLEntry>write</td><tdclass=CDLDescription>Boolean indicating if the field is being encoded or decoded. Write is true if the field is being encoded, else it is being decoded.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.isReference"></a>isReference</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function isReference(</td><tdclass=PParameternowrap>$obj,</td></tr><tr><td></td><tdclass=PParameternowrap>$attr,</td></tr><tr><td></td><tdclass=PParameternowrap>$value,</td></tr><tr><td></td><tdclass=PParameternowrap>$write</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns true if the given fieldname is to be treated as a textual reference (ID). This implementation returns true if the given fieldname is in <ahref="#mxObjectCodec.idrefs"class=LVariableid=link56onMouseOver="ShowTip(event, 'tt3', 'link56')"onMouseOut="HideTip('tt3')">idrefs</a>.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>obj</td><tdclass=CDLDescription>Object instance that contains the field.</td></tr><tr><tdclass=CDLEntry>attr</td><tdclass=CDLDescription>Fieldname of the field.</td></tr><tr><tdclass=CDLEntry>value</td><tdclass=CDLDescription>Value of the field.</td></tr><tr><tdclass=CDLEntry>write</td><tdclass=CDLDescription>Boolean indicating if the field is being encoded or decoded. Write is true if the field is being encoded, else it is being decoded.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.encode"></a>encode</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function encode(</td><tdclass=PParameternowrap>$enc,</td></tr><tr><td></td><tdclass=PParameternowrap>$obj</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Encodes the specified object and returns a node representing then given object. Calls <ahref="#mxObjectCodec.beforeEncode"class=LFunctionid=link57onMouseOver="ShowTip(event, 'tt21', 'link57')"onMouseOut="HideTip('tt21')">beforeEncode</a> after creating the node and <ahref="#mxObjectCodec.afterEncode"class=LFunctionid=link58onMouseOver="ShowTip(event, 'tt22', 'link58')"onMouseOut="HideTip('tt22')">afterEncode</a> with the resulting node after processing.</p><p>Enc is a reference to the calling encoder. It is used to encode complex objects and create references.</p><p>This implementation encodes all variables of an object according to the following rules:</p><ul><li>If the variable name is in <ahref="#mxObjectCodec.exclude"class=LVariableid=link59onMouseOver="ShowTip(event, 'tt2', 'link59')"onMouseOut="HideTip('tt2')">exclude</a> then it is ignored.</li><li>If the variable name is in <ahref="#mxObjectCodec.idrefs"class=LVariableid=link60onMouseOver="ShowTip(event, 'tt3', 'link60')"onMouseOut="HideTip('tt3')">idrefs</a> then <ahref="mxCodec-php.html#mxCodec.getId"class=LFunctionid=link61onMouseOver="ShowTip(event, 'tt34', 'link61')"onMouseOut="HideTip('tt34')">mxCodec.getId</a> is used to replace the object with its ID.</li><li>The variable name is mapped using <ahref="#mxObjectCodec.mapping"class=LVariableid=link62onMouseOver="ShowTip(event, 'tt4', 'link62')"onMouseOut="HideTip('tt4')">mapping</a>.</li><li>If obj is an array and the variable name is numeric (ie. an index) then it is not encoded.</li><li>If the value is an object, then the codec is used to create a child node with the variable name encoded into the “as” attribute.</li><li>Else, if <encodeDefaults> is true or the value differs from the template value, then ...</li><li>... if obj is not an array, then the value is mapped to an attribute.</li><li>... else if obj is an array, the value is mapped to an add child with a value attribute or a text child node, if the value is a function.</li></ul><p>If no ID exists for a variable in <ahref="#mxObjectCodec.idrefs"class=LVariableid=link63onMouseOver="ShowTip(event, 'tt3', 'link63')"onMouseOut="HideTip('tt3')">idrefs</a> or if an object cannot be encoded, a warning is issued using <ahref="../util/mxLog-php.html#mxLog.warn"class=LFunctionid=link64onMouseOver="ShowTip(event, 'tt36', 'link64')"onMouseOut="HideTip('tt36')">mxLog.warn</a>.</p><p>Returns the resulting XML node that represents the given object.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>enc</td><tdclass=CDLDescription><ahref="mxCodec-php.html#mxCodec"class=LClassid=link65onMouseOver="ShowTip(event, 'tt37', 'link65')"onMouseOut="HideTip('tt37')">mxCodec</a> that controls the encoding process.</td></tr><tr><tdclass=CDLEntry>obj</td><tdclass=CDLDescription>Object to be encoded.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.encodeObject"></a>encodeObject</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function encodeObject(</td><tdclass=PParameternowrap>$enc,</td></tr><tr><td></td><tdclass=PParameternowrap>$obj,</td></tr><tr><td></td><tdclass=PParameternowrap>$node</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Encodes the value of each member in then given obj into the given node using <ahref="#mxObjectCodec.encodeValue"class=LFunctionid=link66onMouseOver="ShowTip(event, 'tt15', 'link66')"onMouseOut="HideTip('tt15')">encodeValue</a>.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>enc</td><tdclass=CDLDescription><ahref="mxCodec-php.html#mxCodec"class=LClassid=link67onMouseOver="ShowTip(event, 'tt37', 'link67')"onMouseOut="HideTip('tt37')">mxCodec</a> that controls the encoding process.</td></tr><tr><tdclass=CDLEntry>obj</td><tdclass=CDLDescription>Object to be encoded.</td></tr><tr><tdclass=CDLEntry>node</td><tdclass=CDLDescription>XML node that contains the encoded object.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.encodeValue"></a>encodeValue</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function encodeValue(</td><tdclass=PParameternowrap>$enc,</td></tr><tr><td></td><tdclass=PParameternowrap>$obj,</td></tr><tr><td></td><tdclass=PParameternowrap>$name,</td></tr><tr><td></td><tdclass=PParameternowrap>$value,</td></tr><tr><td></td><tdclass=PParameternowrap>$node</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Converts the given value according to the mappings and id-refs in this codec and uses <ahref="#mxObjectCodec.writeAttribute"class=LFunctionid=link68onMouseOver="ShowTip(event, 'tt16', 'link68')"onMouseOut="HideTip('tt16')">writeAttribute</a> to write the attribute into the given node.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>enc</td><tdclass=CDLDescription><ahref="mxCodec-php.html#mxCodec"class=LClassid=link69onMouseOver="ShowTip(event, 'tt37', 'link69')"onMouseOut="HideTip('tt37')">mxCodec</a> that controls the encoding process.</td></tr><tr><tdclass=CDLEntry>obj</td><tdclass=CDLDescription>Object whose property is going to be encoded.</td></tr><tr><tdclass=CDLEntry>name</td><tdclass=CDLDescription>XML node that contains the encoded object.</td></tr><tr><tdclass=CDLEntry>value</td><tdclass=CDLDescription>Value of the property to be encoded.</td></tr><tr><tdclass=CDLEntry>node</td><tdclass=CDLDescription>XML node that contains the encoded object.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.writeAttribute"></a>writeAttribute</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function writeAttribute(</td><tdclass=PParameternowrap>$enc,</td></tr><tr><td></td><tdclass=PParameternowrap>$obj,</td></tr><tr><td></td><tdclass=PParameternowrap>$attr,</td></tr><tr><td></td><tdclass=PParameternowrap>$value,</td></tr><tr><td></td><tdclass=PParameternowrap>$node</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Writes the given value into node using <ahref="#mxObjectCodec.writePrimitiveAttribute"class=LFunctionid=link70onMouseOver="ShowTip(event, 'tt17', 'link70')"onMouseOut="HideTip('tt17')">writePrimitiveAttribute</a> or <ahref="#mxObjectCodec.writeComplexAttribute"class=LFunctionid=link71onMouseOver="ShowTip(event, 'tt18', 'link71')"onMouseOut="HideTip('tt18')">writeComplexAttribute</a> depending on the type of the value.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.writePrimitiveAttribute"></a>writePrimitiveAttribute</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function writePrimitiveAttribute(</td><tdclass=PParameternowrap>$enc,</td></tr><tr><td></td><tdclass=PParameternowrap>$obj,</td></tr><tr><td></td><tdclass=PParameternowrap>$attr,</td></tr><tr><td></td><tdclass=PParameternowrap>$value,</td></tr><tr><td></td><tdclass=PParameternowrap>$node</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Writes the given value as an attribute of the given node.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.writeComplexAttribute"></a>writeComplexAttribute</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function writeComplexAttribute(</td><tdclass=PParameternowrap>$enc,</td></tr><tr><td></td><tdclass=PParameternowrap>$obj,</td></tr><tr><td></td><tdclass=PParameternowrap>$attr,</td></tr><tr><td></td><tdclass=PParameternowrap>$value,</td></tr><tr><td></td><tdclass=PParameternowrap>$node</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Writes the given value as a child node of the given node.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.convertValueToXml"></a>convertValueToXml</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function convertValueToXml(</td><tdclass=PParameternowrap>$value</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the given value without applying a conversion.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.convertValueFromXml"></a>convertValueFromXml</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function convertValueFromXml(</td><tdclass=PParameternowrap>$value</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the given value. In PHP there is no need to convert the boolean strings “0” and “1” to their numeric / boolean values.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.beforeEncode"></a>beforeEncode</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function beforeEncode(</td><tdclass=PParameternowrap>$enc,</td></tr><tr><td></td><tdclass=PParameternowrap>$obj,</td></tr><tr><td></td><tdclass=PParameternowrap>$node</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Hook for subclassers to pre-process the object before encoding. This returns the input object. The return value of this function is used in <ahref="#mxObjectCodec.encode"class=LFunctionid=link72onMouseOver="ShowTip(event, 'tt13', 'link72')"onMouseOut="HideTip('tt13')">encode</a> to perform the default encoding into the given node.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>enc</td><tdclass=CDLDescription><ahref="mxCodec-php.html#mxCodec"class=LClassid=link73onMouseOver="ShowTip(event, 'tt37', 'link73')"onMouseOut="HideTip('tt37')">mxCodec</a> that controls the encoding process.</td></tr><tr><tdclass=CDLEntry>obj</td><tdclass=CDLDescription>Object to be encoded.</td></tr><tr><tdclass=CDLEntry>node</td><tdclass=CDLDescription>XML node to encode the object into.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.afterEncode"></a>afterEncode</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function afterEncode(</td><tdclass=PParameternowrap>$enc,</td></tr><tr><td></td><tdclass=PParameternowrap>$obj,</td></tr><tr><td></td><tdclass=PParameternowrap>$node</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Hook for subclassers to post-process the node for the given object after encoding and return the post-processed node. This implementation returns the input node. The return value of this method is returned to the encoder from <ahref="#mxObjectCodec.encode"class=LFunctionid=link74onMouseOver="ShowTip(event, 'tt13', 'link74')"onMouseOut="HideTip('tt13')">encode</a>.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>enc</td><tdclass=CDLDescription><ahref="mxCodec-php.html#mxCodec"class=LClassid=link75onMouseOver="ShowTip(event, 'tt37', 'link75')"onMouseOut="HideTip('tt37')">mxCodec</a> that controls the encoding process.</td></tr><tr><tdclass=CDLEntry>obj</td><tdclass=CDLDescription>Object to be encoded.</td></tr><tr><tdclass=CDLEntry>node</td><tdclass=CDLDescription>XML node that represents the default encoding.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.decode"></a>decode</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function decode(</td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$dec,</td><tdclass=PDefaultValuePrefix> </td><tdclass=PDefaultValuewidth=100%></td></tr><tr><td></td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$node,</td><tdclass=PDefaultValuePrefix> </td><tdclass=PDefaultValuewidth=100%></td></tr><tr><td></td><tdclass=PParameterPrefixnowrap>&</td><tdclass=PParameternowrap>$into</td><tdclass=PDefaultValuePrefix> = </td><tdclass=PDefaultValuewidth=100%> null</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Parses the given node into the object or returns a new object representing the given node.</p><p>Dec is a reference to the calling decoder. It is used to decode complex objects and resolve references.</p><p>If a node has an id attribute then the object cache is checked for the object. If the object is not yet in the cache then it is constructed using the constructor of <ahref="#mxObjectCodec.template"class=LVariableid=link76onMouseOver="ShowTip(event, 'tt1', 'link76')"onMouseOut="HideTip('tt1')">template</a> and cached in <ahref="mxCodec-php.html#mxCodec.objects"class=LVariableid=link77onMouseOver="ShowTip(event, 'tt38', 'link77')"onMouseOut="HideTip('tt38')">mxCodec.objects</a>.</p><p>This implementation decodes all attributes and childs of a node according to the following rules:</p><ul><li>If the variable name is in <ahref="#mxObjectCodec.exclude"class=LVariableid=link78onMouseOver="ShowTip(event, 'tt2', 'link78')"onMouseOut="HideTip('tt2')">exclude</a> or if the attribute name is “id” or “as” then it is ignored.</li><li>If the variable name is in <ahref="#mxObjectCodec.idrefs"class=LVariableid=link79onMouseOver="ShowTip(event, 'tt3', 'link79')"onMouseOut="HideTip('tt3')">idrefs</a> then <ahref="mxCodec-php.html#mxCodec.getObject"class=LFunctionid=link80onMouseOver="ShowTip(event, 'tt35', 'link80')"onMouseOut="HideTip('tt35')">mxCodec.getObject</a> is used to replace the reference with an object.</li><li>The variable name is mapped using a reverse <ahref="#mxObjectCodec.mapping"class=LVariableid=link81onMouseOver="ShowTip(event, 'tt4', 'link81')"onMouseOut="HideTip('tt4')">mapping</a>.</li><li>If the value has a child node, then the codec is used to create a child object with the variable name taken from the “as” attribute.</li><li>If the object is an array and the variable name is empty then the value or child object is appended to the array.</li><li>If an add child has no value or the object is not an array then the child text content is evaluated using <mxUtils.eval>.</li></ul><p>For add nodes where the object is not an array and the variable name is defined, the default mechanism is used, allowing to override/add methods as follows:</p><blockquote><preclass="prettyprint"><Object>
<add as="hello"><![CDATA[
function(arg1) {
alert('Hello '+arg1);
}
]]></add>
</Object></pre></blockquote><p>If no object exists for an ID in <ahref="#mxObjectCodec.idrefs"class=LVariableid=link82onMouseOver="ShowTip(event, 'tt3', 'link82')"onMouseOut="HideTip('tt3')">idrefs</a> a warning is issued using <ahref="../util/mxLog-php.html#mxLog.warn"class=LFunctionid=link83onMouseOver="ShowTip(event, 'tt36', 'link83')"onMouseOut="HideTip('tt36')">mxLog.warn</a>.</p><p>Returns the resulting object that represents the given XML node or the object given to the method as the into parameter.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>dec</td><tdclass=CDLDescription><ahref="mxCodec-php.html#mxCodec"class=LClassid=link84onMouseOver="ShowTip(event, 'tt37', 'link84')"onMouseOut="HideTip('tt37')">mxCodec</a> that controls the decoding process.</td></tr><tr><tdclass=CDLEntry>node</td><tdclass=CDLDescription>XML node to be decoded.</td></tr><tr><tdclass=CDLEntry>into</td><tdclass=CDLDescription>Optional objec to encode the node into.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.decodeNode"></a>decodeNode</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function decodeNode(</td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$dec,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$node,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap>&</td><tdclass=PParameternowrap>$obj</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Calls <ahref="#mxObjectCodec.decodeAttributes"class=LFunctionid=link85onMouseOver="ShowTip(event, 'tt25', 'link85')"onMouseOut="HideTip('tt25')">decodeAttributes</a> and <ahref="#mxObjectCodec.decodeChildren"class=LFunctionid=link86onMouseOver="ShowTip(event, 'tt26', 'link86')"onMouseOut="HideTip('tt26')">decodeChildren</a> for the given node.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.decodeAttributes"></a>decodeAttributes</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function decodeAttributes(</td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$dec,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$node,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap>&</td><tdclass=PParameternowrap>$obj</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Decodes all attributes of the given node using <ahref="#mxObjectCodec.decodeAttribute"class=LFunctionid=link87onMouseOver="ShowTip(event, 'tt27', 'link87')"onMouseOut="HideTip('tt27')">decodeAttribute</a>.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.decodeAttribute"></a>decodeAttribute</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function decodeAttribute(</td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$dec,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$attr,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap>&</td><tdclass=PParameternowrap>$obj</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Reads the given attribute into the specified object.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.decodeChildren"></a>decodeChildren</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function decodeChildren(</td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$dec,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$node,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap>&</td><tdclass=PParameternowrap>$obj</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Decodec all children of the given node using <ahref="#mxObjectCodec.decodeChild"class=LFunctionid=link88onMouseOver="ShowTip(event, 'tt28', 'link88')"onMouseOut="HideTip('tt28')">decodeChild</a>.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.decodeChild"></a>decodeChild</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function decodeChild(</td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$dec,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$child,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap>&</td><tdclass=PParameternowrap>$obj</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Reads the specified child into the given object.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.getFieldTemplate"></a>getFieldTemplate</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function getFieldTemplate(</td><tdclass=PParameterPrefixnowrap>&</td><tdclass=PParameternowrap>$obj,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$fieldname,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$child</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the template instance for the given field. This returns the value of the field, null if the value is an array or an empty collection if the value is a collection. The value is then used to populate the field for a new instance. For strongly typed languages it may be required to override this to return the correct collection instance based on the encoded child.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.addObjectValue"></a>addObjectValue</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function addObjectValue(</td><tdclass=PParameterPrefixnowrap>&</td><tdclass=PParameternowrap>$obj,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$fieldname,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$value,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$template</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Sets the decoded child node as a value of the given object. If the object is a map, then the value is added with the given fieldname as a key. If the fieldname is not empty, then setFieldValue is called or else, if the object is a collection, the value is added to the collection. For strongly typed languages it may be required to override this with the correct code to add an entry to an object.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.processInclude"></a>processInclude</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function processInclude(</td><tdclass=PParameternowrap>$dec,</td></tr><tr><td></td><tdclass=PParameternowrap>$node,</td></tr><tr><td></td><tdclass=PParameternowrap>$into</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns true if the given node is an include directive and executes the include by decoding the XML document. Returns false if the given node is not an include directive.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>dec</td><tdclass=CDLDescription><ahref="mxCodec-php.html#mxCodec"class=LClassid=link89onMouseOver="ShowTip(event, 'tt37', 'link89')"onMouseOut="HideTip('tt37')">mxCodec</a> that controls the encoding/decoding process.</td></tr><tr><tdclass=CDLEntry>node</td><tdclass=CDLDescription>XML node to be checked.</td></tr><tr><tdclass=CDLEntry>into</td><tdclass=CDLDescription>Optional object to pass-thru to the codec.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.beforeDecode"></a>beforeDecode</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function beforeDecode(</td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$dec,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$node,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap>&</td><tdclass=PParameternowrap>$obj</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Hook for subclassers to pre-process the node for the specified object and return the node to be used for further processing by <ahref="#mxObjectCodec.decode"class=LFunctionid=link90onMouseOver="ShowTip(event, 'tt23', 'link90')"onMouseOut="HideTip('tt23')">decode</a>. The object is created based on the template in the calling method and is never null. This implementation returns the input node. The return value of this function is used in <ahref="#mxObjectCodec.decode"class=LFunctionid=link91onMouseOver="ShowTip(event, 'tt23', 'link91')"onMouseOut="HideTip('tt23')">decode</a> to perform the default decoding into the given object.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>dec</td><tdclass=CDLDescription><ahref="mxCodec-php.html#mxCodec"class=LClassid=link92onMouseOver="ShowTip(event, 'tt37', 'link92')"onMouseOut="HideTip('tt37')">mxCodec</a> that controls the decoding process.</td></tr><tr><tdclass=CDLEntry>node</td><tdclass=CDLDescription>XML node to be decoded.</td></tr><tr><tdclass=CDLEntry>obj</td><tdclass=CDLDescription>Object to encode the node into.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxObjectCodec.afterDecode"></a>afterDecode</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function afterDecode(</td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$dec,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap></td><tdclass=PParameternowrap>$node,</td></tr><tr><td></td><tdclass=PParameterPrefixnowrap>&</td><tdclass=PParameternowrap>$obj</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Hook for subclassers to post-process the object after decoding. This implementation returns the given object without any changes. The return value of this method is returned to the decoder from <ahref="#mxObjectCodec.decode"class=LFunctionid=link93onMouseOver="ShowTip(event, 'tt23', 'link93')"onMouseOut="HideTip('tt23')">decode</a>.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>enc</td><tdclass=CDLDescription><ahref="mxCodec-php.html#mxCodec"class=LClassid=link94onMouseOver="ShowTip(event, 'tt37', 'link94')"onMouseOut="HideTip('tt37')">mxCodec</a> that controls the encoding process.</td></tr><tr><tdclass=CDLEntry>node</td><tdclass=CDLDescription>XML node to be decoded.</td></tr><tr><tdclass=CDLEntry>obj</td><tdclass=CDLDescription>Object that represents the default decoding.</td></tr></table></div></div></div>
</div><!--Content-->
<divid=Footer><ahref="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
<divclass=CToolTipid="tt1"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>var $template</td></tr></table></blockquote>Holds the template object associated with this codec.</div></div><divclass=CToolTipid="tt2"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>var $exclude</td></tr></table></blockquote>Array containing the variable names that should be ignored by the codec.</div></div><divclass=CToolTipid="tt3"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>var $idrefs</td></tr></table></blockquote>Array containing the variable names that should be turned into or converted from references. </div></div><divclass=CToolTipid="tt4"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>var $mapping</td></tr></table></blockquote>Maps from from fieldnames to XML attribute names.</div></div><divclass=CToolTipid="tt5"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>var $reverse</td></tr></table></blockquote>Maps from from XML attribute names to fieldnames.</div></div><divclass=CToolTipid="tt6"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function mxObjectCodec(</td><tdclass=PParameternowrap>$template,</td><tdclass=PDefaultValuePrefix> </td><tdclass=PDefaultValuewidth=100%></td></tr><tr><td></td><tdclass=PParameternowrap>$exclude</td><tdclass=PDefaultValuePrefix> = </td><tdclass=PDefaultValuewidth=100%> array(),</td></tr><tr><td></td><tdclass=PParameternowrap>$idrefs</td><tdclass=PDefaultValuePrefix> = </td><tdclass=PDefaultValuewidth=100%> array(),</td></tr><tr><td></td><tdclass=PParameternowrap>$mapping</td><tdclass=PDefaultValuePrefix> = </td><tdclass=PDefaultValuewidth=100%> array()</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Constructs a new codec for the specified template object. </div></div><divclass=CToolTipid="tt7"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>function getName()</td></tr></table></blockquote>Creates a new instance of the template for this codec.</div></div><divclass=CToolTipid="tt8"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>function cloneTemplate()</td></tr></table></blockquote>Creates a new instance of the template for this codec.</div></div><divclass=CToolTipid="tt9"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function getFieldName(</td><tdclass=PParameternowrap>$attributename</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Returns the fieldname for the given attributename. </div></div><divclass=CToolTipid="tt10"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function getAttributeName(</td><tdclass=PParameternowrap>$fieldname</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Returns the attributename for the given fieldname. </div></div><divclass=CToolTipid="tt11"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function isExcluded(</td><tdclass=PParameternowrap>$obj,</td></tr><tr><td></td><tdclass=PParameternowrap>$attr,</td></tr><tr><