Do DOM implementations fix up namespaces?
When elements or attributes which have namespace prefixes are moved, it’s possible that the prefix no longer matches the same namespace URI. The DOM is always internally consistent, since each node carries its own namespace URI. It may or may not contain all the namespace declaration attributes in the right places, or have the prefixes matched up properly if those declarations do exist. The DOM is departing from canonical form, just a bit, in part because the DOM WG was concerned that continuously enforcing those restrictions could impose a significant amount of overhead. But it should contain all the data needed to allow reconciliation of those departures. If you think about this as a namespace_normalize() operation, it may make more sense. In Level 2, that normalization task is left as an exercise for the reader, but Level 3 is expected to provide a standardized version.
When elements or attributes which have namespace prefixes are moved, it’s possible that the prefix no longer matches the same namespace URI. The DOM is always internally consistent, since each node carries its own namespace URI. It may or may not contain all the namespace declaration attributes in the right places, or have the prefixes matched up properly if those declarations do exist. The DOM is departing from canonical form, just a bit, in part because the DOM WG was concerned that continuously enforcing those restrictions could impose a significant amount of overhead. But it should contain all the data needed to allow reconciliation of those departures. If you think about this as a namespace_normalize() operation, it may make more sense. In Level 2, that normalization task is left as an exercise for the reader, but Level 3 is expected to provide a standardized version.
When elements or attributes which have namespace prefixes are moved, it’s possible that the prefix no longer matches the same namespace URI. The DOM is always internally consistent, since each node carries its own namespace URI. It may or may not contain all the namespace declaration attributes in the right places, or have the prefixes matched up properly if those declarations do exist. The DOM is departing from canonical form, just a bit, in part because the DOM WG was concerned that continuously enforcing those restrictions could impose a significant amount of overhead. But it should contain all the data needed to allow reconciliation of those departures. If you think about this as a namespace_normalize() operation, it may make more sense. In Level 2, that normalization task is left as an exercise for the reader, but Level 3 is expected to provide a standardized version.