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