Skip to main content

Definition

Assembly: CloudNimble.XmlEssentials.dll Namespace: CloudNimble.Text.Xml Inheritance: System.Enum

Syntax

Summary

Specifies the kind of XML node that an XmlElement or a XmlNode represents.

Usage

XmlValueKind says what kind of node an XmlElement or an XmlNode is. Read it from XmlElement.ValueKind or XmlNode.ValueKind before you treat a node as an element or read its value.
The code produces the following output. The first column is the ValueKind, and the second is the matching XmlTokenType.
View the complete sample on GitHub

Considerations

Not every value is reported by both DOMs:
  • In a document, an element has one of three kinds, so a test for elements must accept Element, EmptyElement, and Nil. An element that is nil reports Nil whether it’s written as <e xsi:nil="true"/> or with an end tag; read XmlElement.IsEmptyElement for the form.
  • A document keeps comments and the white space between elements by default, so Comment and Text appear among the children of an indented element unless you parse with XmlCommentHandling.Skip and XmlWhitespaceHandling.Insignificant. XmlNode.Parse keeps both as well.
  • The declaration of a parsed document is XmlDocument.Declaration, not a node with the XmlDeclaration kind.

Values

  • CloudNimble.Text.Xml.XmlElement
  • CloudNimble.Text.Xml.XmlTokenType
  • CloudNimble.Text.Xml.XmlDocument
  • CloudNimble.Text.Xml.Nodes.XmlNode