Compartilhar via


XMLSchemaReferences Collection

Word Developer Reference

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

Remarks

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.

Visual Basic for Applications
  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
Bb179177.vs_note(en-us,office.12).gif  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.

See Also