Discussion:
Message Element initialization
Hassan Khan
2018-01-12 16:45:01 UTC
Permalink
Hi,

I was reading a xml file that has the body of my soap message as below, but
look like the initialization to messageElement put a "xmlns:rim="" on all
values. Is there a way to specify the namespace so it does not put that ?

DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
FileInputStream fstreamRequest = new FileInputStream(new
File("C:\\test\\request.xml"));
// Read XML File
String xml = IOUtils.toString(new FileInputStream(new
File("C:\\test\\request.xml")), "UTF-8");
InputSource is = new InputSource(new StringReader(xml));
// Parse XML String to DOM
factory.setNamespaceAware(true);
factory.setIgnoringComments(true);
XMLDoc = builder.parse(is);

//XMLDoc =
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new
File("C:\\test\\request.xml"));
org.w3c.dom.Element element = XMLDoc.getDocumentElement();

m[0] = new MessageElement(element);


Thanks
--
Hassan Khan
Loading...