Class XMLSchemaReference (Word VBA)

The class XMLSchemaReference represents an individual schema that is attached to a document. To use a XMLSchemaReference class variable it first needs to be instantiated, for example


Dim xml as XMLSchemaReference
Set xml = ActiveDocument.XMLSchemaReferences(Index:=1)

For Each

Here is an example of processing the XMLSchemaReference items in a collection.


Dim xml As XMLSchemaReference
For Each xml In ActiveDocument.XMLSchemaReferences
	
Next xml

Delete

Deletes the specified XML Schema Reference.


ActiveDocument.XMLSchemaReferences(1).Delete

Location

Returns a String that represents the physical location of an XML schema.


Dim strLocation As String
strLocation = ActiveDocument.XMLSchemaReferences(1).Location

NamespaceURI

Returns a String that represents the Uniform Resource Identifier (URI) of the schema namespace for the specified object.

If you are authoring XML schemas for use with Microsoft Word, it is highly recommended that you specify the targetNamespace setting in the schema.


If ActiveDocument.XMLSchemaReferences.Item(1) _ 
 .NamespaceURI <> "SimpleSample" Then 
 
 Application.XMLNamespaces.Item("SimpleSample") _ 
 .AttachToDocument (ActiveDocument) 
 
End If

Reload

Reloads the XML schemas that are referenced in a document.


ActiveDocument.XMLSchemaReferences(1).Reload