XMLSchemaReferences Collection

Microsoft Word Visual Basic

XMLSchemaReferences Collection

Document XMLSchemaReferences
XMLSchemaReference

A collection of XMLSchemaReference objects that represent the unique namespaces that are attached to a document.

Using the XMLSchemaReferences Collection

Use the XMLSchemaReferences property to return a collection of schemas attached to a document. The following example loops through the schemas attached to a document. If it finds the specified schema, it reloads it; if it doesn't find the specified schema, it attaches the schema to the document.

    Sub VerifySampleSchema()
    Dim objNS As XMLNamespace
    Dim objSchema As XMLSchemaReference
    Dim blnSchemaAttached As Boolean
    
    For Each objSchema In ActiveDocument.XMLSchemaReferences
        If objSchema.NamespaceURI <> "SimpleSample" Then
            blnSchemaAttached = False
        Else
            objSchema.Reload
            blnSchemaAttached = True
            Exit For
        End If
    Next
    
    If blnSchemaAttached = False Then
        Set objNS = Application.XMLNamespaces.Item("SimpleSample")
        objNS.AttachToDocument (ActiveDocument)
    End If
End Sub
  

Note  The SimpleSample schema is included in the Smart Document Software Development Kit (SDK). For more information, refer to the Smart Document SDK on the Microsoft Developer Network (MSDN) Web site.