<?xml version="1.0" encoding="Windows-1255" ?><Script name="Xml" id="core.lib:Xml" sort="26" urn="core.lib:Xml.js" toc="\"><Summary>Contains macros for handling XML objects.</Summary><Copyright>(c) SAP AG 2003-2006. All rights reserved.</Copyright>
<Topics>
<Function name="CHECKXML" also="core.lib:Xml!PARSEXML core.lib:Xml!GETXML" sortGroup="true" scope="public" id="core.lib:Xml!CHECKXML" sort="35" group="Functions" seq="0000"><Summary>Checks an XML object for parsing errors.</Summary><Parameters signature="function:: &lt;b&gt;CHECKXML&lt;/b&gt;(&lt;i&gt;xml&lt;/i&gt;, &lt;i&gt;prompt&lt;/i&gt;) &amp;rarr; String"><Param name="xml" type="XmlDocument">The XML object.</Param><Param name="prompt" type="String" default="null">Title for error prompts; if omitted, no prompts will be displayed (silent mode).</Param></Parameters><Return type="String">The error description, or an empty string if &lt;i&gt;xml&lt;/i&gt; is valid.</Return><SeeAlso>&lt;q ref=&quot;core.lib:Xml!PARSEXML&quot;&gt;PARSEXML&lt;/q&gt; | &lt;q ref=&quot;core.lib:Xml!GETXML&quot;&gt;GETXML&lt;/q&gt;</SeeAlso></Function>
<Function name="ESCAPEXML" also="core.lib:Xml!UNESCAPEXML" sortGroup="true" scope="public" id="core.lib:Xml!ESCAPEXML" sort="35" group="Functions" seq="0001"><Summary>Returns an encoded form of the given string that can be used in XML documents.</Summary><Parameters signature="function:: &lt;b&gt;ESCAPEXML&lt;/b&gt;(&lt;i&gt;str&lt;/i&gt;) &amp;rarr; String"><Param name="str" type="String">The string to encode.</Param></Parameters><Return type="String">The endcoded XML string.</Return><SeeAlso>&lt;q ref=&quot;core.lib:Xml!UNESCAPEXML&quot;&gt;UNESCAPEXML&lt;/q&gt;</SeeAlso></Function>
<Function name="GETXML" also="core.lib:Xml!PARSEXML" sortGroup="true" scope="public" id="core.lib:Xml!GETXML" sort="35" group="Functions" seq="0002"><Summary>Gets an XML object from a specified url (using HTTP/GET).</Summary><Parameters signature="function:: &lt;b&gt;GETXML&lt;/b&gt;(&lt;i&gt;url&lt;/i&gt;, &lt;i&gt;onsuccess&lt;/i&gt;, &lt;i&gt;params&lt;/i&gt;, &lt;i&gt;onerror&lt;/i&gt;) &amp;rarr; XmlDocument"><Param name="url">The url containing the XML document.</Param><Param name="onsuccess" type="Function" default="null">Callback function to invoke upon successfull completion of the operation.</Param><Param name="params" type="Object" default="null">A parameters object to pass to the callback function.</Param><Param name="onerror" type="Function" default="null">Callback function to invoke when an error is encountered.</Param></Parameters><Return type="XmlDocument">The loaded XML object if the operation is synchronous; otherwise, &lt;code&gt;null&lt;/code&gt;</Return><Remarks>&lt;ul&gt;&lt;li&gt;If the &lt;code&gt;onsuccess&lt;/code&gt; callback is omitted, the operation is synchronous. In this case, the function will wait unitl the load operation is completed. The loaded XML object will be returned as the function return value. &lt;/li&gt;&lt;li&gt;If the &lt;code&gt;onsuccess&lt;/code&gt; callback is provided, the operation is asynchronous. In this case, the function will return immediately, and the load operation will be spawned in a separate thread. Once the load operation is completed, either the &lt;code&gt;onsuccess&lt;/code&gt; or &lt;code&gt;onerror&lt;/code&gt; callback will be invoked depending on the operation success. In either case, the loaded XML object and the &lt;code&gt;params&lt;/code&gt; object will be passed to the callback function. &lt;/li&gt;&lt;li&gt;Use &lt;q ref=&quot;core.lib:Xml!CHECKXML&quot;&gt;CHECKXML&lt;/q&gt; to check the returned XML object for errors. &lt;/li&gt;&lt;/ul&gt;</Remarks><SeeAlso>&lt;q ref=&quot;core.lib:Xml!PARSEXML&quot;&gt;PARSEXML&lt;/q&gt;</SeeAlso></Function>
<Function name="JS2XML" also="core.lib:Xml!XML2JS" sortGroup="true" scope="public" id="core.lib:Xml!JS2XML" sort="35" group="Functions" seq="0003"><Summary>Converts a JavaScript object of arbitrary complexity into a corresponding XML string fragment.</Summary><Parameters signature="function:: &lt;b&gt;JS2XML&lt;/b&gt;(&lt;i&gt;obj&lt;/i&gt;) &amp;rarr; String"><Param name="obj" type="Object">The JavaScript object to convert.</Param></Parameters><Return type="String">The XML string fragment representing the given JavaScript object.</Return><Remarks>&lt;h2&gt;Sample&lt;/h2&gt;
A sample JavaScript object &lt;code&gt;obj:&lt;/code&gt;
&lt;pre&gt;
var obj = {a:'aaa', b:'bbb', c:123, d:true, e:[{f:'fff', g:100}, true, [10, 20, 30]]}
&lt;/pre&gt;
The corresponding XML fragement JS2XML(&lt;code&gt;obj):&lt;/code&gt;
&lt;pre&gt;
&amp;lt;struct&amp;gt;
   &amp;lt;string name=&quot;a&quot;&amp;gt;aaa&amp;lt;/string&amp;gt;
   &amp;lt;string name=&quot;b&quot;&amp;gt;bbb&amp;lt;/string&amp;gt;
   &amp;lt;number name=&quot;c&quot;&amp;gt;123&amp;lt;/number&amp;gt;
   &amp;lt;boolean name=&quot;d&quot;&amp;gt;true&amp;lt;/boolean&amp;gt;
   &amp;lt;array name=&quot;e&quot;&amp;gt;
      &amp;lt;struct&amp;gt;
         &amp;lt;string name=&quot;f&quot;&amp;gt;fff&amp;lt;/string&amp;gt;
         &amp;lt;number name=&quot;g&quot;&amp;gt;100&amp;lt;/number&amp;gt;
      &amp;lt;/struct&amp;gt;
      &amp;lt;boolean&amp;gt;true&amp;lt;/boolean&amp;gt;
      &amp;lt;array&amp;gt;
         &amp;lt;number&amp;gt;10&amp;lt;/number&amp;gt;
         &amp;lt;number&amp;gt;20&amp;lt;/number&amp;gt;
         &amp;lt;number&amp;gt;30&amp;lt;/number&amp;gt;
      &amp;lt;/array&amp;gt;
   &amp;lt;/array&amp;gt;
