DocumentBase.XMLSchemaReferences Property

Definition

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

public:
 property Microsoft::Office::Interop::Word::XMLSchemaReferences ^ XMLSchemaReferences { Microsoft::Office::Interop::Word::XMLSchemaReferences ^ get(); };
public Microsoft.Office.Interop.Word.XMLSchemaReferences XMLSchemaReferences { get; }
member this.XMLSchemaReferences : Microsoft.Office.Interop.Word.XMLSchemaReferences
Public ReadOnly Property XMLSchemaReferences As XMLSchemaReferences

Property Value

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 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());
}
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 

Applies to