@@ 814-826 (lines=13) @@ | ||
811 | $this->registerNamespace($namespace->prefix, $namespace->nodeValue); |
|
812 | } |
|
813 | } |
|
814 | else { |
|
815 | $this->default_ns = $namespace->nodeValue; |
|
816 | if (is_string($auto_register_namespaces)) { |
|
817 | $this->registerNamespace($auto_register_namespaces, $namespace->nodeValue); |
|
818 | } |
|
819 | // Otherwise, automatically set-up the root element tag name as the prefix for the default namespace |
|
820 | else { |
|
821 | $tagname = $this->documentElement->tagName; |
|
822 | if (empty($this->ns[$tagname])) { |
|
823 | $this->registerNamespace($tagname, $this->documentElement->getAttribute('xmlns')); |
|
824 | } |
|
825 | } |
|
826 | } |
|
827 | } |
|
828 | ||
829 | // If it's an "HTML" document, we get namespaces via attributes |
|
@@ 835-844 (lines=10) @@ | ||
832 | if ($attr->name == 'xmlns') { |
|
833 | $this->default_ns = $attr->value; |
|
834 | // If auto_register_namespaces is a prefix string, then we register the default namespace to that string |
|
835 | if (is_string($auto_register_namespaces)) { |
|
836 | $this->registerNamespace($auto_register_namespaces, $attr->value); |
|
837 | } |
|
838 | // Otherwise, automatically set-up the root element tag name as the prefix for the default namespace |
|
839 | else { |
|
840 | $tagname = $this->documentElement->tagName; |
|
841 | if (empty($this->ns[$tagname])) { |
|
842 | $this->registerNamespace($tagname, $attr->value); |
|
843 | } |
|
844 | } |
|
845 | } |
|
846 | else if (substr($attr->name,0,6) == 'xmlns:') { |
|
847 | $prefix = substr($attr->name,6); |