\QueryPathDOMQuery

The DOMQuery object is the primary tool in this library.

To create a new DOMQuery, use QueryPath::with() or qp() function.

If you are new to these documents, start at the QueryPath.php page. There you will find a quick guide to the tools contained in this project.

A note on serialization: DOMQuery uses DOM classes internally, and those do not serialize well at all. In addition, DOMQuery may contain many extensions, and there is no guarantee that extensions can serialize. The moral of the story: Don't serialize DOMQuery.

Summary

Methods
Properties
Constants
__construct()
getOptions()
top()
find()
findInPlace()
xpath()
size()
count()
get()
ns()
document()
xinclude()
toArray()
attr()
hasAttr()
css()
dataURL()
removeAttr()
eq()
is()
filter()
sort()
filterLambda()
filterPreg()
filterCallback()
not()
index()
map()
slice()
each()
eachLambda()
append()
appendTo()
prepend()
prependTo()
before()
insertBefore()
insertAfter()
after()
replaceWith()
unwrap()
wrap()
wrapAll()
wrapInner()
deepest()
tag()
remove()
replaceAll()
end()
andSelf()
removeChildren()
children()
contents()
siblings()
closest()
parent()
parents()
html()
html5()
innerHTML()
innerXHTML()
innerXML()
innerHTML5()
textImplode()
childrenText()
text()
textBefore()
textAfter()
val()
xhtml()
xml()
writeXML()
writeHTML()
writeHTML5()
writeXHTML()
next()
nextAll()
prev()
prevAll()
removeClass()
hasClass()
branch()
cloneAll()
__clone()
detach()
attach()
has()
emptyElement()
even()
odd()
first()
firstChild()
last()
lastChild()
nextUntil()
prevUntil()
parentsUntil()
setMatches()
__call()
getIterator()
$length DEFAULT_PARSER_FLAGS JS_CSS_ESCAPE_CDATA JS_CSS_ESCAPE_CDATA_CCOMMENT JS_CSS_ESCAPE_CDATA_DOUBLESLASH JS_CSS_ESCAPE_NONE deepestNode() prepareInsert() inst() isXMLish()$document
$matches$last
N/A
parseXMLString()
noMatches()
getNthMatch()
getFirstMatch()
parseXMLFile()
$errTypes$options
$ext N/A Constants DEFAULT_PARSER_FLAGS DEFAULT_PARSER_FLAGS Default parser flags. These are flags that will be used if no global or local flags override them. JS_CSS_ESCAPE_CDATA JS_CSS_ESCAPE_CDATA JS_CSS_ESCAPE_CDATA_CCOMMENT JS_CSS_ESCAPE_CDATA_CCOMMENT JS_CSS_ESCAPE_CDATA_DOUBLESLASH JS_CSS_ESCAPE_CDATA_DOUBLESLASH JS_CSS_ESCAPE_NONE JS_CSS_ESCAPE_NONE Properties $length

$ext :  Type Methods __construct() __construct(mixed$document = NULL, string  $string = NULL, array$options = array())

Constructor.

Typically, a new DOMQuery is created by QueryPath::with(), QueryPath::withHTML(), qp(), or htmlqp().

 mixed $document A document-like object. string$string A CSS 3 Selector array $options An associative array of options. getOptions() getOptions() : array Get the effective options for the current DOMQuery object. This returns an associative array of all of the options as set for the current DOMQuery object. This includes default options, options directly passed in via qp() or the constructor, an options set in the QueryPath::Options object. The order of merging options is this: • Options passed in using qp() are highest priority, and will override other options. • Options set with QueryPath::Options will override default options, but can be overridden by options passed into qp(). • Default options will be used when no overrides are present. This function will return the options currently used, with the above option overriding having been calculated already. Returns array — An associative array of options, calculated from defaults and overridden options. top() top(string$selector = NULL) : \QueryPath\DOMQuery

Select the root element of the document.

This sets the current match to the document's root element. For practical purposes, this is the same as:

 string $selector A selector. If this is supplied, QueryPath will navigate to the document root and then run the query. (Added in QueryPath 2.0 Beta 2) Returns \QueryPath\DOMQuery The DOMQuery object, wrapping the root element (document element) for the current document. find() find(string$selector) : \QueryPath\DOMQuery

Given a CSS Selector, find matching items.

