I found the post by Mark Pryor where he shows an example of how to use
sax with vbscript. Here is the beginning of the example he gives
' main objects
dim oSxRdr, oSxCnt, oSxErr
set oSxRdr = WScript.CreateObject("VBXMLSAX.CVBSAXXMLReader30")
set oSxCnt =
WScript.CreateObject("VBXMLSAX.CVBSAXContentHandler","oSxCnt ")
set oSxErr =
WScript.CreateObject("VBXMLSAX.CVBSAXErrorHandler","oSxErr ")
'call back objects
'VBXMLSAX.CVBErrorInfo
'VBXMLSAX.CVBSAXLocator
dim oErrInfo, oLocator, oAttributes
set oErrInfo = WScript.CreateObject("VBXMLSAX.CVBErrorInfo")
set oLocator = WScript.CreateObject("VBXMLSAX.CVBSAXLocator")
set oAttributes = WScript.CreateObject("VBXMLSAX.CVBSAXAttributes")
I am trying to use sax in my vbscript, but two problems occur:
- The vbscript cannot create the object VBXMLSAX.CVBSAXXMLReader30. I
have to replace it with msxml2.SAXXMLReader
- The ContentHandler cannot be created... it fails at the creation...
Any idea why is that? Is there a special component to install?
Thanks for reading
Samy
Try reading the header of the script from which you snipped the
code below. You will see multiple references.
At that time, the SAX interfaces were released with the so-called
XML Technology Preview #2. The CurVer = 4, see
M. Naughton had written a script compatible VB wrapper. See
www.vbxml.com
The msxml2 objects are from Tech Preview #3 (msxml3.dll)
I have not found a way to use those SAX interfaces from VBScript,
whether wrapped from VB or not.
Mark Pryor
Pgp KeyID: 0x1A966EC5
Samy <at...@free.fr> wrote in message
news:67711555.02022...@posting.google.com...
Well, looks like the error was on my side: i forgot to register the
VBSAXXML.dll :p thanks to the OLE Viewer
This doesn't nullify my problems though: in the sample given, Mark
Pryor uses the WScript.CreateObject which allows the use of a prefix
to connect events to an object (callbacks). My script runs in a *.htm
page, so I don't seem to have this object available. I call the
CreateObject to create my two handlers:
set oSxErr = CreateObject("VBXMLSAX.CVBSAXErrorHandler")
set oSxCnt = CreateObject("VBXMLSAX.CVBSAXContentHandler")
but don't see how I could inform them that they are supposed to react
to the SAX reader events...
Any idea on how I could do that?
Thank you for reading, and please forgive my answers to my own
questions...