Java XML transformer for processing XMLWith 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, import java.io.*; 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. TransformerFactory 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, DOMSource 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.
|
|
|||
|
||||
“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”
Copyright - © 2004 - 2019 - All Rights Reserved.