Subject: XML DOM Q: understanding namespace nodes From: keshlam@xxxxxxxxxx Date: Fri, 17 Dec 1999 09:43:50 -0500 |
> I was trying out Khun Yee Fung's XPathTool and am noticing it only >lists namespace nodes where they are declared. I can't address that tool, but I can address the DOM. Important point before we start: Remember that the official position of the Namespace folks is that the namespace prefix is only "syntactic sugar", and that the Namespace URI is its real "name"; some of them have argued that prefixes should not be visible to programs at all, and that users should not assume that an XML document when written out will have the same prefixes, declared at the same places, that it did when it was read in. The DOM WG attempted to compromise between that view and the desire that programs be able to avoid making completely gratuitous changes to the document. Hence: DOM Level 2 performs "early binding" of namespaces to elements and attributes. The namespaceURI is set at the time namespaced nodes are created and can not be changed thereafter. As far as the DOM is concerned, the prefix field of a node is just retained as a hint for serialization; it _can_ be changed, but changing it has no effect on the node's identity. Note that the DOM does not currently enforce namespace well-formedness; if you start with attributes foo:x and bar:x, and change both their prefixes to baz, that may make trouble when you attempt to serialize the document back to XML syntax but it's perfectly legal as far as DOM Level 2 is concerned. The DOM treats namespace declarations as ordinary Attributes, appearing on a single node. They are not "inherited". (Inheritance was considered, but was deemed inappropriate in an early-binding model. If you want to know what was defined by your ancestors, look upward.) Parsers are expected to recognize them as they go by and use that information to set the namespaceURI field properly on nodes with that prefix created at or below that point in the tree. DOM Level 2 does not provide any built-in mechanism for looking up the association between prefixes and their declared URIs. It's fairly likely that Level 3's "content model" chapter, which also addresses namespace well-formedness checking, will define such a lookup. It was deferred largely because the early-binding behavior makes the exact definition of this lookup somewhat less well defined, we didn't have an answer ready in time for Level 2's release. Reminder: DOM Level 2 is currently in Candidate Recommendation phase. You still have a few more weeks in which to start building a prototype and tell us whether anything is underspecified, incomplete garbled, or impossible to implement efficiently. (Note that quibbles with the architecture should have been submitted before Last Call ended; the question now on the table is whether folks can really build and use what we've described.) After that, assuming no show-stoppers arise, we go to PR and voting begins. ______________________________________ Joe Kesselman / IBM Research XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: XML DOM Q: understanding namesp, Kay Michael | Thread | RE: XML DOM Q: understanding namesp, Khun Yee Fung |
RE: <xsl:copy-of> question, Hunter, David | Date | RE: text() children, Pawson, David |
Month |