DocumentBase.XMLSchemaReferences 属性

获取一个 XMLSchemaReferences 集合,该集合表示附加到文档的架构。

命名空间:  Microsoft.Office.Tools.Word
程序集:  Microsoft.Office.Tools.Word.v4.0.Utilities(在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)

语法

声明
Public ReadOnly Property XMLSchemaReferences As XMLSchemaReferences
public XMLSchemaReferences XMLSchemaReferences { get; }

属性值

类型:Microsoft.Office.Interop.Word.XMLSchemaReferences
一个 XMLSchemaReferences 集合,表示附加到文档的架构。

示例

下面的代码示例显示在文档中引用的每个 XML 架构的 URI。 若要使用此示例,请从文档级项目内的 ThisDocument 类中运行此示例。

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 安全性

请参见

参考

DocumentBase 类

Microsoft.Office.Tools.Word 命名空间