Creates and returns a SAX proxy object that can be used by the setReferenceData
method to assign a SAX stream as the new data source of the signature object or template.
var SAXProxy = objIXMLDigitalSignature.createSAXProxy();
Set SAXProxy = objIXMLDigitalSignature.createSAXProxy();
IUnknownPtr SAXProxy = objIXMLDigitalSignature.createSAXProxy();
HRESULT createSAXProxy(IUnknown ** SAXProxy)
SAXProxy
parameter returns NULL.To assign a SAX stream as the new data source of a signature object, you must first use this method to create a SAX proxy object. Then, connect this object to a SAX reader from which the stream originates.
The SAX proxy object supports the ISAXContentHandler
, ISAXLexicalHandler
, ISAXErrorHandler
, IVBSAXContentHandler
, IVBSAXLexicalHandler
, IVBSAXErrorHandler
interfaces and parses the data stream into XML documents or nodes. It serves as a content handler, error handler, and lexical handler between the SAX reader and the signature object.
The following is a general workflow for signing or verifying XML data from a SAX stream:
setReferenceData
method to set this proxy object as the new data source of a signature object.parse
method or the parseURL
method on the SAX reader to start feeding data into the signature object through the SAX proxy.Do not reuse the SAX proxy object in a single signing and/or verification. To work with multiple SAX sources, create a proxy object for each source. Any errors, including warnings, will interrupt the SAX stream and prevent the data from being signed or verified.
A SAX proxy object can be used to improve the performance of an application when it is used to sign and/or verify data from a remote location multiple times. In this case, you can first download the data to a local store, then access the local copy of the data with the help of a SAX proxy object. This saves repeated round trips for data retrieval across the network.
This example illustrates how to use the createSAXProxy
method and the setReferenceData
method to use an XML data file in the local file system as the new data source of a signature template. It uses two resource files: a signature template (signature_template.rsa.xml) and a data file to be signed (test.xml). The signature template contains simple text data ("Hello, World!") embedded as the content of a <ds:Object>
element. This simple text data is signed as usual. In contrast, test.xml is signed with the help of a SAX proxy object.
We've provided source files for the sample in three languages: JScript, Visual Basic, and C++. The output is the same in each language.
IXMLDigitalSignature | IXMLDigitalSignatureEx
MSXML 5.0 and later
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button in the upper-left corner of the page.
setReferenceData Method | ISAXXMLReader Interface