Read / Write XML File

Posted on 2004-10-21
Last Modified: 2008-09-09
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.
Question by:kishore_varier
    LVL 3

    Accepted Solution

    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.
    LVL 2

    Assisted Solution

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    If you're not part of the solution, you're part of the problem.   Tips on how to secure IoT devices, even the dumbest ones, so they can't be used as part of a DDoS botnet.  Use PRTG Network Monitor as one of the building blocks, to detect unusual…
    For Sennheiser, comfort, quality and security are high priority areas. This paper addresses the security of Bluetooth technology and the supplementary security that Sennheiser’s Contact Center and Office (CC&O) headsets provide.  
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now