W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2000

error on appendChild

From: CLECH Armelle FTRD/DMI/LAN <armelle.clech@rd.francetelecom.fr>
Date: Wed, 22 Nov 2000 10:43:15 +0100
Message-ID: <CDE201D3CAB3D411955B00062938239E44236C@l-mhs2.lannion.cnet.fr>
To: www-dom@w3.org
I am kind of lost here.
my code is the following. I have a
[test] org.apache.xerces.dom.DOMExceptionImpl: DOM006 Hierarchy request
error
[test] org.apache.xerces.dom.DOMExceptionImpl: DOM006 Hierarchy request
error
on the appendChild call in insertFragment method. If I remove this two lines
It works really fine.
Can anyone help please .

main
{
	DocumentImpl docum = new DocumentImpl();

	DocumentFragment
docC=requeteCollecte.cpgnCreation(array,dateModif,docum);
	// I create the fragment with this method : DocumentFragment doc =
docum.createDocumentFragment();

	Document doc = requeteCollecte.insertFragment(docC,docum);
}

    public Document insertFragment(DocumentFragment fragment, Document doc)
    {
	if(doc!=null)
	    {
		Element element = doc.createElement("creation");
		doc.appendChild(element);
		NodeList list = fragment.getChildNodes();
		if(list!=null)
		    {
			for(int i=0;i<list.getLength();i++)
			    {
				doc.appendChild(list.item(i));
			    }
		    }
		NamedNodeMap att = fragment.getAttributes();
		if(att!=null)
		    {
			for(int j=0;j<att.getLength();j++)
			    {
				doc.appendChild(att.item(j));
			    }
		    }
	    }
	return doc;
    }


Armelle Clech
Received on Wednesday, 22 November 2000 04:46:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:48 GMT