-
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.
-
Do you have a question or are you simply looking for comments?
-
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.
-
Nothing specific, but here is an article that I think folks interested in this topic might enjoy.
Similar Threads
-
Replies: 0
Last Post: 03-27-2006, 03:15 PM
-
By Ed Walker in forum XML
Replies: 2
Last Post: 06-27-2002, 10:08 AM
-
By xmlstartkabel in forum XML
Replies: 0
Last Post: 10-10-2001, 04:07 AM
-
By Charles Giguere in forum XML
Replies: 1
Last Post: 04-27-2001, 11:07 AM
-
By Sales in forum xml.announcements
Replies: 0
Last Post: 07-20-2000, 06: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
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|