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