xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Hodges <harmo...@swbell.net>
Subject RE: Yet another question about creating a Document
Date Thu, 19 Oct 2000 19:37:46 GMT


> -----Original Message-----
> From: Arnaud Le Hors [mailto:lehors@us.ibm.com]
> Sent: Thursday, October 19, 2000 12:46 PM
> To: general@xml.apache.org
> Subject: Re: Yet another question about creating a Document
>
>
> Eric Hodges wrote:
> >
> > Can anyone tell me why DOMImplementation.createDocument()
> creates an element
> > in the Document?  I can work around it by removing the element
> every time I
> > call this, but it makes me think I'm not using it correctly.
>
> Because it was thought that it would save the caller the trouble of
> doing it. Realize that if it didn't there would be people saying: "why
> doesn't it create the element for me since I always have to have one
> anyway?" ;-)

But those people can just add the element they need to add.  This doesn't
make any sense to me.  Why make some people remove a bogus element so others
won't have to add a useful element?

The implementation of createDocument() assumes too much about how it will be
used.

When I create other nodes, I don't have to supply their children.

>
> I personaly don't think either way is better than the other. There are
> times when one way will be better and times when it will be the other
> one.

I can't imagine why the current implementation would be better.  What is the
advantage of adding an element when the document is created?

>
> Why don't you simply start from the element that is created for you
> instead of throwing it away to put another one in place?

Because I don't know what the first element is going to be when I create the
document.  Just like I don't know what the doctype is going to be.

Do parsers just ignore the DOM API?  Or do they cache everything before they
start building the document?

Sorry for all the questions and gripes, I'm just sort of frustrated by DOM.
Nothing personal.


Mime
View raw message