XML File | This node loads an XML file and provides its content for further processing. | |
XML Text | This node converts a text string in an XML document and provides it for further processing. | |
XSLT | This node transforms XML documents into other XML or 'human-readable' documents. | |
XPath Expression | This node provides access to the data of XML files. |
Ventuz provides several nodes to read, parse and evaluate XML documents.
The XML File node reads .xml files and provides the contained XML document as output property. The input property File specifies the text file which, if not already residing there, will be copied to the Data project folder. If the AutoUpdate property is enabled, Ventuz will reload and update the XML data if the specific file was modified. This is an easy way to provide Ventuz scenes with new content.
The ASync property makes it possible to load XML files in a background process without disturbing the rendering. In addition, four namespaces can be defined that should be shortened to the expressions ns1 to ns4. This way when using long URLs in your XML Document for your Namespaces you can simplify their usage in your XPath Expressions.
The XML Text node is very similar to the XML File. The only difference is that this node creates the XML document from a text string and not an XML file. This is very useful if one wants to create and evaluate XML dynamically.
The XSLT provides the functionality for an XSL Transformation. XSLT is used for transforming XML documents into other XML documents, text documents or HTML documents. The XML property takes the XML document which should be transformed. The XSL property takes the XML document which provides the transformation rules. The transformation result is provided as a string value by the output property Transformed.
XPath expressions can refer to all or part of the text, data and values in XML elements, attributes, processing instructions and even comments. They can also access the names of elements and attributes. XPath Expressions can be used in both valid and well-formed XML, with and without defined namespaces. Ventuz supports all XPath commands for accessing data in XML files.
Any number of XPath Expressions can be bound to one XML Document in order to access its data. XPath Expressions can be created and changed dynamically. In combination with a Convert to Text node, XPath Expressions can be created out of any value source.
XPath Expression nodes have four output properties. Ventuz will automatically try to type-convert the data read from the XML data source to all four output properties. If namespaces have been defined in the XML File or Text nodes, these namespaces can be addressed in an XPath Expression by adding the prefixes 'ns1' to 'ns4'.
The following XPath expressions refer to this short XML document:
<myXML> <application> <name>Ventuz Designer</name> <release>4.2.0</release> </application> <application> <name>Ventuz Runtime</name> <release>4.2.0</release> </application> <application> <name>Ventuz Director</name> <release>4.2.0</release> </application> </myXML>
/myXML/application[1]/name | returns the name of the first "application" element, i.e. "Ventuz Designer" |
/myXML/application[position()=3]/release | returns the "release" data of the third "application" element, i.e. 4.2.0 |
round(sum(/myXML/application/release)) | returns the rounded sum of all "release" element values, i.e. 13 |