XmlDocument.IsReadOnly Property

 

Gets a value indicating whether the current node is read-only.

Namespace:   System.Xml
Assembly:  System.Xml (in System.Xml.dll)

Public Overrides ReadOnly Property IsReadOnly As Boolean

Property Value

Type: System.Boolean

true if the current node is read-only; otherwise false. XmlDocument nodes always return false.

A read-only node is one whose properties, attributes, or children cannot be changed. You can remove a read-only node from the tree and insert it somewhere else.

This property is a Microsoft extension to the Document Object Model (DOM).

The following example shows how to use the IsReadOnly property.

Option Explicit
Option Strict

Imports System
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.
        If doc.DocumentElement.LastChild.FirstChild.IsReadOnly Then
            Console.WriteLine("Entity reference nodes are always read-only")
        End If 
    End Sub 'Main
End Class 'Sample

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Return to top
Show: