Uploaded image for project: 'Axiom'
  1. Axiom
  2. AXIOM-232

XML Element lost when there is an OMException inside OMChildrenIterator.next()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.2.8
    • None
    • None
    • Windows

    Description

      I have this sample xml part (which is intentionally incorrect, containing duplicate attribute at third level):

      <Body>
      <Function>
      <Parameter attr='a' attr='a'>
      <abc/>
      </Parameter>
      </Function>
      </Body>

      So I generate an OMElement and try to serialize it using:

      String xml="<Body><Function><Parameter attr='a' attr='a'><abc/></Parameter></Function></Body>";
      ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
      XMLStreamReader parser;
      try

      { parser = XMLInputFactory.newInstance().createXMLStreamReader(bais); }

      catch (XMLStreamException e)

      { // TODO Auto-generated catch block } catch (FactoryConfigurationError e) { // TODO Auto-generated catch block }

      StAXOMBuilder builder = new StAXOMBuilder(parser);
      OMElement bodyElement = builder.getDocumentElement();
      bodyElement.serialize(System.out);

      ... but instead of receiving a duplicate attribute exception (which should probably happen in this case), I get the following output:

      <Body>
      <Function>
      <abc />
      </Function>
      </Body>

      The child element of <Parameter> has become a child element of its parent.
      Is this behaviour correct?

      Note: This bug may be related to this JIRA: http://issues.apache.org/jira/browse/WSCOMMONS-91. I looked at the AXIOM 1.2.5 source and it seems that the exception is actually thrown inside OMChildrenIterator.next(), but it is caught and a flag is set: isExceptionThrownInAdvancingToNextElement = true.

      Attachments

        Issue Links

          Activity

            People

              veithen Andreas Veithen
              bvmilanov Boris Milanov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: