XML programming in JavaJava has an API for working with the XML documents. By using this API you can read the data from the XML document, create a new XML document, update the XML document and even remove the existing nodes in the XML document. You need to import certain package and classes to work with those API. The most relevant imports that are to be done are, import org.w3c.dom.Document; With these imports in place you have to create a document object to work with the XML document. This document object is created in three steps. The first one is the creation of the DocumentBuilderFactory and then the creation of the DocumentBuilder object. Then the final step is the creation of the document object. If you want to create a new XML document you can do so by creating the elements using the createElement() method. You could use the creatTextNode() method to create the new text node and then use the appendChild() method to append the child elements to the root node. Check the Java API for the other classes and the methods that can be used to manipulate the XML documents.
|
|
|||
|
||||
“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”
Copyright - © 2004 - 2019 - All Rights Reserved.