Revision [76]
Last edited on 2009-09-18 13:37:52 by DavidLeeAdditions:
==XDM Producer==
Vendor A implementation of an XPath 2.0 processor
==XDM Consumer==
Vendor B implementation of an XQuery processor which expects a sequence of nodes as an external variable
Vendor A implementation of an XPath 2.0 processor
==XDM Consumer==
Vendor B implementation of an XQuery processor which expects a sequence of nodes as an external variable
Deletions:
XDM Consumer: Vendor B implementation of an XQuery processor which expects a sequence of nodes as an external variable
Revision [56]
Edited on 2009-09-18 08:28:09 by DavidLeeAdditions:
======XDM Serialization Use Case 2======
Deletions:
Revision [55]
Edited on 2009-09-18 08:27:28 by DavidLeeAdditions:
=====Exchange of XDM data between XDM Tools from different vendors in the same environment=====
An XDM Producer (for example XPath 2.0) outputs XDM data that it would like to exchange with an XDM Consumer (for example XQuery) which is running in the same environment but the XDM Tools are from different vendors. This likely means that the in-memory representations (e.g. in Java the Class or Interface objects) are not the same and may not have wrappers to convert them from Vendor A's XDM representation to Vendor B's represetnation.
If Vendor A and Vendor B agree on a standard text serialization format then data may still be interchanged.
XDM Producer: Vendor A implementation of an XPath 2.0 processor
Example, an xpath that returns a sequence of nodes
/foo/bar
XDM Consumer: Vendor B implementation of an XQuery processor which expects a sequence of nodes as an external variable
declare variable $list as element(bar)* external ;
To pass the results from Vendor A's XDM Producer to the Vendor B's XDM Consumer within the same (or different) environment, a text serialization is produced by the XDM Producer and the resulting byte stream is reconstituted using the API of Vendor B's implementation of the XDM Consumer.
Simplified example of a Java API passing results through serialization using a hypethetical VendorA and VendorB implementations of XPath and XQuery.
// Vendor A's XPath
VendorA.XdmValue result = VendorA.Xpath.execute("/foo/bar");
byte[] serialized = result.serialize();
// Vendor B's XQuery
VendorB.XdmValue value = VendorB.XdmValue.deserialize( serialized );
VendorB.XQuery xquery = new VendorB.XQuery( "declare variable $list as element(bar)* external ; ... ") ;
xquery.setParameter( "list" , value );
xquery.execute();
An XDM Producer (for example XPath 2.0) outputs XDM data that it would like to exchange with an XDM Consumer (for example XQuery) which is running in the same environment but the XDM Tools are from different vendors. This likely means that the in-memory representations (e.g. in Java the Class or Interface objects) are not the same and may not have wrappers to convert them from Vendor A's XDM representation to Vendor B's represetnation.
If Vendor A and Vendor B agree on a standard text serialization format then data may still be interchanged.
XDM Producer: Vendor A implementation of an XPath 2.0 processor
Example, an xpath that returns a sequence of nodes
/foo/bar
XDM Consumer: Vendor B implementation of an XQuery processor which expects a sequence of nodes as an external variable
declare variable $list as element(bar)* external ;
To pass the results from Vendor A's XDM Producer to the Vendor B's XDM Consumer within the same (or different) environment, a text serialization is produced by the XDM Producer and the resulting byte stream is reconstituted using the API of Vendor B's implementation of the XDM Consumer.
Simplified example of a Java API passing results through serialization using a hypethetical VendorA and VendorB implementations of XPath and XQuery.
// Vendor A's XPath
VendorA.XdmValue result = VendorA.Xpath.execute("/foo/bar");
byte[] serialized = result.serialize();
// Vendor B's XQuery
VendorB.XdmValue value = VendorB.XdmValue.deserialize( serialized );
VendorB.XQuery xquery = new VendorB.XQuery( "declare variable $list as element(bar)* external ; ... ") ;
xquery.setParameter( "list" , value );
xquery.execute();
Deletions:
An XDM Producer (for example XQuery) outputs XDM data that it would like to exchange with an XDM Consumer (for example XSLT) which is running in a different environment. Even if the the tools are from the same vendor they cannot directly exchange XDM data because the XDM representation is 'in memory' and cannot cross process boundries.
XDM Producer: An XQuery process which produces a sequences of nodes.
(
XDM Consumer: An XSLT process which accepts a XDM value as a parmeter
To pass the results from the XDM Producer to the XDM Consumer across environments, a text serialization is produced by the XDM Producer and the resulting file (or byte stream) is reconstituted in the environment of the XDM Consumer.
Example of a file based process
xquery -f query.xquery > result.txt
xslt -f style.xsl -param-name list -param-file result.txt