Parsing an XML document using SAX API


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Parsing an XML document using SAX API

  1. #1
    Join Date
    Sep 2007
    Posts
    5

    Smile Parsing an XML document using SAX API

    Hi everyone,
    This is just an open discussion on parsing an XML document using SAX API. I am not quite sure whether these are the right steps for parsing the XML document, but if u feel something is missing please give me you comments & views regarding this discussion.

    first the packages to parse an XML document should be imported, such as:-
    java.io.*
    org.xml.sax.*
    org.xml.sax.helpers.defaultHandler
    javax.xml.parsers.SAXParserFactory
    javax.xml.parsers.SAXParser
    javax.xml.parsers.ParserConfigurationException


    Next step is to extend the DefaultHandler interface because the DefaultHandler interface, by default, implements the ContentHandler, ErrorHandler, DTDHandler, & EntityHandler interfaces that the SAX parser uses.

    The third step is to parse the XML document, for this you first need to create an object of the SAXParserFactory class. The SAXParserFactory class allows u to change different parser implementations. u then need to obtain an object of the SAXParser class, which represents the default parser. u can the parse the XML document using the parse() method. It accepts two arguments, first is the XML document to be parsed & second is the DefaultHandler object that receives notification of the parsing events.

    The final step is to override various call back methods to handle events, such as document events, element events, & character events in your application.

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Do you have a question or are you simply looking for comments?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Sep 2007
    Posts
    5

    Smile Just an open discussion

    Hi Hack,
    You are free to post any comments or views regarding this topic or if you want to say anything regarding this discussion you are free to do so. Thank You.

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Nothing specific, but here is an article that I think folks interested in this topic might enjoy.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. Error parsing XML document
    By pescado in forum XML
    Replies: 0
    Last Post: 03-27-2006, 03:15 PM
  2. Replies: 2
    Last Post: 06-27-2002, 11:08 AM
  3. XML Startkabel Updates
    By xmlstartkabel in forum XML
    Replies: 0
    Last Post: 10-10-2001, 05:07 AM
  4. Replies: 1
    Last Post: 04-27-2001, 12:07 PM
  5. Check out Turbo XML
    By Sales in forum xml.announcements
    Replies: 0
    Last Post: 07-20-2000, 07:18 PM

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