Dodo
DOm DOcument implementation
Loading...
Searching...
No Matches
Wikimedia\Dodo\XMLDocument Class Reference
+ Inheritance diagram for Wikimedia\Dodo\XMLDocument:

Public Member Functions

 __construct (?Document $originDoc, string $contentType)
 
- Public Member Functions inherited from Wikimedia\Dodo\Document
 __construct (string $version="1.0", string $encoding="")
 These constructor arguments are not given by the DOM spec, but are instead chosen to match the PHP constructor arguments for compatibility with the DOM extension.
 
 _setOrigin (?Document $originDoc)
 
 _setContentType (string $contentType, bool $isHtml)
 
 _setURL (?string $url)
 
Document _getTemplateDoc ()
 The children of a <template> element aren't part of the element's node document; instead they are children of an "associated inert template document". This creates that "inert template document".
 
 _setQuirksMode (string $mode)
 Used by a callback in the HTML Parser (RemexHtml) to force quirks mode depending on the value of the DOCTYPE token.
 
int getNodeType ()
 
string getNodeName ()
 
string getCharacterSet ()
 DOMTokenList. \IDLeDOM\Document::getCharacterSet()
 
string getCharset ()
 
string getInputEncoding ()
 
string getEncoding ()
 
 setEncoding (string $encoding)
 
DOMImplementation getImplementation ()
 
string getDocumentURI ()
 
string getURL ()
 
string getCompatMode ()
 
string getContentType ()
 
DocumentType getDoctype ()
 
Element getDocumentElement ()
 
Document getOwnerDocument ()
 The ownerDocument getter steps are to return null, if this is a document; otherwise this’s node document.We will override this implementation to return null in the Document class.
 
string getTitle ()
 
 setTitle (string $val)
 
string getTextContent ()
 Generic implementation of getTextContent to be used by Element and DocumentFragment (but not Document!).
See also
https://dom.spec.whatwg.org/#dom-node-textcontent
Returns
?string

 
 setTextContent (?string $value)
 Generic implementation of setTextContent to be used by Element and DocumentFragment (but not Document!).
See also
https://dom.spec.whatwg.org/#dom-node-textcontent
Parameters
?string$value

 
Text createTextNode (string $data)
 
CDATASection createCDATASection (string $data)
 
Comment createComment (string $data)
 
 createDocumentFragment ()
 
 createProcessingInstruction (string $target, string $data)
 
 createAttribute (string $localName)
 
 createAttributeNS (?string $ns, string $qname)
 
 createElement (string $lname, $options=null)
 
 createElementNS (?string $ns, string $qname, $options=null)
 
Element _createElementNS (string $lname, ?string $ns, ?string $prefix)
 This function is used directly by HTML parser, which allows it to create elements with localNames containing ':' and non-default namespaces.
 
Range createRange ()
 
NodeIterator createNodeIterator ( $root, int $whatToShow=NodeFilter::SHOW_ALL, $filter=null)
 
 _attachNodeIterator (NodeIterator $ni)
 Add a node iterator to the list of NodeIterators associated with this Document.
 
 _detachNodeIterator (NodeIterator $ni)
 Remove a node iterator from the list of NodeIterators associated with this Document.
 
 _preremoveNodeIterators (Node $toBeRemoved)
 Run preremove steps on all NodeIterators associated with this document.
 
 adoptNode ( $node)
 Adopt the subtree rooted at Node into this Document.
 
Node importNode ( $node, bool $deep=false)
 Clone and then adopt either $node or, if $deep === true, the entire subtree rooted at $node, into the Document.
 
Node insertBefore ( $node, $refChild=null)
 Insert $node as a child of $this, and insert it before $refChild in the document order.spec DOM-LSTHINGS TO KNOW FROM THE SPEC:
  1. If $node already exists in this Document, this function moves it from its current position to its new position ('move' means 'remove' followed by 're-insert').
  2. If $refNode is NULL, then $node is added to the end of the list of children of $this. In other words, insertBefore($node, NULL) is equivalent to appendChild($node).
  3. If $node is a DocumentFragment, the children of the DocumentFragment are moved into the child list of $this, and the empty DocumentFragment is returned.
THINGS TO KNOW IN LIFE:Despite its weird syntax (blame the spec), this is a real workhorse, used to implement all of the non-replacing insertion mutations.
Parameters
INode$nodeTo be inserted
?INode$refNodeChild of this node before which to insert $node
Returns
Node Newly inserted Node or empty DocumentFragment
Exceptions
DOMException"HierarchyRequestError" or "NotFoundError"

 
Node _unsafeAppendChild (Node $node)
 Does not check for insertion validity.This out-performs PHP DOMDocument by over 2x.
Parameters
Node$node
Returns
Node

 
Node replaceChild ( $node, $child)
 
Node removeChild ( $child)
 
Document cloneNode (bool $deep=false)
 Clone this Document, import nodes, and call __update_document_state.
 
 getElementById (string $id)
 Fetch an Element in this Document with a given ID value.
 
array< Element_getElementsById (string $id)
 This is a non-standard Dodo extension that interfaces with the Zest CSS selector library to allow quick lookup by ID even if there are multiple nodes in the document with the same ID.
 
FakeElement _fakeElement ()
 A number of methods of Document act as if the Document were an Element.
 
HTMLCollection getElementsByTagName (string $lname)
 
HTMLCollection getElementsByTagNameNS (?string $ns, string $lname)
 
HTMLCollection getElementsByClassName (string $names)
 
string getInnerHTML ()
 
string getOuterHTML ()
 
bool _isHTMLDocument ()
 Return true if this document is an HTML document, otherwise it is an XML document and will return false.
 
 _xmlSerialize (?string $namespace, NamespacePrefixMap $prefixMap, int &$prefixIndex, array $options, array &$markup)
 XML serialize the given node.This is overridden in subclasses. Note that this is effectively "outerHTML", due to a spec inconsistency: https://github.com/w3c/DOM-Parsing/issues/28 .
See also
https://w3c.github.io/DOM-Parsing/#dfn-xml-serialization
Parameters
?string$namespace
NamespacePrefixMap$prefixMap
int&$prefixIndex
array$options
string[]&$markupaccumulator for the result

 
string bool saveXML ( $node=null, int $options=0)
 Creates an XML document from the DOM representation.
 
bool loadXML (string $source, int $options=0)
 Loads an XML document from a string.
 
bool loadHTML (string $source, int $options=0)
 
string bool saveHTML ( $node=null)
 Dumps the internal document into a string using HTML formatting.
 
HTMLElement null getBody ()
 
HTMLHeadElement null getHead ()
 
 _mutateValue (Node $node)
 Implementation-specific function.
 
 _mutateAttr (Attr $attr, ?string $oldval)
 Invoked when an attribute's value changes.
 
 _mutateRemoveAttr (Attr $attr)
 Used by removeAttribute and removeAttributeNS for attributes.
 
 _mutateRemove (Node $node)
 Called by Node.removeChild, etc.
 
 _mutateInsert (Node $node)
 Called when a new element becomes rooted.
 
 _mutateMove (Node $node)
 Called when a rooted element is moved within the document.
 
 _addToIdTable (string $id, Element $elt)
 
 _removeFromIdTable (string $id, Element $elt)
 
- Public Member Functions inherited from Wikimedia\Dodo\ContainerNode
 __construct (Document $nodeDocument)
 
bool hasChildNodes ()
 Return true iff there are children of this node.
 
int _length ()
 
See also
https://dom.spec.whatwg.org/#concept-node-length
Returns
int The length of this node.

 
bool _empty ()
 
See also
https://dom.spec.whatwg.org/#concept-node-empty
Returns
bool Whether this node is considered empty.

 
NodeList getChildNodes ()
 Keeping child nodes as an array makes insertion/removal of nodes quite expensive.
 
Node getFirstChild ()
 Be careful to use this method in most cases rather than directly accessing _firstChildOrChildren.
 
Node getLastChild ()
 This should be overridden in ContainerNode and Leaf.
 
- Public Member Functions inherited from Wikimedia\Dodo\Node
string getNodeValue ()
 Return the value for this node.
 
 setNodeValue (?string $val)
 
Node getParentNode ()
 Nodes might not have a parentNode.
 
Element getParentElement ()
 This value is the same as parentNode, except it puts an extra condition, that the parentNode must be an Element.
 
Wikimedia IDLeDOM Node getRootNode ($options=null)
 Return this' shadow-including root if options['composed'] is true; otherwise return this' root.
 
Node getPreviousSibling ()
 
Node getNextSibling ()
 
 _roothook ()
 <script> elements need to know when they're inserted into the document.
 
 appendChild ( $node)
 
 normalize ()
 Puts $this and the entire subtree rooted at $this into "normalized" form.
 
int compareDocumentPosition ( $that)
 
bool contains ( $node)
 
bool isSameNode ( $node)
 
bool isEqualNode ( $node)
 Determine whether this node and $other are equal.
 
string lookupPrefix (?string $ns)
 Return DOMString containing prefix for given namespace URI.
 
string lookupNamespaceURI (?string $prefix)
 Return DOMString containing namespace URI for a given prefix.
 
bool isDefaultNamespace (?string $ns)
 Determine whether this is the default namespace.
 
string getNodePath ()
 Get an XPath for a node.
 
 _resetNodeDocument (Document $doc)
 Set the ownerDocument reference on a subtree rooted at $this.
 
bool getIsConnected ()
 Determine whether this Node is rooted (belongs to the tree rooted at the node document).
 
int _getSiblingIndex ()
 The index of this Node in its parent's childNodes list.
 
int _lastModTime ()
 Return the lastModTime value for this node.
 
 _modify ()
 Increment the owner document's modclock [and use the new value to update the lastModTime value for this node and all of its ancestors.
 
 _htmlSerialize (array &$result, array $options)
 Convert the children of a node to an HTML string.
 
mixed getExtensionData (string $key, $defaultValue=null)
 Get "extension data" associate with this node, using the given $key.
 
 setExtensionData (string $key, $value)
 Set "extension data" associate with this node, using the given $key.
 
- Public Member Functions inherited from Wikimedia::IDLeDOM::EventTarget
void addEventListener (string $type, $callback, $options=null)
 
void removeEventListener (string $type, $callback, $options=null)
 
bool dispatchEvent ( $event)
 
- Public Member Functions inherited from Wikimedia::IDLeDOM::Node
string getBaseURI ()
 
- Public Member Functions inherited from Wikimedia::IDLeDOM::Document
Event createEvent (string $interface)
 
TreeWalker createTreeWalker ( $root, int $whatToShow=-1, $filter=null)
 
Location null getLocation ()
 
 setLocation (string $val)
 
string getReferrer ()
 
string getCookie ()
 
 setCookie (string $val)
 
string getLastModified ()
 
string getDir ()
 
 setDir (string $val)
 
 setBody ( $val)
 
HTMLCollection getImages ()
 
HTMLCollection getEmbeds ()
 
HTMLCollection getPlugins ()
 
HTMLCollection getLinks ()
 
HTMLCollection getForms ()
 
HTMLCollection getScripts ()
 
NodeList getElementsByName (string $elementName)
 
HTMLScriptElement null getCurrentScript ()
 
Wikimedia IDLeDOM Document open (string $type='text/html', string $replace='')
 
void close ()
 
void write (string ... $text)
 
void writeln (string ... $text)
 
bool hasFocus ()
 
EventHandlerNonNull callable null getOnreadystatechange ()
 
 setOnreadystatechange ( $val)
 
