XML DOM createchild takes Node instread of Element

axioneenits

New Member
I am creating a XML using DOM as below using online examples,\[code\]DocumentBuilderFactory docfac= DocumentBuilderFactory.newInstance(); DocumentBuilder docb= docFactory.newDocumentBuilder(); Document doc = docb.newDocument(); // root Element rootElement = (Element)doc.createElement("TEST"); doc.appendChild(rootElement); //Compiler error...\[/code\]appenchild takes Node object, not Element object. I was trying to use Node but, it seems like there is no methods exposed to set attribute, therefore, I can't really use node.Any help would be really appreciate it.Thanks.
 
Back
Top