• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

how to read an XML file in java?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
reply
    Bookmark Topic Watch Topic
  • New Topic