Initializes a new XElement
instance with the specified name.
The name of the element.
Rest
...contentArray: any[]Zero or more content items.
Initializes a new instance of the XElement
class from another XElement
object.
Another element that will be copied to this element.
Static
Readonly
emptyGets an empty collection of elements.
Gets the XDocument
object for this XObject
.
Gets the first attribute of this element.
Gets this container's first XNode
or null
, if this container does not
have any nodes.
Gets a value indicating whether the element has at least one attribute.
Gets a value indicating whether the element has at least one child element.
Gets a value indicating whether the element contains no content.
Gets the last attribute of this element.
Gets this container's last XNode
or null
, if this container does not
have any nodes.
Gets the next sibling node of this node.
If this node does not have a parent, or if there is no next node, then this property returns null.
Gets the parent XElement
of this XObject
.
Gets the previous sibling node of this node.
If this property does not have a parent, or if there is no previous node, then this property returns null.
Gets the text contents of this element.
If there is text content interspersed with nodes (mixed content) then the text content will be concatenated and returned.
Sets the text content of this element.
Adds the specified content as a child (or children) of this XContainer
.
A content object containing simple content or a collection of content objects to be added.
Returns the collection of the ancestor elements for this node.
The ancestor elements of this node.
Optional
name: null | XNameThe optional name of the ancestor elements to find.
Returns this XElement
and all of it's ancestors up to the root node.
Optionally, an XName
can be passed in to target specific ancestors.
An iterable containing this XElement
and its ancestors (with
a matching XName
if name
was provided).
Optional
name: null | XNameThe optional XName
of the target ancestor.
Returns the XAttribute
associated with this XElement
that has the
given name.
The XAttribute
having the given XName
or null
.
The XName
of the XAttribute
to get.
Gets all attributes associated with this element or the attribute having the given name.
All attributes associated with this element or the attribute having the given name.
Optional
name: null | XNameThe name of the attribute to return.
Gets the descendant XElement
s of this XContainer
.
The descendant XElement
s of this XContainer
.
Optional
name: null | XNameThe optional name of the descendants to return.
Gets this XElement
and the descendant XElement
s of this XElement
.
This XElement
and the descendant XElement
s of this XElement
.
Optional
name: null | XNameThe optional name of the descendants to return.
Gets the child XElement
s of this XContainer
.
The child XElement
s of this XContainer
.
Optional
name: null | XNameThe optional name of the elements to return.
Returns the default XNamespace
of this XElement
.
The default XNamespace
of this XElement
.
Get the namespace associated with a particular prefix for this XElement
in its document context.
The XNamespace
for the namespace bound to the prefix.
If the prefix is falsy, e.g., the empty string.
The namespace prefix to look up.
Get the prefix associated with a namespace for an element in its context.
The namespace prefix string
.
The XNamespace
for which to get the prefix.
Returns the content of this XContainer
.
Note that the content does not include XAttribute
s.
The content of this XContainer
as an IterableOfXNode
.
Removes this XNode
from the underlying XML tree.
Removes all nodes and attributes from this XElement
.
Removes all attributes from this XElement
.
Removes the nodes from this XContainer
.
Note that this method does not remove the attributes.
Replaces the child nodes of this XContainer
with the specified content.
The content can be simple content, a collection of content objects, a param
list of content objects, or null.
Rest
...content: any[]The new content.
Replaces this node with the specified content.
Rest
...content: any[]Content that replaces this node.
Returns a string that represents the current object.
A string that represents the current object.
Static
loadCreates a new XElement
instance from the given DOM Element
.
A new XElement
instance.
The DOM Element
.
Static
parseCreates a new XElement
instance from the given XML string.
A new XElement
instance.
An ArgumentException
if the XML is malformed or does not contain
a root element.
The XML string.
Generated using TypeDoc
Represents an XML element.