axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rich Scheuerle (JIRA)" <>
Subject [jira] Commented: (AXIS2-3376) XmlStreamParser in RMI module can encounter problems with nesting
Date Mon, 03 Dec 2007 17:04:43 GMT


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:

    <ns1:param2 xmlns:ns1="urn:org.apache.axis2.rmi.databind.dto">
        <ns1:param4>test String</ns1:param4>
    <ns2:param1 xmlns:ns2="urn:org.apache.axis2.rmi.databind.dto">
        <ns2:param3>test String</ns2:param3>
        <ns2:param1>6</ns2:param1>      <------------------ Note Nested element
    </ns2:param1>                                       <------------------ Followed
by outer element param1
    <ns3:param1 xmlns:ns3="urn:org.apache.axis2.rmi.databind.dto" xmlns:ns4=""
ns4:nil="1" />
    <ns5:param1 xmlns:ns5="urn:org.apache.axis2.rmi.databind.dto">
        <ns5:param3>test String</ns5:param3>

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)){

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)){

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 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:
>             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:
For additional commands, e-mail:

View raw message