sjsxp
  1. sjsxp
  2. SJSXP-9

Can't parse document with doctype declaration without retrieving the DTD

    Details

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

      Operating System: All
      Platform: All

    • Issuezilla Id:
      9

      Description

      I have set XMLInputFactory.SUPPORT_DTD to Boolean.FALSE as the DTD for the data
      I need to parse contains no information and would slow down things too much. But
      now I get this error message:

      Doctype declaration is not allowed.
      at com.sun.xml.stream.XMLReaderImpl.next(XMLReaderImpl.java:571)

      Is this a bug or a feature? None of the other StaX parsers I have tested so far
      had this behavior...

        Activity

        Hide
        Santiago Pericas-Geertsen added a comment -

        There is no technical reason for the error to be reported. It is simply a stricter interepretation of the spec
        (which as in other areas is not very detailed). I'll evaluate this further, but in principle, it wouldn't be
        difficult to relax this and understand supportDTD as a hint more than a requirement.

        Show
        Santiago Pericas-Geertsen added a comment - There is no technical reason for the error to be reported. It is simply a stricter interepretation of the spec (which as in other areas is not very detailed). I'll evaluate this further, but in principle, it wouldn't be difficult to relax this and understand supportDTD as a hint more than a requirement.
        Hide
        Santiago Pericas-Geertsen added a comment -

        Lowering priority of this issue because this appears to be a gray are in the spec. The recommended
        behavior is being evaluated.

        Show
        Santiago Pericas-Geertsen added a comment - Lowering priority of this issue because this appears to be a gray are in the spec. The recommended behavior is being evaluated.
        Hide
        tuomas_kiviaho added a comment -

        Created an attachment (id=4)
        Workaround to ignore external DTD completely

        Show
        tuomas_kiviaho added a comment - Created an attachment (id=4) Workaround to ignore external DTD completely
        Hide
        Santiago Pericas-Geertsen added a comment -

        Proposed behavior now implemented. The parser does not report an error if a DTD
        is found. Moreover, external DTDs are not resolved. If an internal subset is
        present, it will be parsed (and errors can occur during this process) but no
        events will be reported to the application.

        The latest build

        https://sjsxp.dev.java.net/servlets/ProjectDocumentList?folderID=5120&expandFolder=5120&folderID=5120

        should have the fix.

        Show
        Santiago Pericas-Geertsen added a comment - Proposed behavior now implemented. The parser does not report an error if a DTD is found. Moreover, external DTDs are not resolved. If an internal subset is present, it will be parsed (and errors can occur during this process) but no events will be reported to the application. The latest build https://sjsxp.dev.java.net/servlets/ProjectDocumentList?folderID=5120&expandFolder=5120&folderID=5120 should have the fix.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: