jaxp
  1. jaxp
  2. JAXP-67

StAXEvent2SAX.handleEndElement() iterates over Namespaces as Strings

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: Macintosh

    • Issuezilla Id:
      67

      Description

      In StAXEvent2SAX.handleEndElement(), line 357, an iterator is created that iterates over the namespaces of the Stax EndElement. The namespaces are
      casted to Strings, while the javadoc for EndElement clearly states that the returned iterator iterates over javax.xml.stream.events.Namespace objects. See
      http://download.oracle.com/javase/6/docs/api/javax/xml/stream/events/EndElement.html#getNamespaces()

      Needless to say, this results in ClassCastExceptions, for instance when used with the Woodstox Stax implementation, version 3.2.9.

        Activity

        Hide
        poutsma added a comment -

        Here is a little code snippet that reproduces this bug:

        String xml = "<root xmlns='http://springframework.org'><child>Foo</child></root>";
        XMLInputFactory inputFactory = XMLInputFactory.newInstance();
        XMLEventReader eventReader = inputFactory.createXMLEventReader(new StringReader(xml));

        Transformer transformer = TransformerFactory.newInstance().newTransformer();

        transformer.transform(new StAXSource(eventReader), new StreamResult(System.out));

        Show
        poutsma added a comment - Here is a little code snippet that reproduces this bug: String xml = "<root xmlns='http://springframework.org'><child>Foo</child></root>"; XMLInputFactory inputFactory = XMLInputFactory.newInstance(); XMLEventReader eventReader = inputFactory.createXMLEventReader(new StringReader(xml)); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform(new StAXSource(eventReader), new StreamResult(System.out));
        Hide
        poutsma added a comment -

        This bug also occurs with the Stax RI.

        Show
        poutsma added a comment - This bug also occurs with the Stax RI.

          People

          • Assignee:
            jaxp-issues
            Reporter:
            poutsma
          • Votes:
            3 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: