다음을 통해 공유


XPathNavigator.CanEdit 속성

정의

XPathNavigator에서 기본 XML 데이터를 편집할 수 있는지를 나타내는 값을 가져옵니다.

public:
 virtual property bool CanEdit { bool get(); };
public virtual bool CanEdit { get; }
member this.CanEdit : bool
Public Overridable ReadOnly Property CanEdit As Boolean

속성 값

Boolean

trueXPathNavigator 기본 XML 데이터를 편집할 수 있으면 이고, false그렇지 않으면 .입니다.

예제

다음 예제에서는 CanEdit 속성 및 XmlDocument 클래스의 XPathDocument 값을 표시 CanEdit 합니다.

XPathDocument^ readOnlyDocument = gcnew XPathDocument("books.xml");
XPathNavigator^ readOnlyNavigator = readOnlyDocument->CreateNavigator();

XmlDocument^ editableDocument = gcnew XmlDocument();
editableDocument->Load("books.xml");
XPathNavigator^ editableNavigator = editableDocument->CreateNavigator();

Console::WriteLine("XPathNavigator.CanEdit from XPathDocument: {0}", readOnlyNavigator->CanEdit);
Console::WriteLine("XPathNavigator.CanEdit from XmlDocument: {0}", editableNavigator->CanEdit);
XPathDocument readOnlyDocument = new XPathDocument("books.xml");
XPathNavigator readOnlyNavigator = readOnlyDocument.CreateNavigator();

XmlDocument editableDocument = new XmlDocument();
editableDocument.Load("books.xml");
XPathNavigator editableNavigator = editableDocument.CreateNavigator();

Console.WriteLine("XPathNavigator.CanEdit from XPathDocument: {0}", readOnlyNavigator.CanEdit);
Console.WriteLine("XPathNavigator.CanEdit from XmlDocument: {0}", editableNavigator.CanEdit);
Dim readOnlyDocument As XPathDocument = New XPathDocument("books.xml")
Dim readOnlyNavigator As XPathNavigator = readOnlyDocument.CreateNavigator()

Dim editableDocument As XmlDocument = New XmlDocument()
editableDocument.Load("books.xml")
Dim editableNavigator As XPathNavigator = editableDocument.CreateNavigator()

Console.WriteLine("XPathNavigator.CanEdit from XPathDocument: {0}", readOnlyNavigator.CanEdit)
Console.WriteLine("XPathNavigator.CanEdit from XmlDocument: {0}", editableNavigator.CanEdit)

이 예제에서는 books.xml 파일을 입력으로 사용합니다.

<?xml version="1.0" encoding="utf-8" ?>   
<bookstore>  
    <book genre="autobiography" publicationdate="1981-03-22" ISBN="1-861003-11-0">  
        <title>The Autobiography of Benjamin Franklin</title>  
        <author>  
            <first-name>Benjamin</first-name>  
            <last-name>Franklin</last-name>  
        </author>  
        <price>8.99</price>  
    </book>  
    <book genre="novel" publicationdate="1967-11-17" ISBN="0-201-63361-2">  
        <title>The Confidence Man</title>  
        <author>  
            <first-name>Herman</first-name>  
            <last-name>Melville</last-name>  
        </author>  
        <price>11.99</price>  
    </book>  
    <book genre="philosophy" publicationdate="1991-02-15" ISBN="1-861001-57-6">  
        <title>The Gorgias</title>  
        <author>  
            <name>Plato</name>  
        </author>  
        <price>9.99</price>  
    </book>  
</bookstore>  

설명

속성 CanEdit 에는 .NET에서 인터페이스의 세 가지 구현에 따라 다른 값이 IXPathNavigable 있습니다. CanEdit 각 구현에서 만든 개체의 XPathNavigator 값은 다음 표에 나와 있습니다.

IXPathNavigable 구현 CanEdit
XPathDocument false
XmlDocument true

적용 대상