ddn.data.xml.dom.node
DOM node types and core parent/child ownership rules.
enum XmlNodeType
Types 12
enumXmlNodeType
Kind of an XmlNode.
DOCUMENTThe node is an XML document.
ELEMENTThe node is an element.
TEXTThe node is a text node.
ENTITY_REFERENCEThe node is an entity reference (e.g. `&name;`).
COMMENTThe node is a comment.
PROCESSING_INSTRUCTIONThe node is a processing instruction.
CDATAThe node is a CDATA section.
DOCUMENT_TYPEThe node is a document type declaration.
ENTITY_DECLARATIONThe node is an entity declaration.
NOTATION_DECLARATIONThe node is a notation declaration.
DOCUMENT_FRAGMENTThe node is a document fragment.
ATTRIBUTEThe node is an attribute.
classXmlNode
Base class for DOM nodes.
Ownership model: Each node has at most one parent. Parent nodes own their children.
Fields
private XmlNode _parentXmlLocation locationLocation of this node in the source XML, if known.string baseUriBase URI for this node.XmlNodeType _nodeTypeMethods
string textContent() @property const @safeReturns the text content of this node and its descendants.string lexicalName() @property const @safeReturns the lexical name (e.g. "prefix:local") if applicable, or empty string.inout(XmlAttribute)[] attributes() @property inout @safeReturns the attributes of this node, or `null` if it is not an element.inout(XmlNode)[] children() @property inout @safe nothrowReturns a list of all children of this node.Constructors
this(XmlNodeType nodeType, XmlLocation location = XmlLocation.init)classXmlParentNode : XmlNode
Base class for nodes that can have children.
Fields
private XmlNode[] _childrenMethods
XmlNode cloneShallow() @safeinout(XmlNode)[] children() @property inout @safe nothrowReturns a list of all children of this node.inout(XmlNode)[] opSlice(size_t start, size_t end) inout @safeAllows slicing child nodes using `node[i .. j]` syntax.void normalize(bool recurse = true) @safeNormalizes this subtree by merging adjacent `XmlText` nodes.Constructors
this(XmlNodeType nodeType, XmlLocation location = XmlLocation.init)classXmlDocumentFragment : XmlParentNode
A DOM document fragment node.
Constructors
this(XmlLocation location = XmlLocation.init)A DOM text node.
Fields
string textText content.Methods
XmlNode cloneShallow() @safeConstructors
this(string text, XmlLocation location = XmlLocation.init)classXmlEntityReference : XmlNode
A DOM entity reference node.
This node represents an unresolved general entity reference in element content (e.g. &foo;). It is typically produced when parsing with entity expansion disabled.
Fields
string nameEntity name (without surrounding `&`/`;`).Constructors
this(string name, XmlLocation location = XmlLocation.init)classXmlComment : XmlNode
A DOM comment node.
Fields
string textComment content (without `<!--` / `-->`).Methods
XmlNode cloneShallow() @safeConstructors
this(string text, XmlLocation location = XmlLocation.init)classXmlProcessingInstruction : XmlNode
A DOM processing-instruction node.
Fields
string targetTarget name.string dataData content.Methods
XmlNode cloneShallow() @safeConstructors
this(string target, string data, XmlLocation location = XmlLocation.init)A DOM CDATA section node.
Fields
string textCDATA content.Methods
XmlNode cloneShallow() @safeConstructors
this(string text, XmlLocation location = XmlLocation.init)classXmlDocumentType : XmlParentNode
A DOM document type declaration node.
Fields
string nameRoot element name (as declared in the doctype).string publicIdPublic identifier.string systemIdSystem identifier.string internalSubsetInternal subset text (optional).Constructors
this(string name, XmlLocation location = XmlLocation.init)classXmlEntityDeclNode : XmlNode
A DOM entity declaration node.
Fields
string nameEntity name.string publicIdPublic identifier (for external entities).string systemIdSystem identifier (for external entities).string notationNameNotation name (for unparsed external entities).string valueReplacement text (for internal entities).bool isParameterWhether this is a parameter entity.Constructors
this(string name, XmlLocation location = XmlLocation.init)classXmlNotationDeclNode : XmlNode
A DOM notation declaration node.
Fields
string nameNotation name.string publicIdPublic identifier.string systemIdSystem identifier.Constructors
this(string name, XmlLocation location = XmlLocation.init)