The following are the steps to be performed for writing XML data:
- Because of the way an XML document is stored, we need to convert it into a different format before it's really feasible for us to print it out to a file in the same format in which we got the original XML. To do this, we're going to make use of an XML-specific class called Transformer. As with a number of the classes we deal with when dealing with XML in the document model, Transformer instances are best created using a factory. In this case, the factory is called TransformerFactory, and like many factories, it exposes the newInstance() method, allowing us to create one when we need it. To get our new Transformer object, which will allow us to convert ...