[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Some clarificatiosn -- RE: [Question] How to do incremental parsing?
- From: Ajay K sanghi <sanghi@giasdl01.vsnl.net.in>
- To: "Xu, Mousheng (SEA)" <Mousheng.Xu@sea.celltechgroup.com>,xml-dev@lists.xml.org
- Date: Mon, 09 Jul 2001 21:03:03 +0530
Mousheng Xu writes:
<snip>
An incremental SAX parser such as the suggested MSXML SAX parser seems to be
the closest idea, but an incremental DOM parser has to be built upon it.
Ajay, do you have a quick reference on MSXML?
Mousheng,
As for quick reference on MSXML,
1. We have never used DOM.
2. We use both MSXML SAX parser and writer.
3. For parsing we use:
a. ISAXXMLReader for Parse()ing.
b. IMXReaderControl for Suspend(), Resume() and Abort()
c. Class derrived from ISAXContentHandler for registering our own
content handler for SAX Events (startDocument(), endDocument(),
startElement(), endElement(), characters() etc)
d. Class derrived from ISAXErrorHandler to catch error situations
e. Initialise ISAXXMLReader with your own ISAXContentHandler and
ISAXErrorHandler interfaces
f. Initiate Parse()ing and catch events
g. Suspend() (probably in one of the ISAXContentHandler events) and
Abort() (probably in one of the ISAXErrorHandler event) in one the
catch'ed events and Resume() when ready for parsing again
4. Writing is even simpler as far as the interfaces are concerned but
placing
end-tags can be a bit tricky depending on nestedness of your structure. I
think if you use DOM, you don't have to worry about writing the
start/end-tags
but I guess you do have to worry about the memory constraints. I am not
sure
if you can create small DOM-lets and "append" to the same file, one
tree-node structure
at a time.
Hope this helps.
Thank you,
Ajay