Hi,

I've a problem :
I want to manipulate a DOM tree !! I got a Documentand I'd want to add
Element and Text .... When I "create" and add a node, it works, but when I
create a "Text" node, here is the error message :
     Exception in thread "main" java.lang.ClassCastException
               at Wrapper.Repondre(Wrapper.java, Compiled Code)
               at Wrapper.main(Wrapper.java, Compiled Code)

I've a DOM tree with empty Elements .... so I'd like to add the Content of
these elements :

public static Document Answer(Document docXML)
     {
          Document docXML2 = docXML;
          NodeList NL = doc2XML.getElementsByTagName("Entite");
          Node NoeudEntite = NL.item(0);
          Node NoeudRech = (NoeudEntite.getParentNode());
               Node Noeud = NoeudEntite.cloneNode(true);
                    Text text=((Text)Noeud.getFirstChild());
                    text.setData("here is the content of my element !!");
                    Noeud.appendChild((Node)text);
               NoeudRech.appendChild(Noeud);
          NoeudRech.removeChild(NoeudEntite);
          return docXML2;
     }

Could anybody help me ??

Thank you in advance !!


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

Reply via email to