|
[
Permlink
| « Hide
]
Felix Röthenbacher added a comment - 05/Apr/05 12:17 AM
Patch for enabling namespace attribute inclusion.
The patch needs careful consideration. In a note to xalan-j-users David Bertoni wrote:
> > > That's because namespace declaration are represented in the data model as > namespaces nodes, not attribute nodes: > > > http://www.w3.org/TR/xpath#namespace-nodes > > Dave > I too have concerns about the patch. In a serialized XML document (a stream of characters, usually written to a file) namespace nodes appear as attributes, xmlns:prefix="someURI". But that doesn't mean that they actually ARE attributes in the data model. It seems to me with Felix suggested change that the DOM would have both a namespace node and an attribute for the prefix/uri mapping, and I'm not sure that having both is correct. >Comment by Brian Minchau [04/Apr/05 09:50 PM]
> >The patch needs careful consideration. In a note to xalan-j-users David Bertoni wrote: >> >> >> That's because namespace declaration are represented in the data model as >> namespaces nodes, not attribute nodes: >> >> >> http://www.w3.org/TR/xpath#namespace-nodes >> >> Dave >> > >I too have concerns about the patch. In a serialized XML document (a stream of characters, >usually written to a >file) namespace nodes appear as attributes, xmlns:prefix="someURI". >But that doesn't mean that they actually ARE attributes in the data model. It seems to me >with Felix suggested >change that the DOM would have both a namespace node and an attribute >for the prefix/uri mapping, and I'm not sure that having both is correct. If you are speaking about DOM and its relevant data model you have to look at its specification http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ especially the chapter about namespaces: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#Namespaces-Considerations where it states that "... As far as the DOM is concerned, special attributes used for declaring XML namespaces are still exposed and can be manipulated just like any other attribute. .." That means in words of the DOM API that you have a org.w3c.dom.Node object from the DOMResult produced by the transformation with its various node types. But, there is no namespace node type and namespace attributes are handled "... just like any other attribute". It's strange that the sources from Sun's JDK expose an implementation in that way (based on Xalan) but the current trunk does not. It looks like a regression happened here. It seems that this "feature" actually works with older Xalan versions, like for instance the one which is shipped with SUN JDK 1.4 (JDK 1.4 is packaged with an old version (2.2D11).
So it might have been removed on purpose from the recent versions and one needs to handle the namespaces differently, but if so, then how? Thanks Michi I think this is the same problem described in
I guess I should have pointed to XALANJ-762, since
Assigning to Christine Li per the JIRA triage on November 6, 2006.
A patch to fix the namespace nodes for DOMBuilder.
I have reviewed Christine's patch[1] and believe that it correctly resolves the problem.
[1] https://issues.apache.org/jira/secure/attachment/12344607/Patch.txt The patch has been checked in. Please verify the changes. Thanks,
Would the originator of this issue please verify that this issue is fixed in the 2.7.1 release, by adding a comment to this issue, so that we can close this issue.
A lack of response by February 1, 2008 will be taken as consent that we can close this resolved issue. Regards, Brian Minchau In my opinion there is still an issue with the implementation. Since startPrefixMapping() now changes the state of the DOMBuilder endPrefixMapping() must be implemented as well. The current implementation breaks at least when namespace prefixes are reassociated with a different namespace uri after the scope of the inner prefix mapping is left.
Any response to my last comment/concern?
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||