New spec. Questions

Hi,

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

<xdoc>
<greeting> Hello XML</greeting>
</xdoc>

if I use

document.createElement(greeting)

document.createTextNode("Hello DOM")

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

<xdoc>
<greeting> Hello XML</greeting>
</xdoc>
<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