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