• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

XML and Java

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i use java with XML. If i want to parse the xml document with java code, then how it can be possible. Please let me know, if any1 knows about this. I'm aware of java and xml as well.
regards,
Raheel.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you can do is really phenomenal.
Just for example, you can send the data input by a user in a webpage as a response to an event ( as a click of a button) as a �node� to the �Solver� which is written in Java, which can then retrieve the data stored in the node using
A sample code can run thus:
public String getDatabaseValues(Node eqNode, Document doc) {
//instantiate the variables
String st = ""; String st2 = ""; String st3 = "";
NamedNodeMap nm = eqNode.getAttributes();
//
if(nm.getNamedItem("Pfs")!=null){
st1 = nm.getNamedItem("NodeName").getNodeValue();
etc�etc..
 
Varun_Pant
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DOM is the API for Document Object Model. DOM provides a representation of XML document as a tree, with data stored in the nodes: Each node representing a portion of data drawn from the original document.
Using a suitable XML parser , like Apache Xerces, one can create a DOM tree.
Refer any good book on DOM and parsing XML data.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Varun_Pant:
DOM is the API for Document Object Model. DOM provides a representation of XML document as a tree, with data stored in the nodes: Each node representing a portion of data drawn from the original document.
Using a suitable XML parser , like Apache Xerces, one can create a DOM tree.
Refer any good book on DOM and parsing XML data.


You can also look into JDOM (www.jdom.org) which provides a more Java-centric and lightweight for of XML document handling. It is much easier to use than DOM for Java development with XML.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!