Reading XML from JavaYou can use Java API for XML Processing (JAXP) for processing the XML document using your java code. This API has all the classes needed to work with XML documents. It has all the necessary methods and properties for manipulating the XML documents.
To read the XML document from java code, you need a document object first. This is created in three steps using the JAXP. First a DocumentBuilderFactory is created and then a DocumentBuilder is created. Then finally a Document object is created. The XML file is loaded into it and then certain methods like getElementsByTagName() are used to retrieve all the elements of a particular name and store them in an array called NodeList. This NodeList is looped through using a 'for' loop or some other way to get all the values needed.
|
|
||
|
|||
“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”
Copyright - © 2004 - 2019 - All Rights Reserved.