#64 org.custommonkey.xmlunit.jaxp13.Validator Bug

Java 1.6
closed-fixed
None
3
2014-12-29
2014-04-16
Jamie Townsend
No

Bug when validating xml file against a schema provided by the xml file itself.

Attached is a Maven Project with test cases that show the javax.xml validation working correctly, where the XMLUnit validation does not.

1 Attachments

Discussion

  • Stefan Bodewig
    Stefan Bodewig
    2014-12-09

    Somehow this issue never appeared on my radar, likely since it has been assigned to Jeff directly.

     
  • Stefan Bodewig
    Stefan Bodewig
    2014-12-09

    • assigned_to: Jeff Martin --> Stefan Bodewig
    • Group: Java 2.x --> Java_1.4
     
  • Stefan Bodewig
    Stefan Bodewig
    2014-12-09

    The main difference between your code with XMLUnit und the one without is that XMLUnit uses javax.xml.validation.Validator rather than parsing the document. It seems as if Validator needs to know all Schema sources when validate is invoked and cannot pull in additional sources by itself unlike the SAXParser approach.

    I found this here http://www.ibm.com/developerworks/xml/library/x-javaxmlvalidapi/index.html#N100D0

    So it looks as if this was an all or nothing approach. Either you specify all of your schema sources or none. Unfortunately newSchema with an empty array of sources creates something different from the no-arg version.

    I'll experiment a little but things may end up just getting documented.

     
  • Stefan Bodewig
    Stefan Bodewig
    2014-12-09

    using svn revision 569 this seems to work if you do not specify a schema at all, I still need to document it, update the user guide and cut a new release.

    https://sourceforge.net/p/xmlunit/code/569/

     
    Last edit: Stefan Bodewig 2014-12-09
  • Stefan Bodewig
    Stefan Bodewig
    2014-12-14

    I took your test project and had to perform a few modifications, in particual I had to add schemaLocations for http://schemas.xmlsoap.org/soap/envelope/ and ensured there is no schema source at all when you don't want to specify one.

    It works with what will be XMLUnit 1.6 - and XMLUnit seems to find problems the parser approach doesn't detect, for example

    KundeStandardService_v1.1-sucheKundeSoapRequest.xml; lineNumber: 8; columnNumber: 53; cvc-maxInclusive-valid: Value '1' is not facet-valid with respect to maxInclusive '0' for type '#AnonType_minorVersionCommonHeaderAttributesType'

    (the line number is probably off due to my changes).

     
  • Stefan Bodewig
    Stefan Bodewig
    2014-12-14

    • status: open --> pending-fixed
    • Group: Java_1.4 --> Java 1.6
     
  • Stefan Bodewig
    Stefan Bodewig
    2014-12-14

    documented with svn revision 577.

     
  • Stefan Bodewig
    Stefan Bodewig
    2014-12-29

    • status: pending-fixed --> closed-fixed