Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help With SAX in ASP

Status
Not open for further replies.

softwareguy2

Technical User
Apr 2, 2002
11
US
Trying to parse an XML document using ASP, and I would like to try to use SAX. Don't know much about SAX, and all resources I have seen so far have been for VB or C++, was wondering if anyone could point me in the right direction for some resources or some examples.
thanks in advance.
 
I'm not sure that you can use SAX in ASP, but you might want to give it a try.

You call it like this:
Code:
Implements IVBSAXContentHandler
Implements IVBSAXErrorHandler
Implements IVBSAXLexicalHandler

::

Set objSAX = New MSXML2.SAXXMLReader40
Set objSAX.contentHandler = Me   'They work together
Set objSAX.ErrorHandler = Me     'They also work together
Call objSAX.putProperty("[URL unfurl="true"]http://xml.org/sax/properties/lexical-handler",[/URL] Me)
Call objSAX.parseURL("file:///C:\Somefile.xml")

SAX works by raising events as it sees various parts of an XML document. You'll get a StartDocument event, followed by one or more StartElement events, which have a matching EndElement event. Eventually you will get a EndDocument event, and SAX will then return to the statement after your .parseURL call.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top