• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

XML Parser

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are asking for a book - or at least a long article - do a search for "java XML tutorial" on yahoo.
Bill
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java 1.4 has XML support - look at the packages starting with javax.xml, org.w3c.dom and org.xml.sax
Bill
 
You got style baby! More than this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic