• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

parsing data in xml document

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,
I hope u all fine.

In how many ways we can parse the data from the xml document ?

do let me know the answer for this...

Thanks & Regards,
Prasath
 
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 should start by reading this Sun tutorial on working with XML in Java.
Bill
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Prasath,

get a good book (Safari online book shelf is not bad). To give you an idea:
You have 4 possibilities to work with XML:

1) Treat it as a text string (including regular expressions) -- not recommended
2) Use a SAX parser. J2SE1.4 has one built in. The parser will fire one event for everything it encounters in the XML and you need to provide a class that handles the events
3) Use a PULL parser (like kXML). Works a little like SAX, the main difference is that you ask for the next piece instead of getting it thrown at you.Works very well also on J2ME (Phone, PDA)
4) Use a DOM parser. J2SE 1.4 has one build in. The parser builds the XML Document as a (in memory) tree and you can move around, query and update it

Good luck with your studies.
:-) stw
 
Do not set lab on fire. Or 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