DOMImplementation

An implementation of std.experimental.xml.dom.DOMImplementation.

It allows to specify a custom allocator to be used when creating instances of the DOM classes. As keeping track of the lifetime of every node would be very complex, this implementation does not try to do so. Instead, no object is ever deallocated; it is the users responsibility to directly free the allocator memory when all objects are no longer reachable.

Constructors

this
this()
Undocumented in source.

Members

Aliases

ElementsByTagName
alias ElementsByTagName = ElementsByTagNameImpl!false
Undocumented in source.
ElementsByTagNameNS
alias ElementsByTagNameNS = ElementsByTagNameImpl!true
Undocumented in source.

Classes

Attr
class Attr

Implementation of std.experimental.xml.dom.Attr

CDATASection
class CDATASection

Implementation of std.experimental.xml.dom.CDATASection

CharacterData
class CharacterData

Implementation of std.experimental.xml.dom.CharacterData

Comment
class Comment

Implementation of std.experimental.xml.dom.Comment

DOMConfiguration
class DOMConfiguration

Implementation of std.experimental.xml.dom.DOMConfiguration

DOMException
class DOMException

The implementation of std.experimental.xml.dom.DOMException thrown by this DOM implementation.

Document
class Document

Implementation of std.experimental.xml.dom.Document

DocumentFragment
class DocumentFragment

Implementation of std.experimental.xml.dom.DocumentFragment

DocumentType
class DocumentType

Implementation of std.experimental.xml.dom.DocumentType

Element
class Element

Implementation of std.experimental.xml.dom.Element

ElementsByTagNameImpl
class ElementsByTagNameImpl(bool ns)
Undocumented in source.
EntityReference
class EntityReference

Implementation of std.experimental.xml.dom.EntityReference

Node
class Node

Implementation of std.experimental.xml.dom.Node

ProcessingInstruction
class ProcessingInstruction

Implementation of std.experimental.xml.dom.ProcessingInstruction

Text
class Text

Implementation of std.experimental.xml.dom.Text

Functions

createDocument
Document createDocument(DOMString namespaceURI, DOMString qualifiedName, dom.DocumentType _doctype)

Implementation of std.experimental.xml.dom.DOMImplementation.createDocument.

createDocumentType
DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId)

Implementation of std.experimental.xml.dom.DOMImplementation.createDocumentType.

getFeature
DOMImplementation getFeature(string feature, string version_)

Implementation of std.experimental.xml.dom.DOMImplementation.hasFeature.

hasFeature
bool hasFeature(string feature, string version_)

Implementation of std.experimental.xml.dom.DOMImplementation.hasFeature.

Inherited Members

From DOMImplementation

createDocumentType
DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId)

Implementation of std.experimental.xml.dom.DOMImplementation.createDocumentType.

createDocument
Document createDocument(DOMString namespaceURI, DOMString qualifiedName, dom.DocumentType _doctype)

Implementation of std.experimental.xml.dom.DOMImplementation.createDocument.

hasFeature
bool hasFeature(string feature, string version_)

Implementation of std.experimental.xml.dom.DOMImplementation.hasFeature.

getFeature
DOMImplementation getFeature(string feature, string version_)

Implementation of std.experimental.xml.dom.DOMImplementation.hasFeature.

DOMException
class DOMException

The implementation of std.experimental.xml.dom.DOMException thrown by this DOM implementation.

Node
class Node

Implementation of std.experimental.xml.dom.Node

DocumentFragment
class DocumentFragment

Implementation of std.experimental.xml.dom.DocumentFragment

Document
class Document

Implementation of std.experimental.xml.dom.Document

ElementsByTagName
alias ElementsByTagName = ElementsByTagNameImpl!false
Undocumented in source.
ElementsByTagNameNS
alias ElementsByTagNameNS = ElementsByTagNameImpl!true
Undocumented in source.
ElementsByTagNameImpl
class ElementsByTagNameImpl(bool ns)
Undocumented in source.
CharacterData
class CharacterData

Implementation of std.experimental.xml.dom.CharacterData

Attr
class Attr

Implementation of std.experimental.xml.dom.Attr

Element
class Element

Implementation of std.experimental.xml.dom.Element