HTMLCollection getAnchors ()
 
HTMLCollection getApplets ()
 
void clear ()
 
void captureEvents ()
 
void releaseEvents ()
 
bool getHidden ()
 
string getVisibilityState ()
 
EventHandlerNonNull callable null getOnvisibilitychange ()
 
 setOnvisibilitychange ( $val)
 
bool getPreserveWhiteSpace ()
 
 setPreserveWhiteSpace (bool $val)
 
bool getFormatOutput ()
 
 setFormatOutput (bool $val)
 
bool getValidateOnParse ()
 
 setValidateOnParse (bool $val)
 
bool getStrictErrorChecking ()
 
 setStrictErrorChecking (bool $val)
 
- Public Member Functions inherited from Wikimedia::IDLeDOM::DocumentOrShadowRoot
StyleSheetList getStyleSheets ()
 
- Public Member Functions inherited from Wikimedia::IDLeDOM::GlobalEventHandlers
EventHandlerNonNull callable null getOnload ()
 
 setOnload ( $val)
 
- Public Member Functions inherited from Wikimedia::IDLeDOM::ParentNode
HTMLCollection getChildren ()
 
Element null getFirstElementChild ()
 
Element null getLastElementChild ()
 
int getChildElementCount ()
 
void prepend (... $nodes)
 
void append (... $nodes)
 
void replaceChildren (... $nodes)
 
Element null querySelector (string $selectors)
 
NodeList querySelectorAll (string $selectors)
 
- Public Member Functions inherited from Wikimedia::IDLeDOM::XPathEvaluatorBase
XPathExpression createExpression (string $expression, $resolver=null)
 
XPathNSResolver callable createNSResolver ( $nodeResolver)
 
XPathResult evaluate (string $expression, $contextNode, $resolver=null, int $type=0, $result=null)
 

Additional Inherited Members

- Public Attributes inherited from Wikimedia\Dodo\Document
int $_modclock = 0
 This property holds a monotonically increasing value akin to a timestamp used to record the last modification time of nodes and their subtrees.
 
DocumentType $_doctype = null
 Reference to the first DocumentType child, in document order.
 
Element $_documentElement = null
 Reference to the first Element child, in document order.
 
DOMImplementation $_implementation
 The DOMImplementation associated with this Document.
 
string $_readyState
 
- Public Attributes inherited from Wikimedia\Dodo\ContainerNode
Node NodeList null $_firstChildOrChildren
 The first child (if we're using the linked list representation), or a NodeList (if we're using the array of children), or null (if there are no children).
 
- Public Attributes inherited from Wikimedia\Dodo\Node
Document $_nodeDocument
 The document this node is associated to.
 
Node null $_parentNode
 should be considered read-only
 
Node $_nextSibling
 The sibling list is stored as a circular linked list: the node "before" the first sibling is the last sibling, and the node "after" the last sibling is the first sibling.
 
Node $_previousSibling
 
int $_documentIndex = null
 DEVELOPERS NOTE: An index is assigned when a node is added to a Document (becomes rooted).
 
int $_cachedSiblingIndex = null
 DEVELOPERS NOTE: An index is assigned on INSERTION.
 
- Protected Member Functions inherited from Wikimedia\Dodo\Document
mixed _getMissingProp (string $name)
 
Document _subclassCloneNodeShallow ()
 Delegated method called by Node::cloneNode() Performs the shallow clone branch.
 
bool _subclassIsEqualNode (Node $other=null)
 Delegated method called by Node::isEqualNode()
 
- Protected Member Functions inherited from Wikimedia\Dodo\Node
 _setMissingProp (string $name, $value)
 
- Protected Attributes inherited from Wikimedia\Dodo\Document
 $_contentType = 'application/xml'
 

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Dodo\XMLDocument::__construct ( ?Document $originDoc,
string $contentType )
Parameters
?Document$originDoc
string$contentType

The documentation for this class was generated from the following file: