XmlNode.LocalName Property

Definition

Gets the local name of the node, when overridden in a derived class.

C#
public abstract string LocalName { get; }

Property Value

The name of the node with the prefix removed. For example, LocalName is book for the element <bk:book>.

The name returned is dependent on the NodeType of the node:

Type Name
Attribute The local name of the attribute.
CDATA #cdata-section
Comment #comment
Document #document
DocumentFragment #document-fragment
DocumentType The document type name.
Element The local name of the element.
Entity The name of the entity.
EntityReference The name of the entity referenced.
Notation The notation name.
ProcessingInstruction The target of the processing instruction.
Text #text
Whitespace #whitespace
SignificantWhitespace #significant-whitespace
XmlDeclaration #xml-declaration

Remarks

If the node does not have a prefix, LocalName is the same as Name.

Applies to

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

See also