|
Pankaj Kumar's WeblogRandom thoughts, musings, experiences, ideas, and opinions |
December 18, 2004XInclude Processing with J2SE5.0While working with long XML documents, I always felt it was better to break them into smaller documents and have a master document that could simply include the smaller documents. In fact, I always found it amazing that the base XML specification didn't include such a capability. This changed with XML Inclusion spec. becoming a W3C Proposed Recommendation. Recently, while looking for a processor that allowed me to create a single XML document, starting with a document that included others, I was pleasantly surprized to find XML Inclusion support in J2SE5.0. You could simply mark a SAXParserFactory or DocumentBuilderFactory to be XIncludeAware and it will do the processing. To test this feature, I wrote this simple Java program that treads a XMl document with XInclude tags from standard input and writes the consolidated XML document to the standard output. As You can see, I have used an identity transformation from SAXSource to StreamResult for serializing the XML document. This technique has the additional advantage of applying any XSLT transformation specified in the source document, justifying the XMLProcessor name of the program. Posted by pankaj at December 18, 2004 10:26 PMComments
Yep: Post a comment
|
|
|
Disclaimer: Views expressed here are my own and do not represent those of my employer.
© 2001-2005 Pankaj kumar. All Rights Reserved. |
|