Revision [62]

Last edited on 2009-09-18 10:31:21 by DavidLee
Simplified example of a document wrapping an XDM result set



Revision [61]

Edited on 2009-09-18 09:39:41 by DavidLee
=====Exchange of XDM Data between XDM Tools and tools which are not XDM capible.=====
An XDM Producer produces XDM data and this needs to be read by tool which is not XDM capible.
For example an XQuery which produces a sequence that needs to be passed to an XSLT 1.0 transformation as its context node. The XSLT transform requires a single document node as input, but the XQuery is producing a sequence of nodes.
With a serialization format which appears as a Text Serialized XML Document, the XSLT transform can process the document and extract the XDM values as INFOSET values.
XDM Producer: An XQuery which produces a sequence.
bar,"text", 123
XDM Consumer: An implementation of an XSLT 1.0 processor which expects a single document as its root context.
Passing the results from the XDM Producer to the XDM Consumer is accomplished by wrapping the sequence in a XML Document conforming to a standardized schema. The XDM Consumer (XSLT) can then parse the XML Document and extract the XDM values treating them as infoset values.
Simplified example of a document wrapping an XDM result set


=====Exchange of XDM data between XDM Tools from the same vendor in the same environment=====
In some cases, even when using the same vendor's API's exchange of XDM data in the vendor's native API is not practical. For example, in a complex program there may be fixed interfaces for exchanging data between modules such as Streams or Byte Arrays. Thus cooperating modules in the same environment may not be able to exchange data even if they both produce and consume the same native data types.
An example.
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 and implemented by the same vendor using the same native XDM data types. However the interfaces between these modules restrict the data types to byte arrays which prevents XDM data from being interchanged.
If all XDM Tool modules can agree on a standard text serialization format then data may still be interchanged.
XDM Producer: An implementation of an XPath 2.0 processor
Example, an xpath that returns a sequence of nodes
XDM Consumer: An implementation of an XQuery processor which expects a sequence of nodes as an external variable from in the same data type as the XDM Producer.
declare variable $list as element(bar)* external ;
A internal interface to these modules that only allows byte arrays as inputs and outputs.
To pass the results from the XDM Producer to the XDM Consumer across the interface which only allows text (byte arrays) serialization is produced by the XDM Producer and the resulting byte stream is reconstituted and passed to the XDM Consumer.
Simplified example of a Java API passing results through serialization using a hypethetical implementations of XPath and XQuery.
// XPath
byte[] executeXPath()
XdmValue value = Xpath.execute("/foo/bar");
byte[] serialized = result.serialize();
return serialized ;

// XQuery
void executeXQuery( byte[] parameter )
XdmValue value = XdmValue.deserialize( serialized );
XQuery xquery = new XQuery( "declare variable $list as element(bar)* external ; ... ") ;
xquery.setParameter( "list" , value );
// Coordinator
byte[] value = executeXPath();
executeXQuery( value );

Revision [60]

The oldest known version of this page was created on 2009-09-18 09:26:14 by DavidLee
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki