Meaningless Drivel is fun!*
The moose likes XML and Related Technologies and the fly likes how to read an XML file in java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "how to read an XML file in java?" Watch "how to read an XML file in java?" New topic
Author

how to read an XML file in java?

gani bhasky
Greenhorn

Joined: Jan 19, 2001
Posts: 2
There is an XML file. I need to read this file and in some line of code in XML (say 4)there is a file "file1.some". I need to change this to "file2.some". How to do this in java?
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
Reading and writing is just like I/O. The trick part is to read in the values from a XML file. There are many ways to do this. You can use Xerces, JDOM, JAXP.
gani bhasky
Greenhorn

Joined: Jan 19, 2001
Posts: 2
Thank U for your reply. I just downloaded xerces.jar file, can you just tell me what to do next. From Java have to read a value from an XML file and write some other value. Can you please explain the steps.
with thanks,
gani.
Peter Tran
Bartender

Joined: Jan 02, 2001
Posts: 783
Gani,
You should read the sample code: http://xml.apache.org/xerces-j/samples.html and the FAQ to see how to use the parser: http://xml.apache.org/xerces-j/faqs.html. The documentation for the Xerces parser are pretty well written and up-to-date.
-Peter
 
Consider Paul's rocket mass heater.
 
subject: how to read an XML file in java?
 
Similar Threads
read the values from xml using java
Exchanging XML Data between two Web Apps
XML validation and parsing using xslt
Getting started with XML
Parsing BLOB datatype