I am creating a XML using DOM as below using online examples,
DocumentBuilderFactory docfac= DocumentBuilderFactory.newInstance();
DocumentBuilder docb= docFactory.newDocumentBuilder();
Document doc = docb.newDocument();
// root
Element rootElement = (Element)doc.createElement("TEST");
doc.appendChild(rootElement); //Compiler error
...
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.