&amp;lt;/struct&amp;gt;
&lt;/pre&gt;</Remarks><SeeAlso>&lt;q ref=&quot;core.lib:Xml!XML2JS&quot;&gt;XML2JS&lt;/q&gt;</SeeAlso></Function>
<Function name="PARSEXML" also="core.lib:Xml!CHECKXML core.lib:Xml!GETXML" group="Functions" sortGroup="true" scope="public" id="core.lib:Xml!PARSEXML" sort="35" seq="0004"><Summary>Parses a string containing an XML document and returns the results in a new XML object.</Summary><Parameters signature="function:: &lt;b&gt;PARSEXML&lt;/b&gt;(&lt;i&gt;str&lt;/i&gt;) &amp;rarr; XmlDocument"><Param name="str" type="String" default="null">The XML string; if omitted, an empty XML object is created.</Param></Parameters><Return type="XmlDocument">The parsed XML object. Use &lt;q ref=&quot;core.lib:Xml!CHECKXML&quot;&gt;CHECKXML&lt;/q&gt; to check for errors.</Return><SeeAlso>&lt;q ref=&quot;core.lib:Xml!CHECKXML&quot;&gt;CHECKXML&lt;/q&gt; | &lt;q ref=&quot;core.lib:Xml!GETXML&quot;&gt;GETXML&lt;/q&gt;</SeeAlso></Function>
<Function name="POSTXML" also="core.lib:Xml!PARSEXML" sortGroup="true" scope="public" id="core.lib:Xml!POSTXML" sort="35" group="Functions" seq="0005"><Summary>Posts an XML object to a specified url (using XML/HTTP).</Summary><Parameters signature="function:: &lt;b&gt;POSTXML&lt;/b&gt;(&lt;i&gt;xml&lt;/i&gt;, &lt;i&gt;url&lt;/i&gt;, &lt;i&gt;onsuccess&lt;/i&gt;, &lt;i&gt;params&lt;/i&gt;, &lt;i&gt;onerror&lt;/i&gt;, &lt;i&gt;headers&lt;/i&gt;, &lt;i&gt;repsponse&lt;/i&gt;) &amp;rarr; XmlDocument"><Param name="xml" type="XmlDocument">The XML object to save.</Param><Param name="url">The target url for the save operation.</Param><Param name="onsuccess" default="" type="Function">Callback function to invoke upon successfull completion of the operation.</Param><Param name="params" default="" type="Object">A parameters object to pass to the callback function.</Param><Param name="onerror" default="" type="Function">Callback function to invoke when an error is encountered.</Param><Param name="headers" default="" type="String[name]">An optional table of headers to set in the request.</Param><Param name="repsponse" default="Number, text" type="{status">An optional object for receiving the raw XML/HTTP response (synchronous mode only).</Param></Parameters><Return type="XmlDocument">The save results if the operation is synchronous; otherwise, &lt;code&gt;null&lt;/code&gt;</Return><Remarks>&lt;ul&gt;&lt;li&gt;If the &lt;code&gt;onsuccess&lt;/code&gt; callback is omitted, the operation is synchronous. In this case, the function will wait until the save operation is completed. The save results will be returned as the function return value. &lt;/li&gt;&lt;li&gt;If the &lt;code&gt;onsuccess&lt;/code&gt; callback is provided, the operation is asynchronous. In this case, the function will return immediately, and the save operation will be spawned in a separate thread. Once the save operation is completed, either the &lt;code&gt;onsuccess&lt;/code&gt; or &lt;code&gt;onerror&lt;/code&gt; callback will be invoked depending on the operation success. In either case, the save results and the &lt;code&gt;params&lt;/code&gt; object will be passed to the callback function. &lt;/li&gt;&lt;/ul&gt;</Remarks><SeeAlso>&lt;q ref=&quot;core.lib:Xml!PARSEXML&quot;&gt;PARSEXML&lt;/q&gt;</SeeAlso></Function>
<Function name="UNESCAPEXML" also="core.lib:Xml!ESCAPEXML" sortGroup="true" scope="public" id="core.lib:Xml!UNESCAPEXML" sort="35" group="Functions" seq="0006"><Summary>Returns the decoded form of a string encoded with the &lt;q ref=&quot;core.lib:Xml!ESCAPEXML&quot;&gt;ESCAPEXML&lt;/q&gt;.</Summary><Parameters signature="function:: &lt;b&gt;UNESCAPEXML&lt;/b&gt;(&lt;i&gt;str&lt;/i&gt;) &amp;rarr; String"><Param name="str" type="String">The XML string to decode.</Param></Parameters><Return type="String">The decoded string.</Return><SeeAlso>&lt;q ref=&quot;core.lib:Xml!ESCAPEXML&quot;&gt;ESCAPEXML&lt;/q&gt;</SeeAlso></Function>
<Function name="XML2JS" also="core.lib:Xml!JS2XML" sortGroup="true" scope="public" id="core.lib:Xml!XML2JS" sort="35" group="Functions" seq="0007"><Summary>Converts an XML fragment into a native JavaScript object.</Summary><Parameters signature="function:: &lt;b&gt;XML2JS&lt;/b&gt;(&lt;i&gt;node&lt;/i&gt;) &amp;rarr; Object"><Param name="node" type="XmlDocument">An XML fragment.</Param></Parameters><Return type="Object">The JavaScript object represented by the given XML fragment.</Return><Remarks>&lt;h2&gt;Sample&lt;/h2&gt;
A sample XML fragement &lt;code&gt;node:&lt;/code&gt;
&lt;pre&gt;
&amp;lt;struct&amp;gt;
   &amp;lt;string name=&quot;a&quot;&amp;gt;aaa&amp;lt;/string&amp;gt;
   &amp;lt;string name=&quot;b&quot;&amp;gt;bbb&amp;lt;/string&amp;gt;
   &amp;lt;number name=&quot;c&quot;&amp;gt;123&amp;lt;/number&amp;gt;
   &amp;lt;boolean name=&quot;d&quot;&amp;gt;true&amp;lt;/boolean&amp;gt;
   &amp;lt;array name=&quot;e&quot;&amp;gt;
      &amp;lt;struct&amp;gt;
         &amp;lt;string name=&quot;f&quot;&amp;gt;fff&amp;lt;/string&amp;gt;
         &amp;lt;number name=&quot;g&quot;&amp;gt;100&amp;lt;/number&amp;gt;
      &amp;lt;/struct&amp;gt;
      &amp;lt;boolean&amp;gt;true&amp;lt;/boolean&amp;gt;
      &amp;lt;array&amp;gt;
         &amp;lt;number&amp;gt;10&amp;lt;/number&amp;gt;
         &amp;lt;number&amp;gt;20&amp;lt;/number&amp;gt;
         &amp;lt;number&amp;gt;30&amp;lt;/number&amp;gt;
      &amp;lt;/array&amp;gt;
   &amp;lt;/array&amp;gt;
