[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 10336
  • Last Modified:

Read / Write XML File

Hi ...

I dont know anything about reading and writing an XML file through JAVA / JSP. Please help me out with plenty of examples, as I have a file in XML and I need to read it and insert into SQL. Also explain how to write an XML File.
2 Solutions
Reading and writing XML file sin JAVA is very easy.

You need a parser to read and write XML files

basically there are 2 types of parsers
DOM parser and SAX parser
 DOM parser - reads the data and holds it in memory like a tree and you can walk thorugh or add elemens  or nodes in the XML

SAX parser is lightweight and is used for one time reading.

If the xml file is HUGE, use SAX
otherwise use JDOM or DOM, but I recommend JDOM as it require less code than DOM
This is JDOM tutorial that can get you started http://www.javaworld.com/javaworld/jw-05-2000/jw-0518-jdom.html

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now