$this->rules->
setTraverser($this);
} /**
* Tell the traverser to walk the DOM.
*
* @return resource $out Returns the output stream.
*/
public function walk() { if ($this->dom instanceof \DOMDocument
) { $this->rules->
document($this->dom
);
} elseif ($this->dom instanceof \DOMDocumentFragment
) { // Document fragments are a special case. Only the children need to
// be serialized.
if ($this->dom->
hasChildNodes()) { $this->
children($this->dom->childNodes
);
} } // If NodeList, loop
elseif ($this->dom instanceof \DOMNodeList
) { // If this is a NodeList of DOMDocuments this will not work.
$this->
children($this->dom
);
} // Else assume this is a DOMNode-like datastructure.