Java XML transformer for processing XML
With the java XML transformer you can transform the XML documents into other forms. The most common imports that are needed to work with the transformer class in your java program include,
To create a transformer object you have to use the TransformerFactory's newTransformer() method. With this method you can create an instance of the transformer class.
transfact = TransformerFactory.newInstance();
The above code snippet will do the transformation needed in your java program. The transform method of the transformer object takes two parameters called the source and the result. In the above code snippet the 'src' is a DOMSource object and the 'res' is a StreamResult object. These two can be created using the code as given below,
src = new DOMSource(docObj);
In the above code the 'docObj' is the document object and the 'fileOutStr' is the FileOutputStream.
Lots of examples of using the transformer object is available in the internet.
Copyright - © 2004 - 2017 - All Rights Reserved.