• If $name is a string and is set, then the attribute value will be returned. When an attribute value is retrieved, only the attribute value of the FIRST match is returned. Parameters  mixed$name The name of the attribute or an associative array of name/value pairs. string $value A value (used only when setting an individual property). Returns mixed — If this was a setter request, return the DOMQuery object. If this was an access request (getter), return the string value. hasAttr() hasAttr(string$attrName) : boolean

Check to see if the given attribute is present.

This returns TRUE if all selected items have the attribute, or FALSE if at least one item does not have the attribute.

Returns

\QueryPath\DOMQuery

dataURL()

dataURL(string  $attr, mixed$data = NULL, string  $mime = 'application/octet-stream', resource$context = NULL) : \QueryPath\DOMQuery|string

Insert or retrieve a Data URL.

When called with just $attr, it will fetch the result, attempt to decode it, and return an array with the MIME type and the application data. When called with both$attr and $data, it will inject the data into all selected elements So @code$qp->dataURL('src', file_get_contents('my.png'), 'image/png')@endcode will inject the given PNG image into the selected elements.

The current implementation only knows how to encode and decode Base 64 data.

Note that this is known not to work on IE 6, but should render fine in other browsers.

 string $attr The name of the attribute. mixed$data The contents to inject as the data. The value can be any one of the following: A URL: If this is given, then the subsystem will read the content from that URL. THIS MUST BE A FULL URL, not a relative path. A string of data: If this is given, then the subsystem will encode the string. A stream or file handle: If this is given, the stream's contents will be encoded and inserted as data. (Note that we make the assumption here that you would never want to set data to be a URL. If this is an incorrect assumption, file a bug.) string $mime The MIME type of the document. resource$context A valid context. Use this only if you need to pass a stream context. This is only necessary if $data is a URL. (See {@link stream_context_create()}). Returns \QueryPath\DOMQuery|string — If this is called as a setter, this will return a DOMQuery object. Otherwise, it will attempt to fetch data out of the attribute and return that. removeAttr() removeAttr(string$name) : \QueryPath\DOMQuery

Remove the named attribute from all elements in the current DOMQuery.

This will remove any attribute with the given name. It will do this on each item currently wrapped by DOMQuery.

As is the case in jQuery, this operation is not considered destructive.

 string $name Name of the parameter to remove. Returns \QueryPath\DOMQuery The DOMQuery object with the same elements. eq() eq($index) : \QueryPath\DOMQuery

Reduce the matched set to just one.

This will take a matched set and reduce it to just one item -- the item at the index specified. This is a destructive operation, and can be undone with \end().

 $index The index of the element to keep. The rest will be discarded. Returns \QueryPath\DOMQuery is() is(string$selector) : boolean

Given a selector, this checks to see if the current set has one or more matches.

Unlike jQuery's version, this supports full selectors (not just simple ones).

 string $selector The selector to search for. As of QueryPath 2.1.1, this also supports passing a DOMNode object. Returns boolean — TRUE if one or more elements match. FALSE if no match is found. filter() filter(string$selector) : \QueryPath\DOMQuery

Filter a list down to only elements that match the selector.

Use this, for example, to find all elements with a class, or with certain children.

 string $selector The selector to use as a filter. Returns \QueryPath\DOMQuery The DOMQuery with non-matching items filtered out. sort() sort(callback$comparator, boolean  $modifyDOM = FALSE) : \QueryPath\DOMQuery Sort the contents of the QueryPath object. By default, this does not change the order of the elements in the DOM. Instead, it just sorts the internal list. However, if TRUE is passed in as the second parameter then QueryPath will re-order the DOM, too. Parameters  callback$comparator A callback. This will be called during sorting to compare two DOMNode objects. boolean $modifyDOM If this is TRUE, the sorted results will be inserted back into the DOM at the position of the original first element. Returns \QueryPath\DOMQuery This object. filterLambda() filterLambda(string$fn) : \QueryPath\DOMQuery

Filter based on a lambda function.

The function string will be executed as if it were the body of a function. It is passed two arguments:

• $index: The index of the item. •$item: The current Element. If the function returns boolean FALSE, the item will be removed from the list of elements. Otherwise it will be kept.

Example:

 string $fn Inline lambda function in a string. Returns \QueryPath\DOMQuery filterPreg() filterPreg(string$regex) : \QueryPath\DOMQuery

