XmlEntityReference.IsReadOnly Tulajdonság
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Beolvas egy értéket, amely jelzi, hogy a csomópont írásvédett-e.
public:
virtual property bool IsReadOnly { bool get(); };
public override bool IsReadOnly { get; }
member this.IsReadOnly : bool
Public Overrides ReadOnly Property IsReadOnly As Boolean
Tulajdonság értéke
true ha a csomópont írásvédett; egyéb esetben false.
Mivel XmlEntityReference a csomópontok írásvédettek, ez a tulajdonság mindig ad vissza true.
Példák
Az alábbi példa bemutatja, hogyan használhatja a tulajdonságot IsReadOnly .
using System;
using System.IO;
using System.Xml;
public class Sample
{
public static void Main()
{
//Create the XmlDocument.
XmlDocument doc = new XmlDocument();
doc.LoadXml("<!DOCTYPE book [<!ENTITY h 'hardcover'>]>" +
"<book genre='novel' ISBN='1-861001-57-5'>" +
"<title>Pride And Prejudice</title>" +
"<style>&h;</style>" +
"</book>");
// Determine whether the node is read-only.
XmlEntityReference entref = (XmlEntityReference) doc.DocumentElement.LastChild.FirstChild;
if (entref.IsReadOnly)
Console.WriteLine("Entity reference nodes are always read-only");
}
}
Option Explicit
Option Strict
Imports System.IO
Imports System.Xml
Public Class Sample
Public Shared Sub Main()
'Create the XmlDocument.
Dim doc As New XmlDocument()
doc.LoadXml("<!DOCTYPE book [<!ENTITY h 'hardcover'>]>" & _
"<book genre='novel' ISBN='1-861001-57-5'>" & _
"<title>Pride And Prejudice</title>" & _
"<style>&h;</style>" & _
"</book>")
' Determine whether the node is read-only.
Dim entref As XmlEntityReference = CType(doc.DocumentElement.LastChild.FirstChild, XmlEntityReference)
If entref.IsReadOnly Then
Console.WriteLine("Entity reference nodes are always read-only")
End If
End Sub
End Class
Megjegyzések
A csak olvasható csomópontok tulajdonságai, attribútumai vagy gyermekei nem módosíthatók. Azonban eltávolíthat egy írásvédett csomópontot a fáról, és máshová is beszúrhatja.
Ez a tulajdonság a Dokumentumobjektum-modell (DOM) Microsoft bővítménye.