xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott_B...@lotus.com
Subject Re: Potential Xerces regression (bug# 933)
Date Mon, 12 Mar 2001 15:47:51 GMT

> Possibly involved in this issue: The DOM Level 2 createDocument call
> creates the root element at the same time, and you really aren't supposed
> to be able to change the root element later. (For various reasons related
> to allowing DOMs to subclass themselves intelligently based on the kind
of
> document they're processing.) So in theory, you shouldn't be calling
> newDocument until you know what the root element is going to be.

God help me.  You're right.  Can you feel my pain?  (Yes, I'm sure there
were good reasons...)  Interesting... so there is essentially no way to
pass in a  new document that was created via
DOMImplementation#createDocument to a transformation and have the output
appended to the DocumentNode, and no other way in the pure DOM API to
create a Document.  Um, Joe, Arnaud, you might take this as feedback to the
WG... I see this as a problem.  Don Leslie, we need to get to work on this
as a FAQ item.

But DocumentBuilder#newDocument does not accept a element name as an
argument, and does not document that it creates a root Element, so it
should not do this.  And, because of the limitations of the DOM API, it
should not do this, since it is the only implementation-independent way to
create a clean Document node.

In truth, I think there is a mismatch problem between JAXP 1.1 and the DOM.

-scott



                                                                                         
                            
                    Joseph_Kesselman                                                     
                            
                    @lotus.com              To:     xalan-dev@xml.apache.org             
                            
                                            cc:     general@xml.apache.org, xalan-dev@xml.apache.org,
                
                    03/12/2001 10:13        xerces-j-dev@xml.apache.org, (bcc: Scott Boag/CAM/Lotus)
                 
                    AM                      Subject:     Re: Potential Xerces regression (bug#
933)                   
                    Please respond                                                       
                            
                    to xalan-dev                                                         
                            
                                                                                         
                            
                                                                                         
                            





>Anyway, someone is poorly mistaken if they think
>that newDocument() should create a magic root node.  I hope this can be
>fixed as soon as possible.

Possibly involved in this issue: The DOM Level 2 createDocument call
creates the root element at the same time, and you really aren't supposed
to be able to change the root element later. (For various reasons related
to allowing DOMs to subclass themselves intelligently based on the kind of
document they're processing.) So in theory, you shouldn't be calling
newDocument until you know what the root element is going to be.

(Yes, this is a nuisance for parsers and other DOMBuilders; they have to
cache comments and PIs and such until the root element has been seen. We're
considering alternative approaches.)

I would suspect that someone was trying to cheat past this by creating a
dummy root element that they never intended to expose to the outside world,
and then creating the "real" root under that...






---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message