sjsxp
  1. sjsxp
  2. SJSXP-15

Error in applying XSLT Transformer with StaXSource

    Details

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

      Operating System: All
      Platform: All

    • Issuezilla Id:
      15

      Description

      The problem arises only when then the XML document has a DOCTYPE declaration (as
      in <!DOCTYPE message PUBLIC "-//TSN//DTD Statistics 1.0/EN"
      "NCAA_Conference_Schedule_XML.dtd"> ).

      Compile and run under JDK 6.0 on both linux and windows with same results.

      Code follows:

      inputFactory.setProperty("javax.xml.stream.isSupportingExternalEntities",Boolean.TRUE);
      inputFactory.setProperty("javax.xml.stream.isNamespaceAware",Boolean.TRUE);

      inputFactory.setProperty("javax.xml.stream.isReplacingEntityReferences",Boolean.TRUE);
      inputFactory.setProperty("javax.xml.stream.supportDTD", Boolean.TRUE );
      inputFactory.setXMLResolver( new MyResolver() );

      // create a StaXSource for xsl and xml, StaXResult to hold result
      transformer.transform( xml, xmlresult);

      and throws a trace like:

      ERROR: 'ParseError at [row,col]:[3,1]
      Message: expected start or end tag'
      ERROR: 'com.sun.org.apache.xml.internal.utils.WrappedRuntimeException:
      ParseError at [row,col]:[3,1]
      Message: expected start or end tag'
      javax.xml.transform.TransformerException:
      javax.xml.transform.TransformerException:
      com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: ParseError at
      [row,col]:[3,1]
      Message: expected start or end tag
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:721)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)
      at com.atomica.nlp.answerbase.utils.stax.StaxPlusXsl.main(StaxPlusXsl.java:108)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
      Caused by: javax.xml.transform.TransformerException:
      com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: ParseError at
      [row,col]:[3,1]
      Message: expected start or end tag
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:548)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:711)
      ... 7 more
      Caused by: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException:
      ParseError at [row,col]:[3,1]
      Message: expected start or end tag
      at
      com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:326)
      at
      com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:234)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:526)
      ... 8 more
      ---------
      javax.xml.transform.TransformerException:
      com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: ParseError at
      [row,col]:[3,1]
      Message: expected start or end tag
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:548)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:711)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)
      at com.atomica.nlp.answerbase.utils.stax.StaxPlusXsl.main(StaxPlusXsl.java:108)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
      Caused by: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException:
      ParseError at [row,col]:[3,1]
      Message: expected start or end tag
      at
      com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:326)
      at
      com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:234)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:526)
      ... 8 more
      ---------
      com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: ParseError at
      [row,col]:[3,1]
      Message: expected start or end tag
      at
      com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:326)
      at
      com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:234)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:526)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:711)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)
      at com.atomica.nlp.answerbase.utils.stax.StaxPlusXsl.main(StaxPlusXsl.java:108)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
      ---------
      javax.xml.stream.XMLStreamException: ParseError at [row,col]:[3,1]
      Message: expected start or end tag
      at com.sun.xml.stream.XMLReaderImpl.nextTag(XMLReaderImpl.java:1196)
      at javax.xml.stream.util.StreamReaderDelegate.nextTag(StreamReaderDelegate.java:66)
      at
      com.atomica.nlp.answerbase.utils.IgnoreDtdDelegate.nextTag(IgnoreDtdDelegate.java:32)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.StAXStream2SAX.bridge(StAXStream2SAX.java:142)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.StAXStream2SAX.parse(StAXStream2SAX.java:120)
      at
      com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:318)
      at
      com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:234)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:526)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:711)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)
      at com.atomica.nlp.answerbase.utils.stax.StaxPlusXsl.main(StaxPlusXsl.java:108)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
      ---------
      com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: ParseError at
      [row,col]:[3,1]
      Message: expected start or end tag
      at
      com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:326)
      at
      com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:234)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:526)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:711)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)
      at com.atomica.nlp.answerbase.utils.stax.StaxPlusXsl.main(StaxPlusXsl.java:108)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
      ---------
      javax.xml.stream.XMLStreamException: ParseError at [row,col]:[3,1]
      Message: expected start or end tag
      at com.sun.xml.stream.XMLReaderImpl.nextTag(XMLReaderImpl.java:1196)
      at javax.xml.stream.util.StreamReaderDelegate.nextTag(StreamReaderDelegate.java:66)
      at
      com.atomica.nlp.answerbase.utils.IgnoreDtdDelegate.nextTag(IgnoreDtdDelegate.java:32)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.StAXStream2SAX.bridge(StAXStream2SAX.java:142)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.StAXStream2SAX.parse(StAXStream2SAX.java:120)
      at
      com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:318)
      at
      com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:234)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:526)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:711)
      at
      com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)
      at com.atomica.nlp.answerbase.utils.stax.StaxPlusXsl.main(StaxPlusXsl.java:108)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

      Process finished with exit code 0

      1. 5368141.xml
        16 kB
        toren03
      2. NCAA_Conference_Schedule_XML.dtd
        0.5 kB
        toren03

        Activity

        Hide
        Santiago Pericas-Geertsen added a comment -

        Assigning this one to Jeff.

        Show
        Santiago Pericas-Geertsen added a comment - Assigning this one to Jeff.
        Hide
        jeffsuttor added a comment -

        the Exception indicates that it is a parsing error.
        to best resolve this, can the actual XML document be attached?
        does the document parse stand-alone, e.g. w/o a transform?

        also, as a custom resolver is being used, could it be returning an error message
        that is being parsed v. dtd contents?

        Show
        jeffsuttor added a comment - the Exception indicates that it is a parsing error. to best resolve this, can the actual XML document be attached? does the document parse stand-alone, e.g. w/o a transform? also, as a custom resolver is being used, could it be returning an error message that is being parsed v. dtd contents?
        Hide
        toren03 added a comment -

        Created an attachment (id=5)
        Sample XML file

        Show
        toren03 added a comment - Created an attachment (id=5) Sample XML file
        Hide
        toren03 added a comment -

        Created an attachment (id=6)
        dtd for test document

        Show
        toren03 added a comment - Created an attachment (id=6) dtd for test document
        Hide
        Santiago Pericas-Geertsen added a comment -

        Re-assigning bug.

        Show
        Santiago Pericas-Geertsen added a comment - Re-assigning bug.
        Hide
        Santiago Pericas-Geertsen added a comment -

        Code in JAXP (not SJSXP) that bridges between StAX and SAX did not handle DTD events properly. This has
        been fixed in the JAXP RI (https://jaxp.dev.java.net).

        Show
        Santiago Pericas-Geertsen added a comment - Code in JAXP (not SJSXP) that bridges between StAX and SAX did not handle DTD events properly. This has been fixed in the JAXP RI ( https://jaxp.dev.java.net ).

          People

          • Assignee:
            Santiago Pericas-Geertsen
            Reporter:
            toren03
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: