public function Query($node, $xml = false) { if ($xml) { $source = new XMLDom(); $dom_sxe = $source->importNode($xml, true); $source->appendChild($dom_sxe); } else { $source = $this; } $xpath = new DOMXPath($source); if (is_array($this->namespace)) { $xpath->registerNamespace($this->namespace['name'], $this->namespace['value']); } $return = $xpath->query($node); if (!$return) { return false; } elseif ($return->length == 0) { return false; } else { return $return; } }
public function toDOM() { $xml = new XMLDom(); $xml->appendChild($xml->importNode($this, true)); return $xml; }