Text
class Text

Implementation of std.experimental.xml.dom.Text

Comment
class Comment

Implementation of std.experimental.xml.dom.Comment

DocumentType
class DocumentType

Implementation of std.experimental.xml.dom.DocumentType

CDATASection
class CDATASection

Implementation of std.experimental.xml.dom.CDATASection

ProcessingInstruction
class ProcessingInstruction

Implementation of std.experimental.xml.dom.ProcessingInstruction

EntityReference
class EntityReference

Implementation of std.experimental.xml.dom.EntityReference

DOMConfiguration
class DOMConfiguration

Implementation of std.experimental.xml.dom.DOMConfiguration

Examples

Instantiates a DOMBuilder specialized for the DOMImplementation implemented in this module.

1 
2 DOMImplementation impl = new DOMImplementation();
3 
4 auto doc = impl.createDocument(new DOMString("myNamespaceURI"), new DOMString("myPrefix:myRootElement"), null);
5 auto root = doc.documentElement;
6 assert(root.prefix == "myPrefix");
7 
8 auto attr = doc.createAttributeNS(new DOMString("myAttrNamespace"), new DOMString("myAttrPrefix:myAttrName"));
9 root.setAttributeNode(attr);
10 assert(root.attributes.length == 1);
11 assert(root.getAttributeNodeNS(new DOMString("myAttrNamespace"), new DOMString("myAttrName")) is attr);
12 
13 attr.nodeValue = new DOMString("myAttrValue");
14 assert(attr.childNodes.length == 1);
15 assert(attr.firstChild.nodeType == dom.NodeType.text);
16 assert(attr.firstChild.nodeValue == attr.nodeValue);
17 
18 auto elem = doc.createElementNS(new DOMString("myOtherNamespace"), new DOMString("myOtherPrefix:myOtherElement"));
19 assert(root.ownerDocument is doc);
20 assert(elem.ownerDocument is doc);
21 root.appendChild(elem);
22 assert(root.firstChild is elem);
23 assert(root.firstChild.namespaceURI == "myOtherNamespace");
24 
25 auto comm = doc.createComment(new DOMString("myWonderfulComment"));
26 doc.insertBefore(comm, root);
27 assert(doc.childNodes.length == 2);
28 assert(doc.firstChild is comm);
29 
30 assert(comm.substringData(1, 4) == "yWon");
31 comm.replaceData(0, 2, new DOMString("your"));
32 comm.deleteData(4, 9);
33 comm.insertData(4, new DOMString("Questionable"));
34 assert(comm.data == "yourQuestionableComment");
35 
36 auto pi = doc.createProcessingInstruction(new DOMString("myPITarget"), new DOMString("myPIData"));
37 elem.appendChild(pi);
38 assert(elem.lastChild is pi);
39 auto cdata = doc.createCDATASection(new DOMString("mycdataContent"));
40 elem.replaceChild(cdata, pi);
41 assert(elem.lastChild is cdata);
42 elem.removeChild(cdata);
43 assert(elem.childNodes.length == 0);
44 
45 assert(doc.getElementsByTagNameNS(new DOMString("myOtherNamespace"), new DOMString("myOtherElement")).item(0) is elem);
46 
47 doc.setUserData("userDataKey1", dom.UserData(3.14), null);
48 doc.setUserData("userDataKey2", dom.UserData(new Object()), null);
49 doc.setUserData("userDataKey3", dom.UserData(null), null);
50 assert(doc.getUserData("userDataKey1") == 3.14);
51 assert(doc.getUserData("userDataKey2").type == typeid(Object));
52 assert(doc.getUserData("userDataKey3").peek!long is null);
53 
54 assert(elem.lookupNamespaceURI(new DOMString("myOtherPrefix")) == "myOtherNamespace");
55 assert(doc.lookupPrefix(new DOMString("myNamespaceURI")) == "myPrefix");
56 
57 assert(elem.isEqualNode(elem.cloneNode(false)));
58 assert(root.isEqualNode(root.cloneNode(true)));
59 assert(comm.isEqualNode(comm.cloneNode(false)));
60 assert(pi.isEqualNode(pi.cloneNode(false)));

Meta