XmlTextReader.NodeType Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the type of the current node.

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

override NodeType : XmlNodeType with get

Property Value

Type: System.Xml.XmlNodeType

One of the XmlNodeType values representing the type of the current node.

System_CAPS_noteNote

Starting with the .NET Framework 2.0, we recommend that you create XmlReader instances by using the XmlReader.Create method to take advantage of new functionality.

This property never returns the following XmlNodeType types: Document, DocumentFragment, Entity, EndEntity, or Notation.

The following example reads an XML file and displays each of the nodes.

No code example is currently available or this language may not be supported.

The sample uses the file items.xml.


<?xml version="1.0"?>
<!-- This is a sample XML document -->
<!DOCTYPE Items [<!ENTITY number "123">]>
<Items>
  <Item>Test with an entity: &number;</Item>
  <Item>test with a child element <more/> stuff</Item>
  <Item>test with a CDATA section <![CDATA[<456>]]> def</Item>
  <Item>Test with an char entity: &#65;</Item>
  <!-- Fourteen chars in this element.-->
  <Item>1234567890ABCD</Item>
</Items>

.NET Framework
Available since 1.1
Return to top
Show: