@@ 787-799 (lines=13) @@ | ||
784 | $this->registerNamespace($namespace->prefix, $namespace->nodeValue); |
|
785 | } |
|
786 | } |
|
787 | else { |
|
788 | $this->default_ns = $namespace->nodeValue; |
|
789 | if (is_string($auto_register_namespaces)) { |
|
790 | $this->registerNamespace($auto_register_namespaces, $namespace->nodeValue); |
|
791 | } |
|
792 | // Otherwise, automatically set-up the root element tag name as the prefix for the default namespace |
|
793 | else { |
|
794 | $tagname = $this->documentElement->tagName; |
|
795 | if (empty($this->ns[$tagname])) { |
|
796 | $this->registerNamespace($tagname, $this->documentElement->getAttribute('xmlns')); |
|
797 | } |
|
798 | } |
|
799 | } |
|
800 | } |
|
801 | ||
802 | // If it's an "HTML" document, we get namespaces via attributes |
|
@@ 808-817 (lines=10) @@ | ||
805 | if ($attr->name == 'xmlns') { |
|
806 | $this->default_ns = $attr->value; |
|
807 | // If auto_register_namespaces is a prefix string, then we register the default namespace to that string |
|
808 | if (is_string($auto_register_namespaces)) { |
|
809 | $this->registerNamespace($auto_register_namespaces, $attr->value); |
|
810 | } |
|
811 | // Otherwise, automatically set-up the root element tag name as the prefix for the default namespace |
|
812 | else { |
|
813 | $tagname = $this->documentElement->tagName; |
|
814 | if (empty($this->ns[$tagname])) { |
|
815 | $this->registerNamespace($tagname, $attr->value); |
|
816 | } |
|
817 | } |
|
818 | } |
|
819 | else if (substr($attr->name,0,6) == 'xmlns:') { |
|
820 | $prefix = substr($attr->name,6); |