W3C home > Mailing lists > Public > www-dom@w3.org > July to September 1998

New spec. Questions

From: Frank Boumphrey <bckman@ix.netcom.com>
Date: Wed, 22 Jul 1998 13:16:03 -0400
To: "Dom mailing list" <www-dom@w3.org>
Message-ID: <01bdb594$678998e0$a1addccf@bckman.ix.netcom.com>

I have just finished my first read of the core spec, and I would like to
congratulate the authors. Considering the difficulty of the subject it is
remarkably clear.

I  too was sad to see the iterators go, but there is no doubt that their
omission certainly diminishes the complexity of the spec!.

I have two quick questions, one concerning the apparent creation of orphans,
the other with adding text to an element.

When the document interface is used to create elements, text, and comments
etc. where do they go? At the moment of their creation they are orphans
without a parent, unless it be the document.

But in the following document

<greeting> Hello XML</greeting>

if I use


document.createTextNode("Hello DOM")

these presumably will be added on to the end of the document so that
temporarily we will have

<greeting> Hello XML</greeting>
Hello DOM

which is of course not a well-formed XML document.

I will of course later be able to use the Node interface methods
insertBefore() (Why no insertAfter()?) or appendChild() to put the second
greeting element where I want it.

Now the second question concerns how do I add  text to the element?

If the answer is with appendChild do I have two possible choices? i.e

greeting[1].appendChild("hello DOM")

or greeting[1].appendChild(text[1])

Now if I (probably inadvertently) use the first method, have I automatically
created another text node?

Would it not be better if you added to the element interface an
addNode([type],[value]) method

Could the document interface create*() method take an optional positioning
parameter (the default would be to append it to the document nodelist,
possibly an index.

Frank Boumphrey
XML and style sheet info at Http://www.hypermedic.com/style/index.htm
Author: - Professional Style Sheets for HTML and XML http://www.wrox.com
Received on Wednesday, 22 July 1998 13:10:22 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:04 UTC