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