File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes XML Parser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "XML Parser" Watch "XML Parser" New topic
Author

XML Parser

Jithesh Kozhipurath
Ranch Hand

Joined: Aug 27, 2003
Posts: 76
Hai all,
Is there any need for separate XMLparser for jdk1.4.If it is available how to use the XML parser. How to set the class path and what are the methods to parse the XML document. What parser can we use(SAX, DOM etc.). My requirement is to send a XML request & retrive a XML response and parse it.
Thanks in advance.
Jithesh


Jithesh K
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12681
    
    5
You are asking for a book - or at least a long article - do a search for "java XML tutorial" on yahoo.
Bill
S. Sumukh
Ranch Hand

Joined: Aug 27, 2003
Posts: 31
Afaik jdk1.4 wont come with built in xml parser.
download it(xereces) from apache..
U can use SAX for ur requirement...its very simple..
sumukh
Jithesh Kozhipurath
Ranch Hand

Joined: Aug 27, 2003
Posts: 76
Thanks,
Is there any sample code available for XML Parsing. I want to read an XML file and convert in to records with no tags.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
A word of background: A DOM (document object model) style parser reads your XML and generates a tree of objects. I find working with the tree more complex than I need for simple stuff like reading a configuration file, but it is very good if you want to modify the data and write it back to new XML or use some other advanced features.
A SAX style parser calls a "handler" object of your choice every time it finds something interesting in the XML, like the start of a tag, some characters, the end of the tag, etc. It is relatively easy to write your own handler to collect the characters SAX sends you into records as it goes along. Since SAX doesn't build a tree in memory, it can use less memory. But it can't rewrite the tree to a new XML file.
Here is some work I did with SAX parsing. Make it your second tutorial on SAX as it assumes you did well with your first.
http://www.surfscranton.com/architecture/ReusableSAXParsers.htm


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12681
    
    5
Java 1.4 has XML support - look at the packages starting with javax.xml, org.w3c.dom and org.xml.sax
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML Parser
 
Similar Threads
Local Language XML parsing
Use of XML Parser
XML Parser
XML Parser
Need Help in XML Parsing