Transformations API for XML - IV
9 May 2008Do read the first 3 posts on this topic before going through this one.
Continuing with the example, we have following code for the XML document:
XMLStreamReader streamReaderXML=null; … //define the Source object for the XML document Source XML=new StAXSource(streamReaderXML);
Transformation results in the following:
XMLStreamWriter streamWriter=null; … //define the Result object Result XML_r=new StAXResult(streamWriter);
If you want to use Event Iterator API, the code snippet presented below willbe useful for you.
XMLEventReader eventReaderXSL=null; //define the Source object for the stylesheet XSL=new StAXSource(eventReaderXSL); // for XML file XMLEventReader eventReaderXML=null; //define the Source object for the XML document XML=new StAXSource(eventReaderXML); // result fo transformation XMLStreamWriter streamWriter=null; //define the Result object Result XML_r=new StAXResult(streamWriter);
Hope this helps.
Related Posts:
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: Transformations API for XML - IV