[
https://issues.apache.org/jira/browse/AXIS2-3376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12547899
]
Rich Scheuerle commented on AXIS2-3376:
---------------------------------------
Summary of the problem:
If the xml being parsed has nested elements of the same name, the
XmlStreamParser gets confused.
Here is an example message:
<Param1>
<ns1:param2 xmlns:ns1="urn:org.apache.axis2.rmi.databind.dto">
<ns1:param4>test String</ns1:param4>
<ns1:param3>3.0</ns1:param3>
<ns1:param2>45.6</ns1:param2>
<ns1:param1>2</ns1:param1>
</ns1:param2>
<ns2:param1 xmlns:ns2="urn:org.apache.axis2.rmi.databind.dto">
<ns2:param4>5.56</ns2:param4>
<ns2:param3>test String</ns2:param3>
<ns2:param2>2</ns2:param2>
<ns2:param2>3</ns2:param2>
<ns2:param1>5</ns2:param1>
<ns2:param1>6</ns2:param1> <------------------ Note Nested element
param1
</ns2:param1> <------------------
Followed by outer element param1
<ns3:param1 xmlns:ns3="urn:org.apache.axis2.rmi.databind.dto"
xmlns:ns4="http://www.w3.org/2001/XMLSchema-instance" ns4:nil="1" />
<ns5:param1 xmlns:ns5="urn:org.apache.axis2.rmi.databind.dto">
<ns5:param4>5.56</ns5:param4>
<ns5:param3>test String</ns5:param3>
<ns5:param2>2</ns5:param2>
<ns5:param2>3</ns5:param2>
<ns5:param1>5</ns5:param1>
<ns5:param1>6</ns5:param1>
</ns5:param1>
</Param1>
In XmlStreamParser, line223 where this error is one place that this is
occurring. Note that this will premature advance the parser because it has the
same name.
// if the reader is at the end of this elementField
// then we move it to next element.
if (reader.isEndElement() &&
reader.getName().equals(elementFieldQName)){
reader.next();
}
Brian's solution is to wrap the parser in a lightweidht XMLStreamReader that
simply provides the depth stack. Then XmlStreamParser has sufficient
information to properly know when to call next:
if (reader.isEndElement() && reader.getName().equals(parameterQName)){
if (reader.isEndElement() &&
reader.getName().equals(parameterQName)
&& (readerPriorAccess || reader.getDepth() ==
startDepth - 1)){
reader.next();
}
I don't necessarily like the name "Stateful" XmlReader is simply the name he
chose to name this XMLStreamReader that exposes the depth stack.
Brian has supplied a testcase that demonstrates the error...plus the fix. I
will integrate this code after I complete some more testing
> XmlStreamParser in RMI module can encounter problems with nesting
> -----------------------------------------------------------------
>
> Key: AXIS2-3376
> URL: https://issues.apache.org/jira/browse/AXIS2-3376
> Project: Axis 2.0 (Axis2)
> Issue Type: Bug
> Components: modules
> Reporter: Brian Murray
> Assignee: Rich Scheuerle
> Attachments: 3376.patch, test.patch
>
>
> The XmlStreamParser in the RMI module does not support nesting when the
> subelement has the same namespace URI and name as the parent element. The
> parser currently makes assumptions based on the name of the current tag and
> errs when the folllowing is encountered: </param1></param1>. I will provide
> a failing test case in a patch. I will also provide another patch with the
> failing test case and a correction to XmlStreamParser.
--
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]