Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

About Sax in vbscript

41 views
Skip to first unread message

Samy

unread,
Feb 20, 2002, 6:30:12 AM2/20/02
to
Hello to everyone.

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

Mark_Pryor

unread,
Feb 20, 2002, 8:36:52 AM2/20/02
to
Hi 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

http://msdn.microsoft.com/xml

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...

Samy

unread,
Feb 20, 2002, 9:12:27 AM2/20/02
to
at...@free.fr (Samy) wrote in message news:<67711555.02022...@posting.google.com>...

> 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

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...

0 new messages