Class XMLSchemaReference (Word VBA)

The class XMLSchemaReference represents an individual schema that is attached to a document.

The main procedures of class XMLSchemaReference are Delete and XMLSchemaReferences.Add


To use a XMLSchemaReference class variable it first needs to be instantiated, for example

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

The following procedures can be used to set variables of type XMLSchemaReference: XMLSchemaReferences.Add, XMLSchemaReferences.Item and Document.XMLSchemaReferences

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


These are the main methods of the XMLSchemaReference class

Delete - Deletes the specified XML Schema Reference.


XMLSchemaReferences.Add - Returns an XMLSchemaReference that represents a schema applied to a document.

Dim xml As XMLSchemaReference
Set xml = ActiveDocument.XMLSchemaReferences.Add()


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.

Dim strNamespaceURI As String
strNamespaceURI = ActiveDocument.XMLSchemaReferences(1).NamespaceURI

Parent returns an object that represents the parent object of the specified XMLSchemaReference object.

Dim objParent As Object
Set objParent = ActiveDocument.XMLSchemaReferences(1).Parent

XMLSchemaReferences.Count returns a Long that represents the number of XML schemas in the collection.

Dim lngCount As Long
lngCount = ActiveDocument.XMLSchemaReferences.Count

XMLSchemaReferences.HideValidationErrors returns a Boolean indicating whether Word displays schema validation errors for the current XML document.

ActiveDocument.XMLSchemaReferences.HideValidationErrors = True

XMLSchemaReferences.IgnoreMixedContent returns a Boolean that represents whether Microsoft Word preforms validation on text nodes that have element siblings and specifies whether these text nodes are saved in XML when the XMLSaveDataOnly property is True.

ActiveDocument.XMLSchemaReferences.IgnoreMixedContent = True

XMLSchemaReferences.Parent returns an object that represents the parent object of the specified XMLSchemaReferences object.

Dim objParent As Object
Set objParent = ActiveDocument.XMLSchemaReferences.Parent

XMLSchemaReferences.ShowPlaceholderText returns or sets a Boolean that represents whether automatic placeholder text is displayed for XML elements in a document.

ActiveDocument.XMLSchemaReferences.ShowPlaceholderText = True