Share via


DocumentBase.XMLNodes 속성

문서 내의 모든 XML 요소의 컬렉션을 나타내는 Microsoft.Office.Interop.Word.XMLNodes 컬렉션을 가져옵니다.

네임스페이스:  Microsoft.Office.Tools.Word
어셈블리:  Microsoft.Office.Tools.Word.v4.0.Utilities(Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

구문

‘선언
Public ReadOnly Property XMLNodes As XMLNodes
    Get
public XMLNodes XMLNodes { get; }

속성 값

형식: Microsoft.Office.Interop.Word.XMLNodes
문서 내의 모든 XML 요소의 컬렉션을 나타내는 Microsoft.Office.Interop.Word.XMLNodes 컬렉션

예제

다음 코드 예제에서는 문서에 있는 각 Microsoft.Office.Interop.Word.XMLNodes 개체의 이름을 표시합니다. 이 예제를 사용하려면 문서 수준 프로젝트 ThisDocument 클래스에서 실행하십시오.

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

    ' Add all of the node names to the StringBuilder.
    Dim node As Word.XMLNode
    For Each node In Me.XMLNodes
        stringBuilder1.Append(node.BaseName & ", ")
    Next node

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

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

    // Add all of the node names to the StringBuilder.
    foreach (Word.XMLNode node in this.XMLNodes)
    {
        stringBuilder1.Append(node.BaseName + ", ");
    }

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

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

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

DocumentBase 클래스

Microsoft.Office.Tools.Word 네임스페이스