DocumentBase.XMLSchemaReferences Property

Gets an XMLSchemaReferences collection that represents the schemas attached to the document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public ReadOnly Property XMLSchemaReferences As XMLSchemaReferences
    Get
public XMLSchemaReferences XMLSchemaReferences { get; }

Property Value

Type: Microsoft.Office.Interop.Word.XMLSchemaReferences
An XMLSchemaReferences collection that represents the schemas attached to the document.

Examples

The following code example displays the URI of each of the XML schemas referenced in the document. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentXMLSchemaReferences()
    Dim stringBuilder1 As New System.Text.StringBuilder()

    ' Add all of the schema URIs to the StringBuilder.
    Dim schema As Word.XMLSchemaReference
    For Each schema In Me.XMLSchemaReferences
        stringBuilder1.Append(schema.NamespaceURI & ", ")
    Next schema

    ' End the StringBuilder with a period.
    stringBuilder1.Remove(stringBuilder1.Length - 2, 2)
    stringBuilder1.Append(".")

    MessageBox.Show("The document contains " & Me.XMLSchemaReferences.Count.ToString() _
        & " schema(s): " & stringBuilder1.ToString())
End Sub 
private void DocumentXMLSchemaReferences()
{
    System.Text.StringBuilder stringBuilder1 =
        new System.Text.StringBuilder();

    // Add all of the schema URIs to the StringBuilder.
    foreach (Word.XMLSchemaReference schema in
        this.XMLSchemaReferences)
    {
        stringBuilder1.Append(schema.NamespaceURI + ", ");
    }

    // End the StringBuilder with a period.
    stringBuilder1.Remove(stringBuilder1.Length - 2, 2);
    stringBuilder1.Append(".");

    MessageBox.Show("The document contains " +
        this.XMLSchemaReferences.Count.ToString() +
        " schema(s): " + stringBuilder1.ToString());
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace