Project

Profile

Help

Support #3641

closed

XML validation via XSD does not handle conditionally required fields

Added by Cam Scofield almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Schema conformance
Sprint/Milestone:
-
Start date:
2018-01-23
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
9.8
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

when the 'requiredLevel' tag in an XSD file has a value of 'Conditionally Required' it is not properly validated against in the XML. Fields that would become required based on the value of another field and not being checked. I am providing XSD files, xml, and the output of the call to execute the saxon-EE call.


Files

comand data.txt (18.4 KB) comand data.txt command being executed and its output Cam Scofield, 2018-01-23 23:35
test_data.xml (4.8 KB) test_data.xml xml that should fail validation because the hasBatteries tag is marked 'yes', which should force another field to be present for pass validation Cam Scofield, 2018-01-23 23:35
xsds used for validation.zip (697 KB) xsds used for validation.zip these are the XSDs the xml is validating against Cam Scofield, 2018-01-23 23:35
Actions #1

Updated by Cam Scofield almost 7 years ago

Would like to set this as a HIGH priority. It is impeding daily work for our corporation. Feed back on this issue would much appreciated.

Actions #2

Updated by Michael Kay almost 7 years ago

  • Category set to Schema conformance
  • Priority changed from Low to Normal

Thanks for reporting it. I've run it and get the same results, that the instance document is valid.

Your schema contains xs:appInfo entries with declarations such as:

<xsd:appinfo>
            <wm:requiredLevel value="Conditionally Required"/>
            <wm:conditionalAttributes>
              <wm:conditionalAttributeGroup>
                <wm:conditionalAttribute name="hasBatteries" value="Yes"/>
              </wm:conditionalAttributeGroup>
            </wm:conditionalAttributes>
            <wm:displayName>Contained Battery Type</wm:displayName>
            <wm:group>Compliance</wm:group>
            <wm:rank>51000</wm:rank>
          </xsd:appinfo>

where the wm namespace is defined by xmlns:wm="http://walmart.com/". I've no idea what the semantics of these declarations are, but it's not something defined by the W3C specifications, and it's not something recognized by Saxon (schema processor ignore the contents of appInfo unless it's in a namespace that they explicitly recognize).

So as far as I can see, these schema documents are using some kind of proprietary extension to the W3C XSD syntax which Saxon does not recognize. (Therefore: no bug).

To define conditional constraints like this to work with Saxon you need to use the features of XSD 1.1 such as xs:assert and xs:conditionalContent.

Actions #3

Updated by Michael Kay almost 7 years ago

  • Status changed from New to AwaitingInfo
Actions #4

Updated by Cam Scofield almost 7 years ago

Thank you very much, we are grateful for your help. I believe that there is no reason to keep this issue open and that it be marked as resolved.

Actions #5

Updated by Michael Kay almost 7 years ago

  • Tracker changed from Bug to Support
  • Status changed from AwaitingInfo to Closed
  • Assignee set to Michael Kay

Please register to edit this issue

Also available in: Atom PDF