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