다음을 통해 공유


XMLNode.BaseName 속성

접두사 없이 XMLNode 컨트롤의 이름을 가져옵니다.

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

구문

‘선언
ReadOnly Property BaseName As String
    Get
string BaseName { get; }

속성 값

형식: System.String
접두사 없는 XMLNode 컨트롤의 이름입니다.

예제

다음 코드 예제에서는 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 네임스페이스