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