JiBX
  1. JiBX
  2. JIBX-18

Tolerate unexpected elements

    Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.0-beta3a
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None
    • Environment:
      JDK 1.4.2
    • Number of attachments :
      0

      Description

      JiBX beta3a creates unmarshalling code which tolerates deviations from an ideal XML document described by the binding.

      So far so good.

      This tolerance however, is bound to unexpected attributes found in a tag. It should ignore an unexpected element (and all its childs) until it sees an expected element again. It should only throw an exception if it does not see all expected elements.

      It is normal that somebody adds content to XML and JiBX-generated code should not fail afterwards.

        Activity

        Hide
        Thomas Will added a comment -

        I totally agree, it is very common that XML structures are enhanced. I just had this case and the existing generated JiBX code did not work anymore.
        It would be nice, if this feature could be enabled at least at the level of a binding element.

        Show
        Thomas Will added a comment - I totally agree, it is very common that XML structures are enhanced. I just had this case and the existing generated JiBX code did not work anymore. It would be nice, if this feature could be enabled at least at the level of a binding element.
        Hide
        Chris Chen added a comment -

        I was wondering if this is possibly going to be implemented in the next major version update (or perhaps, dare i say it, in the CVS head). I am currently having exactly this problem and of course would prefer that unknown elements are skipped and ignored through some sort of binding file configuration option.

        Show
        Chris Chen added a comment - I was wondering if this is possibly going to be implemented in the next major version update (or perhaps, dare i say it, in the CVS head). I am currently having exactly this problem and of course would prefer that unknown elements are skipped and ignored through some sort of binding file configuration option.
        Hide
        Dennis Sosnoski added a comment -

        It's a requirement for 2.0. This actually requires a lot of complexity behind the scenes, when you consider optional elements. JiBX has to figure out for each point in the unmarshalling a list of possible next elements that it knows about, then loop through discarding input elements until one of the elements on the list is found. It then has to process that element. I've got techniques in mind which should handle this without much impact on performance for normal cases, but don't want to try building them around the current code generation.

        Show
        Dennis Sosnoski added a comment - It's a requirement for 2.0. This actually requires a lot of complexity behind the scenes, when you consider optional elements. JiBX has to figure out for each point in the unmarshalling a list of possible next elements that it knows about, then loop through discarding input elements until one of the elements on the list is found. It then has to process that element. I've got techniques in mind which should handle this without much impact on performance for normal cases, but don't want to try building them around the current code generation.
        Hide
        Dennis Sosnoski added a comment -

        As of 1.1 beta4, you can now have JiBX automatically ignore unknown elements within unordered groups (by using the flexible="true" attribute on the containing element of the binding definition). This is still just for unordered groups, which is why I'm leaving the issue open. However, unordered groups now allow required elements, which removes one of the earlier major drawbacks in using unordered groups.

        Show
        Dennis Sosnoski added a comment - As of 1.1 beta4, you can now have JiBX automatically ignore unknown elements within unordered groups (by using the flexible="true" attribute on the containing element of the binding definition). This is still just for unordered groups, which is why I'm leaving the issue open. However, unordered groups now allow required elements, which removes one of the earlier major drawbacks in using unordered groups.
        Hide
        darsh added a comment -

        We are also facing similar issues with extra tags. flexible="true" is helpful to some extent

        Show
        darsh added a comment - We are also facing similar issues with extra tags. flexible="true" is helpful to some extent

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            Falk Langhammer
          • Votes:
            5 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated: