Dear Jeff,

I read the responses to your question out of order and your question
already got answered, but just in case it did not here it is (again?).

| <?xml version="1.0" encoding="UTF-8"?>
> | <database>
> | 
> |   <element>
> 
> I have a button ('New') which was intended to insert a new 'element'
> node to the tree.  Are you saying this isn't possible?

You have
        doc.appendChild( frag );

That would try to add the element as a next sibling of database, so not
'in it'. So you are attempting to construct
        <database>
                ....
        </database>
        <element>
                ....
        </element>
but a document may only have one root element, hence the hierarchy
error.

So what you want is
        doc.getDocumentElement().appendChild( frag );
to make the new element a child of the database element. And there is
really no need to use a document fragment here, you can remove the
document fragment code and simply do
        doc.getDocumentElement().appendChild( element );

Kind regards,

--Sander.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to