The XML Feature contains operators that allow the processing of XML documents. Add de.uniol.inf.is.odysseus.server.xml.feature to your Odysseus in order to use this feature.
This operator allows the transformation from a Tuple object into a XML document. The transformation requieres a XML schema definition (XSD) which describes the structure of the XML document and the mapping between that document and the Tuple object. However, there are different approaches to provide that schema information to the operator:
Firstly, the schema can be provided via file access (whereas the file can be located either locally or on a webserver).
Secondly, the schema information can be passed via string.
Thirdly, the schema information can be a payload on the current Tuple object which can be advantageous if the XSD has to change dynamically (
xsdattribute = 'xsd'). Thus, it is possible to produces different documents within one data stream. Besides that, the root element of the document might change and therefore it is possible to define an attribute of the Tuple object that carries this information as well (
rootattribute = 'root').
Furthermore, the operator allows to use XPath expressions for an enriched mapping between attributes of the Tuple object and the XML document. The expressions can be applied as
options or again as a payload on the Tuple object (
xpathattributes = ['xpaths']). If
xpathattributes is used, each defined Tuple attribute can contain several expressions. Every expression is followed by an attribute name that has to match with an attribute of the Tuple object (e.g. [attributename][delimeter][expression]). These pairs are also separated by a delimiter (default is the , symbol). If the
options alternative is used, the attribute-expression pair is given explicitly as option parameter.
It is also possible to transform XML documents to Tuple objects whereas the mapping between attributes is done by XPath expressions and Tuple schema.
With this operator, it is possible to combine two different documents into one single document:
The operator functions as the Enrich operator that evaluates a given predicate and only merges the two documents if the predicate is true. In order to compare two documents, predicates can consist of XPath expressions that return a single value. The second parameter is the target parameter which specifies a location in the left document where the right document should be inserted. However, the right document is the enrichment for the left document.
It is possible to use MEP Functions and XPath expression together within XML documents to manipulate values or project only a subset of the origin document (e.g. this operator works like Map operator).
This operator splits a document in subsets whereas the each split point is defined by an XPath expression.
The XMLTransform operator allows to transform a given XML with Extensible Stylesheet Language Transformations (XSLT):
There are three different ways to provide the XSLT information. First, the information given by a string in the operator definition.
Secondly, the XSLT can be read from file (whereas the file can be located either locally or on a web server).
And thirdly, the operator can be configured (
dynamic = true) in a way that the XML document will be scanned for an embedded XSLT.
This Protocol handler allows to load XML documents into the Odysseus system whereas the document will be represented by the XMLStreamObject data type. Furthermore, with the
tag_to_strip option it is possible to shorten the XML document and thus process only a part of the document. The option awaits an element name that is present in the document.