@@ 795-807 (lines=13) @@ | ||
792 | $this->registerNamespace($namespace->prefix, $namespace->nodeValue); |
|
793 | } |
|
794 | } |
|
795 | else { |
|
796 | $this->default_ns = $namespace->nodeValue; |
|
797 | if (is_string($auto_register_namespaces)) { |
|
798 | $this->registerNamespace($auto_register_namespaces, $namespace->nodeValue); |
|
799 | } |
|
800 | // Otherwise, automatically set-up the root element tag name as the prefix for the default namespace |
|
801 | else { |
|
802 | $tagname = $this->documentElement->tagName; |
|
803 | if (empty($this->ns[$tagname])) { |
|
804 | $this->registerNamespace($tagname, $this->documentElement->getAttribute('xmlns')); |
|
805 | } |
|
806 | } |
|
807 | } |
|
808 | } |
|
809 | ||
810 | // If it's an "HTML" document, we get namespaces via attributes |
|
@@ 816-825 (lines=10) @@ | ||
813 | if ($attr->name == 'xmlns') { |
|
814 | $this->default_ns = $attr->value; |
|
815 | // If auto_register_namespaces is a prefix string, then we register the default namespace to that string |
|
816 | if (is_string($auto_register_namespaces)) { |
|
817 | $this->registerNamespace($auto_register_namespaces, $attr->value); |
|
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, $attr->value); |
|
824 | } |
|
825 | } |
|
826 | } |
|
827 | else if (substr($attr->name,0,6) == 'xmlns:') { |
|
828 | $prefix = substr($attr->name,6); |