Instructions
- 1
Open the Java editor you use to create your applications. Open the project, and then double-click the Java source code file you want to use with the Transformer class.
2Add the libraries to the top of the source code file. You must add the "includes" to use the libraries. The following code adds the includes to the source code:
include javax.xml.transform;
3Initialize the Java Transformer class. The following code code initializes the class:
TransformerFactory trans = TransformerFactory.newInstance( );
4Load the XLST file you want to use to transform the XML data. The following code loads a file named "styles.xlst":
Transformer file = transFact.newTransformer("stles.xlst");
5Remove the default attribute. You remove the default attribute by setting it to a blank string. The following code removes the attribute:
file.setParameter("default", "");
6Save the changes and click the "Run" button in the editor's toolbar to view the code changes in the debugger.
No comments:
Post a Comment