How can i read a XML file in Java


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: How can i read a XML file in Java

  1. #1
    zahid Guest

    How can i read a XML file in Java


    HI,

    Can any body tell me how to read a XML file using Java to obtain its contents.



  2. #2
    Zahid Guest

    Re: How can i read a XML file in Java


    "zahid" <zsultan@hotmail.com> wrote:
    >
    >HI,
    >
    >Can any body tell me how to read a XML file using Java to obtain its contents.


    Please view this site www.ibooks.com/xml and you'll find
    your answer as well as many other things too, it is
    slowly downloaded but read it don't leave it.

    Ali
    (XML & JAVA Programmer)
    <MICROSOFT>
    <CALIFORNIA>


  3. #3
    Dom Bucciarelli Guest

    Re: How can i read a XML file in Java


    "zahid" <zsultan@hotmail.com> wrote:
    >
    >HI,
    >
    >Can any body tell me how to read a XML file using Java to obtain its contents.
    >
    >


    You need an XML parser. These are divided into 2 categories.

    DOM (Document Object Model) parsers read the entire document into
    memory and return a handle to the root of the document. You use
    class methods to navigate the document and get at the data.

    SAX (Simple API for XML) 'streams' through the document and invokes
    callbacks (that you register ahead of time) based on what the parser
    is seeing at the moment. (Start tag, end tag, data, etc.).

    DOM parsers are better for small-to-medium sized documents, SAX
    parsers are better for large documents.

    Some parsers from both categories will validate the document, that
    is compare the document to its DTD. This may or may not be important
    to you.

    Check out Sun's and IBM's web sites. I believe there are free
    XML parsers available there. Sorry I can't quote the exact URLs.

    Hope this helps,
    Dom

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center