Woodstox
  1. Woodstox
  2. WSTX-71

Improved handling of "asynchronous" (runtime) parsing exceptions

    Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      The way Woodstox throws runtime exceptions (due to limitations of stax api, some methods can not throw XMLStreamException; specifically getText() and its relatives) is sub-optimal, in that caller is probably not expecting a runtime exception. Although there are some work arounds (disable lazy parsing, or check root exception of the runtime exception, which should be embedded XMLStreamException), it'd be good to try to find a better way to deal with the problem.

      Specifically, for some types of parsing exceptions, it may actually be possible to defer throwing the exception, to be done when XMLStreamReader.next() is called next time. For example, when parsing textual content for CHARACTERS (or CDATA), and an error is encountered, it may be possible to return current contents, store exception and return. But next time next() is called, stored exception could be thrown. It's not clear yet how many of cases can be handled this way, but it should be investigated for 3.1.

        Activity

        Hide
        Tatu Saloranta added a comment -

        3.1.0 contains the basic support for such exceptions, and uses them for 2 specific problems (detecting invalid white space, encountering '][>' in textual content). I'll leave this open to track for more cases where it could (and should) be used.

        Show
        Tatu Saloranta added a comment - 3.1.0 contains the basic support for such exceptions, and uses them for 2 specific problems (detecting invalid white space, encountering '][>' in textual content). I'll leave this open to track for more cases where it could (and should) be used.

          People

          • Assignee:
            Tatu Saloranta
            Reporter:
            Tatu Saloranta
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: