AXIOM DOM based org.w3c.dom.Element.getElementsByTagName and
getElementsByTagNameNS do not funcion according to spec
--------------------------------------------------------------------------------------------------------------------
Key: WSCOMMONS-255
URL: https://issues.apache.org/jira/browse/WSCOMMONS-255
Project: WS-Commons
Issue Type: Bug
Components: AXIOM
Reporter: Gennady Shumakher
The w3c spec states:
getElementsByTagName
Returns a NodeList of all the Elements with a given tag name in the order
in which they would be encountered in a preorder traversal of the Document tree.
It looks that current implementation of
org.apache.axiom.om.impl.dom.ElementImpl looks only at the 1st level of
children and not through the tree.
Here is the code snippet
//Instantiate and parse soap message with AXIOM DOM
DocumentBuilderFactoryImpl.setDOOMRequired(true);
Document doc
=DocumentBuilderFactoryImpl.newInstance().newDocumentBuilder().parse(new
FileInputStream(SOAP_EXAMPLE_XML));
nl = doc.getDocumentElement().getElementsByTagName("return");
System.out.println("AXIOM DOM XML Parser found " +
nl.getLength() + " element(s)"); //AXIOM DOM XML Parser found 0 element(s)
// Instantiate and parse document with xerces
System.getProperties().setProperty("javax.xml.parsers.DocumentBuilderFactory",
"org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
DocumentBuilderFactory dbf =
DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
doc = dbf.newDocumentBuilder().parse(new
FileInputStream(SOAP_EXAMPLE_XML));
nl = doc.getDocumentElement().getElementsByTagName("return");
System.out.println("XERCES XML Parser found " + nl.getLength()
+ " element(s)"); // XERCES XML Parser found found 1 element(s)
SOAP_EXAMPLE_XML.file:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<xsd:startSessionResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<return xsi:type="xsd:string">sessionID</return>
</xsd:startSessionResponse>
</soapenv:Body>
</soapenv:Envelope>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]