다음을 통해 공유


XMLNode.Attributes 속성

XMLNode 컨트롤의 특성을 나타내는 Microsoft.Office.Interop.Word.XMLNodes 컬렉션을 가져옵니다.

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

구문

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

속성 값

형식: Microsoft.Office.Interop.Word.XMLNodes
XMLNode 컨트롤의 특성을 나타내는 Microsoft.Office.Interop.Word.XMLNodes 컬렉션입니다.

설명

Attributes 속성을 사용하여 반환되는 Microsoft.Office.Interop.Word.XMLNodes 컬렉션의 모든 Microsoft.Office.Interop.Word.XMLNode 컨트롤은 XMLNode.NodeType 속성 값이 wdXMLNodeAttribute입니다.

예제

다음 코드 예제에서는 Attributes 속성을 사용하여 특성을 XMLNode 컨트롤에 추가합니다. NamespaceURI 속성은 스키마 네임스페이스를 지정하는 데 사용됩니다. 그런 다음 예제에서는 XMLNode의 모든 특성을 반복하여 특성 이름과 값을 표시합니다. XMLNode의 이름은 BaseName 속성에서 가져옵니다. 이 예제에서는 현재 문서에 CustomerNode라는 XMLNode가 포함되어 있고 이 노드의 NewCustomer 특성이 스키마에 선언되어 있다고 가정합니다.

Private Sub DisplayAttributes()
    Dim newAttribute As Word.XMLNode = _
        Me.CustomerNode.Attributes.Add("NewCustomer", _
        Me.CustomerNode.NamespaceURI)
    newAttribute.NodeValue = "yes"

    Dim attribute1 As Word.XMLNode
    For Each attribute1 In Me.CustomerNode.Attributes
        MsgBox("'" & Me.CustomerNode.BaseName & _
            "' has the attribute '" & attribute1.BaseName & _
            "' with the value '" & attribute1.NodeValue & "'.")
    Next attribute1
End Sub
private void DisplayAttributes()
{
    Word.XMLNode newAttribute = 
        this.CustomerNode.Attributes.Add("NewCustomer",
        this.CustomerNode.NamespaceURI, ref missing);
    newAttribute.NodeValue = "yes";

    foreach (Word.XMLNode attribute1 in this.CustomerNode.Attributes)
    {
        MessageBox.Show("'" + this.CustomerNode.BaseName +
            "' has the attribute '" + attribute1.BaseName +
            "' with the value '" + attribute1.NodeValue +
            "'.");
    }
}

.NET Framework 보안

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

참고 항목

참조

XMLNode 인터페이스

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