• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to read the contents of xml file

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

How to read an xml file and write to an xml file using DOM parser. My xml file is as below i should read <CUSTOMERS> into one xml file and </USERS> into another xml file along with tags.

<CUSTOMERS>
<CUSTOMER>
<CUSTOMER_ID>BRELLINGER</CUSTOMER_ID>
<STATUS>SUCCESS</STATUS>
<ERROR_CODE></ERROR_CODE>
</CUSTOMER>
<CUSTOMER>
------------
</CUSTOMER>
</CUSTOMERS>
<USERS>
<USER>
<USER_ID></USER_ID>
<CUSTOMER_ID>BRELLINGER</CUSTOMER_ID>
<STATUS>SUCCESS</STATUS>
<ERROR_CODE></ERROR_CODE>
<ERROR_MSG></ERROR_MSG>
</USER>
<USER>
------
------
</USER>
</USERS>

Iam new to xml, anybody please help
Thanks In Advance,
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
New to XML and don't know anything about how to process it in Java? Then reading a tutorial (or a book) should be the first thing you do. Here is a link to a tutorial.
 
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The book Processing XML with Java by Elliotte Rusty Harold is a good intro book, covering the various aspects of XML. There is a free online version available to read. There some good samples in it on how to do exactly what you are asking. After reading it, you can then look at other books that get in more details about the various topics (SAX, DOM, XSLT, etc).
[ January 31, 2007: Message edited by: Mark Vedder ]
 
sai prasanna
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply
 
And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic