OpenWGA 7.9 - TMLScript reference
WGA » WGA.XmlMethod :
parse([xmlText [, url]])
On object | WGA.Xml |
Usage |
Parses XML text and returns a DOM document object for it |
Description |
This function uses the Java XML Parser Dom4J to parse the given XML text and returns its DOM document object of class org.dom4j.Document. For backward compatibility there still is a global function "parseXML()" available whose use is discouraged since OpenWGA 5.3. |
Parameters |
xmlText (String, optional): XML text to be parsed. Omit to create an empty DOM document. url (String, optional): An URL which should be used to resolve relative references in the XML text, like a DOCTYPE reference. |
Return value | Java object of type org.dom4j.Document |
Allowed in script types |
|
Examples |
Example XML to parse: <config> Example for parsing this XML, selecting all <col> nodes and setting the resulting list as WebTML variable: <tml:script> Iterating over the node objects with a <tml:foreach> tag. We use TMLScript to extract the text of the ID attribute and the <col> tag itself: <tml:foreach type="itemvalue" item="cols" currentvalue="col"> |