Writes a top-level annotation or an annotation for an XML Schema <element>
declaration. The following objects can have annotations written to them: IXMLDOMDocument
, IXMLDOMNode
, IVBSAXContentHandler
, and ISAXContentHandler
. Any one of these four object types can be passed in the annotationSink
parameter.
If the object passed in the annotationSink
parameter is an IXMLDOMDocument
(schema) object, the annotation for the item is written to the top-level <annotations>
for the XML Schema. If a top-level annotation exists, an <annotations>
root element is created, and all <annotation>
declarations are located inside it.
For the other three object types, the <annotation>
node of the object that is passed in is considered the root node. The DOMDocument
will have the annotation node appended to the IXMLDOMnode
.
The po.xsd XML Schema that is referred to in these examples can be found in XML Schema Examples.
The following VBScript example shows how to write a top-level schema annotation into a DOM document.
Set oSchemaCache = CreateObject("Msxml2.XMLSchemaCache.5.0") Set oAnnotationDoc = CreateObject("Msxml2.DOMDocument.5.0") oSchemaCache.add "", "po.xsd" Set oSchema = oSchemaCache.getSchema("") oSchema.writeAnnotation(oAnnotationDoc) WScript.Echo oAnnotationDoc.documentElement.xml
The following VBScript example shows how to write an annotation for a schema item into a DOM document.
Set oSchemaCache = CreateObject("Msxml2.XMLSchemaCache.5.0") Set oAnnotationDoc = CreateObject("Msxml2.DOMDocument.5.0") oSchemaCache.add "", "po.xsd" Set oSchema = oSchemaCache.getSchema("") Set ua = oSchema.types.itemByName("USAddress") ua.writeAnnotation(oAnnotationDoc) WScript.Echo oAnnotationDoc.documentElement.xml
var bolIsWritten = oISchemaItem.annotation(oAnnotationSink);
IXMLDOMDocument
, IXMLDOMNode
, IVBSAXContentHandler
, and ISAXContentHandler
.bolIsWritten = oISchemaItem.annotation(oAnnotationSink);
IXMLDOMDocument
, IXMLDOMNode
, IVBSAXContentHandler
, and ISAXContentHandler
.HRESULT writeAnnotation( IUnknown* annotationSink, VARIANT_BOOL* isWritten );
IXMLDOMDocument
, IXMLDOMNode
, IVBSAXContentHandler
, and ISAXContentHandler
.annotationSink
is not one of the following types: XMLDOMDocument
, IXMLDOMNOde
, IVBSAXContentHandler
, or ISAXContentHandler
.isWritten
parameter is NULL.To view reference information for Visual Basic or C/C++ only, click the Language Filter button in the upper-left corner of the page.
Applies to: ISchemaItem Interface