I am working with org.w3c.xml java library and encountering a few difficulties performing a few tasks:
- I have an Element object; how can I remove namespaces from it and the predecessors?
How can I create a Document without the namespaces? I have tried
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); docBuilderFactory.setNamespaceAware(false); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); Document doc = docBuilder.parse (new File("C:/Temp/XMLFiles/"+fileName+".xml"));
Although it looks promising, it does not really work. I am still getting the doc with namespaces.
How do I create a document from an Element?
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); doc.adoptNode(dataDefinition);
where dataDefinition is an element, but it didn't work; what am I doing wrong?