DataDirect XML Converters Architecture
The XML Converters offer a bidirectional architecture model. For example, the EDI adapter supports both EDI to XML and also XML to EDI. DataDirect XML Converters are available for both Java and .NET. The diagram below depicts the DataDirect XML Converters in a J2EE Application Server environment:
XML Converters Architecture
Click Graphic for a full-sized image
How do DataDirect XML Converters work?
The DataDirect XML Converters work in two ways:
- In Java, files and resources are referred to using URI's. The basic URI resolvers that are included with Java are capable of resolving files, http, ftp, and a few other protocols. DataDirect XML Converters are based on providing libraries that extend the ability of Java URI resolvers to understand other file schemes, for example, EDI files, flat files, relational databases, web services, XML databases, other file systems, etc.
XSLT and XQuery provide standard-based ways to access XML files using the document function, but they can only resolve the files and URL's supported by the standard URI resolvers. Now, using DataDirect XML Converters, you could write the following:
- In XSLT: xsl:value-of select="document('converter:EDI?file:///c:/purchaseOrder.edi')"
- In XQuery: doc("converter:EDI?file:///c:/purchaseOrder.edi")
DataDirect XML Converters will seamlessly resolve the URI and stream the data to your XSLT or XQuery processor according to how you configured your XML Converters to work — thus enabling access to non-XML files. So, for example, you could write and deploy an XQuery that accessed EDI data.
- DataDirect XML Converters can also be called directly from your own programs. For example, if you need to read in EDI as XML, you can just do this:
Converter toXML = ConverterFactory.newInstance().newConvertToXML("adapter:EDI");
toXML.convert(new StreamSource("inputURL"), new StreamResult("outputURL"));
The input and output sources can be anything that supports a stream, including classes like StringReader and ByteArrayOutputStream.