ddn.data.xml.dom.element

DOM element node.

Types 1

A DOM element.

Fields
XmlQName nameElement name (QName).
private XmlAttribute[] _attributes
private XmlNamespaceContext _namespaces
Methods
XmlNode cloneShallow() @safeCreates a shallow clone of this element (no children).
XmlElement create(string qname) @safeStatic factory method for creating elements.
string lexicalName() @property const @safeReturns the lexical name (`prefix:local` or `local`).
string tagName() @property const @safeReturns the tag name (W3C DOM Level 1).
bool hasAttributes() @property const @safe
XmlElement[] getElementsByTagName(string tagname) @safeReturns all descendant elements with the given tag name.
string toString() const @safe
string toDebugString() const @safeReturns a detailed string representation for debugging.
bool opEquals(Object o) const @safe
bool isEquivalent(const XmlNode other) const @safe
int opApply(scope int delegate(size_t, XmlElement) @safe dg) @safeAllows iterating over child elements using `foreach`.
int opApply(scope int delegate(XmlElement) @safe dg) @safeditto
XmlNamespace[] namespaceDeclarations() const @safeReturns namespace declarations that were declared directly on this element.
XmlElement addChildElement(string qname) @safeCreates and appends a child element.
XmlElement addText(string value) @safeAppends a text node.
XmlElement setText(string value) @safeReplaces all children with a single text node.
XmlElement withAttribute(string qname, string value) @safeFluent attribute setter.
XmlElement withText(string value) @safeFluent text setter.
XmlNamespaceContext namespaceContext() @safeReturns the namespace context for this element.
void declareNamespace(string prefix, string uri) @safeDeclares (or re-declares) a namespace prefix on this element.
string lookupNamespaceUri(string prefix) const @safe nothrowLooks up a namespace URI for `prefix` in this element's scope.
inout(XmlAttribute)[] attributes() @property inout @safeReturns the element's attributes in insertion order.
@property auto byAttribute() const @safeReturns a range for iterating over the element's attributes.
void addAttribute(string qname, string value, XmlLocation location = XmlLocation.init) @safeAdds an attribute.
void setAttribute(string qname, string value, XmlLocation location = XmlLocation.init) @safeSets an attribute value, adding the attribute if it does not exist.
inout(XmlAttribute) getAttributeNode(string qname) inout @safeLooks up an attribute node by QName.
inout(XmlAttribute) getAttributeNodeNS(string namespaceUri, string localName) inout @safeLooks up an attribute node by namespace URI and local name.
XmlAttribute setAttributeNode(XmlAttribute newAttr) @safeAdds or replaces an attribute node.
XmlAttribute removeAttributeNode(XmlAttribute oldAttr) @safeRemoves an attribute node.
void removeAttribute(string qname) @safeRemoves an attribute by name.
void removeAttributeNS(string namespaceUri, string localName) @safeRemoves an attribute by namespace URI and local name.
string getAttribute(string qname) const @safeLooks up an attribute by QName.
Nullable!string tryGetAttribute(string qname) const @safeTries to get an attribute value.
string opIndex(string attrName) const @safeAllows reading an attribute value using index syntax.
void opIndexAssign(string value, string attrName) @safeAllows setting an attribute value using index syntax.
bool hasAttribute(string qname) const @safeChecks if an attribute with the given QName exists.
bool opBinaryRight(string op : "in")(string attrName) const @safeAllows checking if an attribute exists using the `in` operator.
string getAttributeNS(string namespaceUri, string local) const @safe nothrowLooks up an attribute by expanded name.
bool hasAttributeNS(string namespaceUri, string local) const @safe nothrowReturns `true` if the element has an attribute with the given expanded name.
Constructors
this(XmlQName name, XmlLocation location = XmlLocation.init)Constructs an element from a validated `XmlQName`.
this(string qname, XmlLocation location = XmlLocation.init)Constructs an element by parsing and validating a QName.