Use regular expressions to filter based on the text content of matched elements.

Only items that match the given regular expression will be kept. All others will be removed.

The regular expression is run against the text content (the PCDATA) of the elements. This is a way of filtering elements based on their content.

Example:

 string $regex A regular expression. Returns \QueryPath\DOMQuery filterCallback() filterCallback($callback) : \QueryPath\DOMQuery

Filter based on a callback function.

A callback may be any of the following:

• a function: 'my_func'.
• an object/method combo: $obj, 'myMethod' • a class/method combo: 'MyClass', 'myMethod' Note that classes are passed in strings. Objects are not. Each callback is passed to arguments: •$index: The index position of the object in the array.

Returns

\QueryPath\DOMQuery

Query path object augmented according to the function.

not()

Returns

\QueryPath\DOMQuery

The DOMQuery object with matching items filtered out.

index()

Returns

mixed —

The index as an integer (if found), or boolean FALSE. Since 0 is a valid index, you should use strong equality (===) to test..

map()

Returns

\QueryPath\DOMQuery

The DOMQuery object wrapping a list of whatever values were returned by each run of the callback.

slice()

slice(integer  $start, integer$length) : \QueryPath\DOMQuery

Narrow the items in this object down to only a slice of the starting items.

 integer $start Where in the list of matches to begin the slice. integer$length The number of items to include in the slice. If nothing is specified, the all remaining matches (from $start onward) will be included in the sliced list. Returns \QueryPath\DOMQuery each() each(callback$callback) : \QueryPath\DOMQuery

Run a callback on each item in the list of items.

Rules of the callback:

• A callback is passed two variables: $index and$item. (There is no special treatment of $this, as there is in jQuery.) • You will want to pass$item by reference if it is not an object (DOMNodes are all objects).
• A callback that returns FALSE will stop execution of the each() loop. This works like break in a standard loop.
• A TRUE return value from the callback is analogous to a continue statement.
• All other return values are ignored.

 callback $callback The callback to run. Returns \QueryPath\DOMQuery The DOMQuery. eachLambda() eachLambda(string$lambda) : \QueryPath\DOMQuery

An each() iterator that takes a lambda function.

 string $lambda The lambda function. This will be passed ($index, &$item). Returns \QueryPath\DOMQuery The DOMQuery object. append() append(mixed$data) : \QueryPath\DOMQuery

Insert the given markup as the last child.

The markup will be inserted into each match in the set.

The same element cannot be inserted multiple times into a document. DOM documents do not allow a single object to be inserted multiple times into the DOM. To insert the same XML repeatedly, we must first clone the object. This has one practical implication: Once you have inserted an element into the object, you cannot further manipulate the original element and expect the changes to be replciated in the appended object. (They are not the same -- there is no shared reference.) Instead, you will need to retrieve the appended object and operate on that.

Returns

\QueryPath\DOMQuery

The DOMQuery object.

appendTo()

Throws

\QueryPath\QueryPath::Exception

Thrown if $data is an unsupported object type. Returns \QueryPath\DOMQuery The original DOMQuery, unaltered. Only the destination DOMQuery will be modified. prepend() prepend(mixed$data) : \QueryPath\DOMQuery

Insert the given markup as the first child.

The markup will be inserted into each match in the set.

Returns

\QueryPath\DOMQuery

prependTo()

Throws

\QueryPath\QueryPath::Exception

Thrown if $data is an unsupported object type. Returns \QueryPath\DOMQuery The original DOMQuery, unmodified. NOT the destination DOMQuery. before() before(mixed$data) : \QueryPath\DOMQuery

Insert the given data before each element in the current set of matches.

This will take the give data (XML or HTML) and put it before each of the items that the DOMQuery object currently contains. Contrast this with after().

Returns

\QueryPath\DOMQuery

Returns the DOMQuery with the new modifications. The list of elements currently selected will remain the same.

insertBefore()

Throws

\QueryPath\QueryPath::Exception

Thrown if $data is an unsupported object type. Returns \QueryPath\DOMQuery The current DOMQuery object, unaltered. Only the destination DOMQuery object is altered. insertAfter() insertAfter(\QueryPath\DOMQuery$dest) : \QueryPath\DOMQuery

Insert the contents of the current DOMQuery after the nodes in the destination DOMQuery object.

Returns

\QueryPath\DOMQuery

The present DOMQuery, unaltered. Only the destination object is altered.

after()

Throws

\QueryPath\QueryPath::Exception

Thrown if $data is an unsupported object type. Returns \QueryPath\DOMQuery The DOMQuery object (with the items inserted). replaceWith() replaceWith(mixed$new) : \QueryPath\DOMQuery

Replace the existing element(s) in the list with a new one.

 mixed $new A DOMElement or XML in a string. This will replace all elements currently wrapped in the DOMQuery object. Returns \QueryPath\DOMQuery The DOMQuery object wrapping the items that were removed. This remains consistent with the jQuery API. unwrap() unwrap() : \QueryPath\DOMQuery Remove the parent element from the selected node or nodes. This takes the given list of nodes and "unwraps" them, moving them out of their parent node, and then deleting the parent node. For example, consider this: Throws \QueryPath\QueryPath::Exception An exception is thrown if one attempts to unwrap a root element. Returns \QueryPath\DOMQuery The DOMQuery object, with the same element(s) selected. wrap() wrap(mixed$markup) : \QueryPath\DOMQuery

Wrap each element inside of the given markup.

Markup is usually a string, but it can also be a DOMNode, a document fragment, a SimpleXMLElement, or another DOMNode object (in which case the first item in the list will be used.)

 mixed $markup Markup that will wrap each element in the current list. Returns \QueryPath\DOMQuery The DOMQuery object with the wrapping changes made. wrapAll() wrapAll(string$markup) : \QueryPath\DOMQuery

Wrap all elements inside of the given markup.

So all elements will be grouped together under this single marked up item. This works by first determining the parent element of the first item in the list. It then moves all of the matching elements under the wrapper and inserts the wrapper where that first element was found. (This is in accordance with the way jQuery works.)

Markup is usually XML in a string, but it can also be a DOMNode, a document fragment, a SimpleXMLElement, or another DOMNode object (in which case the first item in the list will be used.)

 string $markup Markup that will wrap all elements in the current list. Returns \QueryPath\DOMQuery The DOMQuery object with the wrapping changes made. wrapInner() wrapInner(string$markup) : \QueryPath\DOMQuery

Wrap the child elements of each item in the list with the given markup.

Markup is usually a string, but it can also be a DOMNode, a document fragment, a SimpleXMLElement, or another DOMNode object (in which case the first item in the list will be used.)

 string $markup Markup that will wrap children of each element in the current list. Returns \QueryPath\DOMQuery The DOMQuery object with the wrapping changes made. deepest() deepest() : \QueryPath\DOMQuery Reduce the set of matches to the deepest child node in the tree. This loops through the matches and looks for the deepest child node of all of the matches. "Deepest", here, is relative to the nodes in the list. It is calculated as the distance from the starting node to the most distant child node. In other words, it is not necessarily the farthest node from the root element, but the farthest note from the matched element. In the case where there are multiple nodes at the same depth, all of the nodes at that depth will be included. Returns \QueryPath\DOMQuery The DOMQuery wrapping the single deepest node. tag() tag() : string The tag name of the first element in the list. This returns the tag name of the first element in the list of matches. If the list is empty, an empty string will be used. Returns string — The tag name of the first element in the list. remove() remove(string$selector = NULL) : \QueryPath\DOMQuery

Remove any items from the list if they match the selector.

In other words, each item that matches the selector will be remove from the DOM document. The returned DOMQuery wraps the list of removed elements.

If no selector is specified, this will remove all current matches from the document.

 string $selector A CSS Selector. Returns \QueryPath\DOMQuery The Query path wrapping a list of removed items. replaceAll() replaceAll(string$selector, \QueryPath\DOMDocument  $document) : \QueryPath\DOMQuery This replaces everything that matches the selector with the first value in the current list. This is the reverse of replaceWith. Unlike jQuery, DOMQuery cannot assume a default document. Consequently, you must specify the intended destination document. If it is omitted, the present document is assumed to be tthe document. However, that can result in undefined behavior if the selector and the replacement are not sufficiently distinct. Parameters  string$selector The selector. \QueryPath\DOMDocument $document The destination document. Returns \QueryPath\DOMQuery The DOMQuery wrapping the modified document. add() add(string$selector) : \QueryPath\DOMQuery

Add more elements to the current set of matches.

This begins the new query at the top of the DOM again. The results found when running this selector are then merged into the existing results. In this way, you can add additional elements to the existing set.

 string $selector A valid selector. Returns \QueryPath\DOMQuery The DOMQuery object with the newly added elements. end() end() : \QueryPath\DOMQuery Revert to the previous set of matches. DEPRECATED Do not use. This will revert back to the last set of matches (before the last "destructive" set of operations). This undoes any change made to the set of matched objects. Functions like find() and filter() change the list of matched objects. The end() function will revert back to the last set of matched items. Note that functions that modify the document, but do not change the list of matched objects, are not "destructive". Thus, calling append('something')->end() will not undo the append() call. Only one level of changes is stored. Reverting beyond that will result in an empty set of matches. Example: Returns \QueryPath\DOMQuery A DOMNode object reflecting the list of matches prior to the last destructive operation. andSelf() andSelf() : \QueryPath\DOMQuery Combine the current and previous set of matched objects. Example: Returns \QueryPath\DOMQuery A DOMNode object with the results of the last two "destructive" operations. removeChildren() removeChildren() : \QueryPath\DOMQuery Remove all child nodes. This is equivalent to jQuery's empty() function. (However, empty() is a PHP built-in, and cannot be used as a method name.) Returns \QueryPath\DOMQuery The DOMQuery object with the child nodes removed. children() children(string$selector = NULL) : \QueryPath\DOMQuery

Get the children of the elements in the DOMQuery object.

If a selector is provided, the list of children will be filtered through the selector.

 string $selector A valid selector. Returns \QueryPath\DOMQuery A DOMQuery wrapping all of the children. contents() contents() : \QueryPath\DOMQuery Get all child nodes (not just elements) of all items in the matched set. It gets only the immediate children, not all nodes in the subtree. This does not process iframes. Xinclude processing is dependent on the DOM implementation and configuration. Returns \QueryPath\DOMQuery A DOMNode object wrapping all child nodes for all elements in the DOMNode object. siblings() siblings(string$selector = NULL) : \QueryPath\DOMQuery

Get a list of siblings for elements currently wrapped by this object.

This will compile a list of every sibling of every element in the current list of elements.

Note that if two siblings are present in the DOMQuery object to begin with, then both will be returned in the matched set, since they are siblings of each other. In other words,if the matches contain a and b, and a and b are siblings of each other, than running siblings will return a set that contains both a and b.

 string $selector If the optional selector is provided, siblings will be filtered through this expression. Returns \QueryPath\DOMQuery The DOMQuery containing the matched siblings. closest() closest(string$selector) : \QueryPath\DOMQuery

Find the closest element matching the selector.

This finds the closest match in the ancestry chain. It first checks the present element. If the present element does not match, this traverses up the ancestry chain (e.g. checks each parent) looking for an item that matches.

It is provided for jQuery 1.3 compatibility.

 string $selector A CSS Selector to match. Returns \QueryPath\DOMQuery The set of matches. parent() parent(string$selector = NULL) : \QueryPath\DOMQuery

Get the immediate parent of each element in the DOMQuery.

If a selector is passed, this will return the nearest matching parent for each element in the DOMQuery.

 string $selector A valid CSS3 selector. Returns \QueryPath\DOMQuery A DOMNode object wrapping the matching parents. parents() parents(string$selector = NULL) : \QueryPath\DOMQuery

Get all ancestors of each element in the DOMQuery.

If a selector is present, only matching ancestors will be retrieved.

 string $selector A valid CSS 3 Selector. Returns \QueryPath\DOMQuery A DOMNode object containing the matching ancestors. html() html(string$markup = NULL) : mixed

Set or get the markup for an element.

Returns

mixed —

A string if no markup was passed, or a DOMQuery if markup was passed.

innerHTML()

innerHTML() : string

Fetch the HTML contents INSIDE of the first DOMQuery item.

This behaves the way jQuery's @codehtml()@endcode function behaves.

This gets all children of the first match in DOMQuery.

Consider this fragment:

Returns

string —

Returns a string representation of the child nodes of the first matched element.

innerXHTML()

innerXHTML() : string

Fetch child (inner) nodes of the first match.

This will return the children of the present match. For an example, see \innerHTML().

Returns

string —

Returns a string of XHTML that represents the children of the present node.

innerXML()

innerXML() : string

Fetch child (inner) nodes of the first match.

This will return the children of the present match. For an example, see \innerHTML().

Returns

string —

Returns a string of XHTML that represents the children of the present node.

innerHTML5()

innerHTML5()

Get child elements as an HTML5 string.

TODO: This is a very simple alteration of innerXML. Do we need better support?

textImplode()

textImplode(string  $sep = ', ', boolean$filterEmpties = TRUE) : string

Retrieve the text of each match and concatenate them with the given separator.

This has the effect of looping through all children, retrieving their text content, and then concatenating the text with a separator.

Parameters

 string $sep The string used to separate text items. The default is a comma followed by a space. boolean$filterEmpties If this is true, empty items will be ignored.

Returns

string —

The text contents, concatenated together with the given separator between every pair of items.

childrenText()

Returns

string —

The concatenated values of all children.

mixed —

A DOMQuery if $text is set, or the text content if no text is passed in as a pram. textBefore() textBefore(string$text = NULL) : mixed

Get or set the text before each selected item.

mixed —

 $text val() val(string$value = NULL) : mixed

Set or get the value of an element's 'value' attribute.

The 'value' attribute is common in HTML form elements. This is a convenience function for accessing the values. Since this is not common task on the server side, this method may be removed in future releases. (It is currently provided for jQuery compatibility.)

If a value is provided in the params, then the value will be set for all matches. If no params are given, then the value of the first matched element will be returned. This may be NULL.

 string $value Returns mixed — Returns a DOMQuery if a string was passed in, and a string if no string was passed in. In the later case, an error will produce NULL. xhtml() xhtml(string$markup = NULL) : mixed

Set or get XHTML markup for an element or elements.

This differs from \html() in that it processes (and produces) strictly XML 1.0 compliant markup.

Like \xml() and \html(), this functions as both a setter and a getter.

This is a convenience function for fetching HTML in XML format. It does no processing of the markup (such as schema validation).

 string $markup A string containing XML data. Returns mixed — If markup is passed in, a DOMQuery is returned. If no markup is passed in, XML representing the first matched element is returned. xml() xml(string$markup = NULL) : mixed

Set or get the XML markup for an element or elements.

Like \html(), this functions in both a setter and a getter mode.

In setter mode, the string passed in will be parsed and then appended to the elements wrapped by this DOMNode object.When in setter mode, this parses the XML using the DOMFragment parser. For that reason, an XML declaration is not necessary.

In getter mode, the first element wrapped by this DOMNode object will be converted to an XML string and returned.

 string $markup A string containing XML data. Returns mixed — If markup is passed in, a DOMQuery is returned. If no markup is passed in, XML representing the first matched element is returned. writeXML() writeXML(string$path = NULL, integer  $options = NULL) : \QueryPath\DOMQuery Send the XML document to the client. Write the document to a file path, if given, or to stdout (usually the client). This prints the entire document. Parameters  string$path The path to the file into which the XML should be written. if this is NULL, data will be written to STDOUT, which is usually sent to the remote browser. integer $options (As of QueryPath 2.1) Pass libxml options to the saving mechanism. Throws \QueryPath\Exception In the event that a file cannot be written, an Exception will be thrown. Returns \QueryPath\DOMQuery The DOMQuery object, unmodified. writeHTML() writeHTML(string$path = NULL) : \QueryPath\DOMQuery

Writes HTML to output.

HTML is formatted as HTML 4.01, without strict XML unary tags. This is for legacy HTML content. Modern XHTML should be written using \toXHTML().

Write the document to stdout (usually the client) or to a file.

 string $path The path to the file into which the XML should be written. if this is NULL, data will be written to STDOUT, which is usually sent to the remote browser. Throws \QueryPath\Exception In the event that a file cannot be written, an Exception will be thrown. Returns \QueryPath\DOMQuery The DOMQuery object, unmodified. writeHTML5() writeHTML5($path = NULL)

Write the document to HTML5.

This works the same as the other write* functions, but it encodes the output as HTML5 with UTF-8.

 $path Throws \QueryPath\Exception In the event that a file cannot be written, an Exception will be thrown. writeXHTML() writeXHTML(string$path = NULL) : \QueryPath\DOMQuery

Write an XHTML file to output.

Typically, you should use this instead of \writeHTML().

Currently, this functions identically to \toXML() except that it always uses closing tags (e.g. always @code@endcode, never @code