error on appendChild

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 UTC