DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3

Hybrid View

  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

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links