Creates an empty XElement with the given name.
ReadonlynameThe qualified name of this element.
The kind of XML node this object represents.
The parent of this object in the XML tree, or null if it is a root.
Gets the first attribute of this element, or null if there are none.
Gets the first child node, or null if the container is empty.
Returns true if this element has at least one attribute.
Returns true if this element contains at least one child element.
Returns true if this element has no child nodes.
Gets the last attribute of this element, or null if there are none.
Gets the last child node, or null if the container is empty.
Gets the next sibling node, or null if this is the last node.
Gets the previous sibling node, or null if this is the first node.
Gets the concatenated text content of this element and all its descendants.
The setter replaces all child nodes with a single XText node.
Appends content as children of this container.
Nodes, strings, or arrays to add.
Content rules:
Inserts the specified content immediately after this node in its parent.
One or more nodes or strings to insert.
Inserts content as the first children of this container.
Nodes, strings, or arrays to prepend.
Returns this element followed by all its ancestor elements.
An array starting with this element and continuing to the root.
Returns the attribute with the specified name, or null.
The attribute name to look up.
The matching XAttribute, or null.
Returns the attributes of this element filtered by name.
Name to filter by.
Performs a deep structural comparison of this node with another.
The node to compare against.
true if the two nodes are structurally identical.
Returns this element followed by all its descendant nodes in document order.
An array starting with this element and including all descendant nodes.
Returns this element followed by all its descendant elements in document order.
An array starting with this element (if it matches) and including all matching descendant elements.
Compares this element with another for structural equality, including name, attributes, and all child nodes.
The element to compare against.
true if the elements are structurally identical.
Inserts content immediately after an existing child node.
The reference child node.
Content to insert after the child.
Inserts content immediately before an existing child node.
The reference child node.
Content to insert before the child.
Removes all attributes and child nodes from this element.
Removes annotations from this object.
Removes a specific attribute from this element.
The attribute instance to remove.
Removes all attributes from this element.
Removes a specific child node from this container.
The child node to remove.
Removes all child nodes from this container.
Replaces all attributes and child nodes with the specified content.
New content (nodes, attributes, strings, or arrays).
Replaces all attributes on this element with the specified content.
New attributes (or arrays of attributes) to set.
Replaces an existing child node with the specified content.
The child node to replace.
Content that replaces the child.
Replaces all child nodes with the specified content.
New content to use as children.
Sets, updates, or removes an attribute by name.
The attribute name.
The new value, or null to remove.
Sets, updates, or removes a child element by name.
The child element name.
The new text value, or null to remove.
Serialises this element and its subtree to an XML string.
The XML string representation.
StaticdeepStatic convenience method for deep structural comparison of two nodes.
true if the two nodes are structurally identical.
StaticloadStaticloadStaticparse
Represents an XML element -- the primary class in LtXmlTs.
Remarks
An
XElementhas a name, zero or more attributes, and zero or more child nodes. It supports functional construction (passing children and attributes to the constructor), parsing from strings or files, and serialisation to XML strings.Example