&amp;lt;/struct&amp;gt;
&lt;/pre&gt;
The corresponding JavaScript object XML2JS(&lt;code&gt;node):&lt;/code&gt;
&lt;pre&gt;
XML2JS(node) =&amp;gt; {a:'aaa', b:'bbb', c:123, d:true, e:[{f:'fff', g:100}, true, [10, 20, 30]]}
&lt;/pre&gt;</Remarks><SeeAlso>&lt;q ref=&quot;core.lib:Xml!JS2XML&quot;&gt;JS2XML&lt;/q&gt;</SeeAlso></Function>
<Function name="XMLNODES" also="core.lib:Xml!XMLNODE" sortGroup="true" scope="public" id="core.lib:Xml!XMLNODES" sort="35" group="Functions" seq="0008"><Summary>Returns the list of nodes that match a specified XPATH query.</Summary><Parameters signature="function:: &lt;b&gt;XMLNODES&lt;/b&gt;(&lt;i&gt;context&lt;/i&gt;, &lt;i&gt;path&lt;/i&gt;) &amp;rarr; xl"><Param name="context" type="xn">The query context (can be either an XML node or XML document object).</Param><Param name="path" type="String" default="null">An XPATH query (relative to %0) that defines the requested node.</Param></Parameters><Return type="xl">The requested nodes list.</Return><SeeAlso>&lt;q ref=&quot;core.lib:Xml!XMLNODE&quot;&gt;XMLNODE&lt;/q&gt;</SeeAlso></Function>
</Topics>
</Script>