ddn.data.xml.dom.document

DOM document node.

Types 5

A DTD notation declaration.

Fields
string nameNotation name.
string systemIdOptional system identifier.
string publicIdOptional public identifier.

A DTD unparsed entity declaration (NDATA).

Fields
string nameEntity name.
string systemIdOptional system identifier.
string publicIdOptional public identifier.
string notationNameNotation name referenced by `NDATA`.

An XML document.

A document owns a list of top-level children, but in well-formed XML it must contain exactly one root element (the document element). For now, we enforce a conservative subset:

  • At most one XmlElement may be a direct child.
Fields
string xmlVersionXML version as declared by `<?xml version='...'?>`.
string xmlEncodingEncoding label as declared by `<?xml encoding='...'?>`.
bool hasEncodingDeclarationWhether an `encoding` pseudo-attribute was explicitly provided in the XML declaration.
bool hasStandaloneWhether a `standalone` flag was explicitly provided in the XML declaration.
bool standaloneStandalone value if `hasStandalone` is `true`.
XmlError[] recoverErrorsRecover-mode parse errors collected during best-effort parsing.
XmlEntityTable entityTableEntity declarations collected from the DTD internal subset.
XmlDtd dtdDTD declarations collected from internal/external subsets.
bool useArenaAllocatorWhether this document uses an internal arena allocator for storing strings.
XmlArena arenaPer-document arena allocator used when `useArenaAllocator` is `true`.
Methods
string nodeName() @property const @safe
XmlDocumentType doctype() @property @safeReturns the document type declaration associated with this document.
XmlDOMImplementation implementation() @property @safeReturns the DOM implementation object that handles this document.
XmlDocumentFragment createDocumentFragment() @safeCreates a document fragment.
XmlText createTextNode(string data) @safeCreates a text node.
XmlComment createComment(string data) @safeCreates a comment node.
XmlCData createCDATASection(string data) @safeCreates a CDATA section.
XmlProcessingInstruction createProcessingInstruction(string target, string data) @safeCreates a processing instruction.
XmlAttribute createAttribute(string name) @safeCreates an attribute node.
XmlEntityReference createEntityReference(string name) @safeCreates an entity reference.
XmlElement[] getElementsByTagName(string tagname) @safeReturns all elements in the document with the given tag name.
inout(XmlElement) documentElement() @property inout @safe nothrowReturns the document element (root element), or `null` if not present.
XmlElement createElement(string qname) @safeCreates a detached element.
XmlElement createRootElement(string qname) @safeCreates and sets the document element.
XmlNode appendChild(XmlNode child) @safeAppends a top-level child.
string toString() const @safe
XmlNode cloneShallow() @safeCreates a shallow clone of this document (no children).
XmlNotationDecl[] notations() const @safeReturns all DTD notation declarations in deterministic (name-sorted) order.
bool tryGetNotation(string name, out XmlNotationDecl decl) const @safe nothrowLooks up a notation by name.
XmlUnparsedEntityDecl[] unparsedEntities() const @safeReturns all unparsed entity declarations in deterministic (name-sorted) order.
bool tryGetUnparsedEntity(string name, out XmlUnparsedEntityDecl decl) const @safe nothrowLooks up an unparsed entity by name.
XmlNode importNode(XmlNode node, bool deep = true) @safeImports `node` into this document by cloning it.
XmlNode adoptNode(XmlNode node) @safeAdopts `node` into this document by detaching it from its current parent.
Constructors
this(XmlLocation location = XmlLocation.init)

A helper struct for declarative DOM construction.

Fields
private XmlParentNode _current
Methods
void element(string name, string content) @safeAdds an element to the current node.
void element(string name, scope void delegate() @safe content = null) @safeditto
void attribute(string name, string value) @safeSets an attribute on the current element.
void text(string value) @safeAdds text to the current node.
Constructors
this(XmlParentNode parent)Creates a builder starting at the given parent.

DOM implementation object.

Methods
bool hasFeature(string feature, string version_) @safeTests if the DOM implementation implements a specific feature.

Functions 1

fnXmlDocument buildXml(alias dg)() @safeDeclaratively builds an XML document.