Export (0) Print
Expand All
Expand Minimize

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)

public XMLSchemaReferences XMLSchemaReferences { get; }

Property Value

Type: XMLSchemaReferences
An XMLSchemaReferences collection that represents the schemas attached to the document.

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

Show:
© 2015 Microsoft