XmlElement

Description

sealed class Tinman.Core.Xml.XmlElement

Derived from

XmlNodeWithParent abstract

Represents an element in an XML document:

<element attribute="value">...</element>
<element attribute="value"/>

Public / Constructors

For


[Pure]
public static method For → (1)

name in : string

[not-empty]
The element name.

returns → XmlElement

The created XmlElement value.

Creates a new instance of XmlElement.

ValidatingException

If name in is malformed.

From​Source


public static method FromSource → (1)

xml in : string

[not-empty]
The XML element to parse.

returns → XmlElement

The parsed XmlElement.

Parses the given XML element and returns an XmlElement object for it.

ValidatingException

If xml in is malformed.

Xml​Element

2 overloads


public constructor XmlElement1 → (3)

name in : XmlName

See Name.

capacityAttributes opt : int32 = 0

The initial capacity of Attributes.

capacityContent opt : int32 = 0

The initial capacity of Content.

Creates a new instance of XmlElement.


public constructor XmlElement2 → (3)

name in : XmlName

See Name.

attributes in : IBagConst<XmlAttribute>

The attribute list or null for an empty list. See Attributes.

content opt : IBagConst<XmlNode> = null

The content node list or null for an empty list. See Content. All non-content nodes will be ignored (see XmlNode.IsDocumentContent).

Creates a new instance of XmlElement.

Public / Methods

Add

2 overloads


public method Add1 → (1)

node in : XmlAttribute

[not-null]
The attribute to add.

returns → XmlElement

this

Adds an attribute to this element.


public method Add2 → (2)

node in : XmlNode

[not-null]
The content node to add. May be one of the following (will be ignored otherwise): XmlComment, XmlElement, XmlInstruction, XmlText.

count opt : int32 = 1

[>=0]
The number of time to add node in.

returns → XmlElement

this

Adds a content node to this element.

Has​Content


[Pure]
public method HasContent → (1)

mask in : int32

A bitmask of the XML node types to look for:
1 : XmlElement
2 : XmlText
4 : XmlSpace
8 : XmlInstruction
16 : XmlComment

returns → bool

true if there is at least one content node that matches the type mask in,
false if there are no matching nodes.

Checks if Content contains any of the given XML nodes.

Public / Attributes

Attributes


[Constant]
public attribute Attributes → (get)

value : IVectorConst<XmlAttribute>

[not-null]
The attributes.

Returns the attributes of this element.

Content


[Constant]
public attribute Content → (get)

value : IVectorConst<XmlNode>

[not-null]
The content nodes.

Returns the content nodes of this element, see XmlNode.IsElementContent.

Name


[Constant]
public attribute Name → (get)

value : XmlName

The element name.

Returns the element name.