Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to read the contents of xml file

 
sai prasanna
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • 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,
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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.
 
Mark Vedder
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks for the reply
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic