CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2011
    Posts
    6

    Talking Xml Schema Allows Inconsistencies

    When defining a simple type in XML Schema, such as a string enumeration, the facets that restrict the simple type can be inconsistent with respect to one another.

    For example, the one could define all the enumeration elements to be of length 2-3 but then also define the maxLength facet to be 4. (See below.)

    <xs:simpleType name="SalutationEnum">
    <xs:restriction base="xs:string">
    <xs:minLength value="4" />
    <xs:enumeration value="Mr" />
    <xs:enumeration value="Ms" />
    <xs:enumeration value="Mrs" />
    </xs:restriction>
    </xs:simpleType>

    Altova XML spy does not complain when validating the schema, however, there is obviously a problem.

    This complicates my code because now I have to check that all declared facets are self-consistent.

    I am not sure if the terminology I am using is correct but I think you will get the idea.

    Anyway, can someone suggest an easy way to check for these 'issues' when parsing the schema. I have reached a brain-lock state and can't move on!

    Thank you!!

  2. #2
    Join Date
    Jun 2011
    Posts
    6

    Re: Xml Schema Allows Inconsistencies

    Quote Originally Posted by tackyjan View Post
    ...define the maxLength facet to be 4..
    I don't see how to edit my original post so I will just respond to it.

    maxLength from my OP should be minLength .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured