Index: library/Zend/Dom/Query.php =================================================================== --- library/Zend/Dom/Query.php (revision 24554) +++ library/Zend/Dom/Query.php (working copy) @@ -124,6 +124,10 @@ } // breaking XML declaration to make syntax highlighting work if ('<' . '?xml' == substr(trim($document), 0, 5)) { + if (preg_match('/\?'.'>\s+]*xmlns="([^"]+)"[^>]*>/i', $document, $matches)) { + $this->_xpathNamespaces[] = $matches[1]; + return $this->setDocumentXhtml($document, $encoding); + } return $this->setDocumentXml($document, $encoding); } if (strstr($document, 'DTD XHTML')) {