bixmlresourceparser.html
来自「ajax 框价.是个好工具.javascript 矿家.可以用在任何平台.」· HTML 代码 · 共 445 行
HTML
445 行
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><!--Generated using api.website.xsl version 2003-07-17--><head><META http-equiv="Content-Type" content="text/html; charset=utf-8"><title>BiXmlResourceParser</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type="text/css" rel="stylesheet" href="api.css"><script type="text/javascript"> function showDerivedClasses() { var ul = document.getElementById("api-derived-classes"); var lis = ul.childNodes; var l = lis.length; for (var i = 1; i < l; i++) lis[i].style.display = ""; lis[0].style.display = "none"; } </script></head><body><h1 id="BiXmlResourceParser">BiXmlResourceParser</h1><p>This class deserializes an XML document to a Bindows object hierarchy. This is mostly tailored for <code><a href="BiComponent.html">BiComponent</a></code> hierarchies but can be used for any class extending <code><a href="BiObject.html">BiObject</a></code>.</p><p>This class extends <code><a href="BiXmlLoader.html">BiXmlLoader</a></code> and therefore all methods and fields available for <code><a href="BiXmlLoader.html">BiXmlLoader</a></code> are also available for <code>BiXmlResourceParser</code>.</p><ul class="partial-class-tree"><li><code><a href="BiObject.html">BiObject</a></code><ul><li><code><a href="BiEventTarget.html">BiEventTarget</a></code><ul><li><code><a href="BiTextLoader.html">BiTextLoader</a></code><ul><li><code><a href="BiXmlLoader.html">BiXmlLoader</a></code><ul><li><code>BiXmlResourceParser</code><ul id="api-derived-classes"></ul></li></ul></li></ul></li></ul></li></ul></li></ul><h2>Constructor</h2><p><code> new BiXmlResourceParser()</code></p><h3>Parameters</h3><p>No parameters.</p><h2>Properties</h2><table><thead><tr><td>Name</td><td>Type</td><td class="get-header">get</td><td class="set-header">set</td><td>Descripton</td></tr></thead><tbody><tr><td><a name="autoNameMapping"></a><code>autoNameMapping</code></td><td><code class="type">Boolean</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>When this is true any XML object that has an id attribute will create a global reference (with the same name as the id value) to the object created from this XML element.</td></tr><tr><td><a name="rootNode"></a><code>rootNode</code></td><td><code class="type">Node</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>The XML element that describes the root of the object hierarchy. Only set this before you actually use the parser.</td></tr></tbody></table><h2>Methods</h2><table><thead><tr><td>Name</td><td>Description</td></tr></thead><tbody><tr><td><code><a href="#fromNode">fromNode</a></code></td><td>Takes an XML element and returns a<code><a href="BiObject.html">BiObject</a></code> (or a derivative). The tag name is used as the class name and for each attribute, <code><a href="BiObject.html#setAttribute">setAttribute</a></code> is called on the object. For each child node (unless it declares a complex property) <code><a href="BiObject.html#addXmlNode">addXmlNode</a></code> is called on the object.</td></tr><tr><td><code><a href="#getComponentById">getComponentById</a></code></td><td>Returns the component (BiObject) with the given <code><a href="BiObject.html#id">id</a></code> property. If the parser has not yet encountered an element with this id attribute it will look forward in the document and if an element is found with the given id it will be deserialized and the object will be returned.</td></tr><tr><td><code><a href="#processAttributes">processAttributes</a></code></td><td>This takes an object and an XML element and then goes through the attributes and calls <code><a href="BiObject.html#setAttribute">setAttribute</a></code> on the object.<br> <br> This is also where attached properties are handled. See the remarks.</td></tr><tr><td><code><a href="#processChildNodes">processChildNodes</a></code></td><td>This takes an object and an XML element and then goes through all the child nodes of the XML element and calls <code><a href="BiObject.html#addXmlNode">addXmlNode</a></code> on the object.<br> <br> This is also where complex properties are handled. See the remarks.</td></tr></tbody></table><h2>Events</h2><p>None.</p><h2>Static Methods</h2><table><thead><tr><td>Name</td><td>Description</td></tr></thead><tbody><tr><td><code><a href="#getClassFromDocument">getClassFromDocument</a></code></td><td>Creates a constructor that uses the XML document as its base. This constructor can then be used to create instances of this class or used to create sub classes.</td></tr><tr><td><code><a href="#getClassFromNode">getClassFromNode</a></code></td><td>Creates a constructor that uses the XML element as its base. This constructor can then be used to create instances of this class or used to create sub classes.</td></tr><tr><td><code><a href="#getClassFromUri">getClassFromUri</a></code></td><td>Loads an XML document from the URI and then creates a constructor that can then be used to create instances of that class. See the remarks below.</td></tr></tbody></table><h2>Static Fields</h2><p>None.</p><h2>Remarks</h2><p>When creating a class from a node or URI the class will extend the class that the root element is of. The class will have a property getter called <code>xmlResourceParser</code> that returns the resource loader and a method called <code>getComponentById</code> that allows lookup of objects from the XML resource. Classes created in this way will call a method called <code>initialize</code> from the constructor using the same arguments that were passed to the constructor<br> <br> Complex properties are represented using child elements with a tag name matching the class name of the current element followed by a '.' and then the property name.<br> <br> <Component><br> <Component.border><br> <Border color="red"/><br> </Component.border><br> </Component><br> <br> Attached properties are a special kind of properties that follow an interface with the following format:<br> <br> ClassName.setProperty( oSource, sValue )<br> <br> This is represented using the following XML code:<br> <br> <Component ClassName.property="value"/></p><h2>Method Details</h2><h3><a name="fromNode"></a>fromNode</h3><p>Takes an XML element and returns a<code><a href="BiObject.html">BiObject</a></code> (or a derivative). The tag name is used as the class name and for each attribute, <code><a href="BiObject.html#setAttribute">setAttribute</a></code> is called on the object. For each child node (unless it declares a complex property) <code><a href="BiObject.html#addXmlNode">addXmlNode</a></code> is called on the object.</p><h4>Syntax</h4><pre class="method-syntax">object.fromNode(<span class="methodArgument">oNode</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>oNode</code></td><td><code class="type">Node</code></td><td class="optional-column"></td><td></td><td>The XML node to create an object for.</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">Object</code></p><h3><a name="getComponentById"></a>getComponentById</h3><p>Returns the component (BiObject) with the given <code><a href="BiObject.html#id">id</a></code> property. If the parser has not yet encountered an element with this id attribute it will look forward in the document and if an element is found with the given id it will be deserialized and the object will be returned.</p><h4>Syntax</h4><pre class="method-syntax">object.getComponentById(<span class="methodArgument">sId</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>sId</code></td><td><code class="type">String</code></td><td class="optional-column"></td><td></td><td>The id of the object to find</td></tr></tbody></table><h4>Return Type</h4><p><code class="type"> <code><a href="BiObject.html">BiObject</a></code> </code></p><h3><a name="processAttributes"></a>processAttributes</h3><p>This takes an object and an XML element and then goes through the attributes and calls <code><a href="BiObject.html#setAttribute">setAttribute</a></code> on the object.<br> <br> This is also where attached properties are handled. See the remarks.</p><h4>Syntax</h4><pre class="method-syntax">object.processAttributes(<span class="methodArgument">o</span>, <span class="methodArgument">oNode</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>o</code></td><td><code class="type"> <code><a href="BiObject.html">BiObject</a></code> </code></td><td class="optional-column"></td><td></td><td>The object to map the attributes onto</td></tr><tr><td><code>oNode</code></td><td><code class="type">Node</code></td><td class="optional-column"></td><td></td><td>The XML element that provides the attributes</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">void</code></p><h3><a name="processChildNodes"></a>processChildNodes</h3><p>This takes an object and an XML element and then goes through all the child nodes of the XML element and calls <code><a href="BiObject.html#addXmlNode">addXmlNode</a></code> on the object.<br> <br> This is also where complex properties are handled. See the remarks.</p><h4>Syntax</h4><pre class="method-syntax">object.processChildNodes(<span class="methodArgument">obj</span>, <span class="methodArgument">oNode</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>obj</code></td><td><code class="type"> <code><a href="BiObject.html">BiObject</a></code> </code></td><td class="optional-column"></td><td></td><td>The object to map the children onto</td></tr><tr><td><code>oNode</code></td><td><code class="type">Node</code></td><td class="optional-column"></td><td></td><td>The XML element that provides the child nodes</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">void</code></p><h2>Static Method Details</h2><h3><a name="getClassFromDocument"></a>getClassFromDocument</h3><p>Creates a constructor that uses the XML document as its base. This constructor can then be used to create instances of this class or used to create sub classes.</p><h4>Syntax</h4><pre class="method-syntax">BiXmlResourceParser.getClassFromDocument(<span class="methodArgument">oDoc</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>oDoc</code></td><td><code class="type"> <code><a href="BiXmlDocument.html">BiXmlDocument</a></code> </code></td><td class="optional-column"></td><td></td><td>The XML document used to describe the object hierarchy.</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">Function</code></p><h3><a name="getClassFromNode"></a>getClassFromNode</h3><p>Creates a constructor that uses the XML element as its base. This constructor can then be used to create instances of this class or used to create sub classes.</p><h4>Syntax</h4><pre class="method-syntax">BiXmlResourceParser.getClassFromNode(<span class="methodArgument">oNode</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>oNode</code></td><td><code class="type">Node</code></td><td class="optional-column"></td><td></td><td>The XML node used to describe the object hierarchy.</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">Function</code></p><h3><a name="getClassFromUri"></a>getClassFromUri</h3><p>Loads an XML document from the URI and then creates a constructor that can then be used to create instances of that class. See the remarks below.</p><h4>Syntax</h4><pre class="method-syntax">BiXmlResourceParser.getClassFromUri(<span class="methodArgument">oUri</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>oUri</code></td><td><code class="type">Biuri</code></td><td class="optional-column"></td><td></td><td>The location of the file. If this is a string a new URI is created from that string relative to the <code><a href="BiApplication.html#adfPath">ADF path</a></code>.</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">Function</code></p></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?