XMLNamespace Object

Microsoft Word Visual Basic

XMLNamespace Object

XMLNamespaces XMLNamespace
Multiple objects

Represents an individual schema within the Schema Library. You can access the Schema Library from within Microsoft Word from the XML Schema tab in the Templates and Add-ins dialog box. The Schema Library represents schemas installed on a user's machine that a user has applied to a Word document or that a user has explicitly added to the Schema Library by using the Schema Library dialog box.

Using the XMLNamespace Object

Use the Item method of the XMLNamespaces collection to return an individual XMLNameSpace object. The index value of the Item method can be either a Long, which indicates the position of the schema in the Schema Library, or a String, which represents the name of the schema as returned using the URI property (the TargetNamespace setting defined in the schema).

The following example attaches a schema named SimpleSample to the active document.

    Sub ApplySampleSchema()
    Dim objSchema As XMLNamespace
    
    For Each objSchema In Application.XMLNamespaces
        If objSchema.URI = "SimpleSample" Then
            objSchema.AttachToDocument ActiveDocument
            Exit For
        End If
    Next
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.