XMLSchemaReferences Object (Word)

Published: July 16, 2012

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

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 
 blnSchemaAttached = True 
 Exit For 
 End If 
 If blnSchemaAttached = False Then 
 Set objNS = Application.XMLNamespaces.Item("SimpleSample") 
 objNS.AttachToDocument (ActiveDocument) 
 End If 
End Sub

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.

Community Additions

© 2014 Microsoft