Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - SOM Developer's Guide

Uncommented Code for the Write Annotations Application

Set oSchemaCache   = CreateObject("Msxml2.XMLSchemaCache.5.0")
Set oAnnotationDoc = CreateObject("Msxml2.DOMDocument.5.0")
Set writer         = CreateObject("Msxml2.MXXMLWriter.5.0")
writer.output=""

nsTarget="http://www.example.microsoft.com/po"
oSchemaCache.add nsTarget, "po3.xsd"
Set oSchema = oSchemaCache.getSchema(nsTarget)

oSchema.writeAnnotation(oAnnotationDoc)
WScript.Echo oAnnotationDoc.documentElement.xml

Set oAnnotationDoc.documentElement = oAnnotationDoc.createElement("root")
oSchema.writeAnnotation(oAnnotationDoc.documentElement)
WScript.Echo oAnnotationDoc.documentElement.xml

oSchema.writeAnnotation(writer)
WScript.Echo writer.output

Set ua = oSchema.types.itemByName("USAddress")
Set oAnnotationDoc.documentElement = oAnnotationDoc.createElement("root")
ua.writeAnnotation(oAnnotationDoc)
WScript.Echo oAnnotationDoc.documentElement.xml

ua.writeAnnotation(oAnnotationDoc.documentElement)
WScript.Echo oAnnotationDoc.documentElement.xml