I'm using spring java to parse an xml.
The xml contains the following element:
<component xmlns="">
<nonXMLBody classCode="DOCBODY" moodCode="EVN">
<text mediaType="application/pdf" representation="B64">zzz</text>
</nonXMLBody>
</component>
I need to remove the attribute xmlns=""
.
I'm have the following code but the attribute xmlns=""
is still there.
Document dom = null;
try {
dom = xmlDocBuilder.parse(inpSource);
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
NodeList nodeComponent = dom.getElementsByTagName("component");
Element element = (Element) nodeComponent.item(0);
element.removeAttribute("xmlns");