none
'unbounded' option in xmlschema

    Question

  • I have defined a XMLSchema.

    I get the following error when using the 'unbounded' option in maxOccurs.

    The value 'unbounded' is invalid according to its datatype 'Union'

     

    Also, using "any" inside "all" in xmlschema give following error:

    Element 'all' in namespace 'http://www.w3.org/2001/XMLSchema' has invalid child element 'any' in namespace 'http://www.w3.org/2001/XMLSchema'

     

    Part of my xmlschema is:

    <xs:element name="X">

    <xs:complexType>

    <xs:all>

    <xs:element ref="val1"/>

    <xs:element ref="option1" minOccurs="0" maxOccurs="unbounded"/>

    <xs:any minOccurs="0" maxOccurs="unbounded"/>

    </xs:all>

    <xs:attribute ref="myid"/>

    <xs:anyAttribute/>

    </xs:complexType>

    </xs:element>

     

    Any help will be appreciated...

    Thursday, August 28, 2008 9:59 AM

Answers

  • The error is shown in line

    <xs:element ref="option1" minOccurs="0" maxOccurs="unbounded"/>

    Exact error is: The 'maxOccurs' attribute is invalid - The value 'unbounded' is invalid according to its datatype 'Union - The enumeration constraint failed.

    The above error is shown for unbounded option.

     

    Also,

    the error The {max occurs} of all the particles in the {particles} of an all group must be 0 or 1 is shown on xs:element

     

    Hope this makes the problem more clearer. This error is shown when the XSD is opened in the editor and also when try to validate any xml file related to that.

    Thursday, August 28, 2008 12:25 PM

All replies

  • Well look at the definition for xs: all in the schema for schemas: http://www.w3.org/TR/xmlschema-1/#normative-schemaSchema and in the specification: http://www.w3.org/TR/xmlschema-1/#element-all. The allowed child elements are 0 or 1 'annotion' element and 0 or more 'element' elements. xs: any is not allowed in there.

     

    As for the other error message "The value 'unbounded' is invalid according to its datatype 'Union'"  please provide a minimal but complete schema that causes that error and tell us exactly which line causes that error and which application gives you that error.

    Thursday, August 28, 2008 12:13 PM
  • The error is shown in line

    <xs:element ref="option1" minOccurs="0" maxOccurs="unbounded"/>

    Exact error is: The 'maxOccurs' attribute is invalid - The value 'unbounded' is invalid according to its datatype 'Union - The enumeration constraint failed.

    The above error is shown for unbounded option.

     

    Also,

    the error The {max occurs} of all the particles in the {particles} of an all group must be 0 or 1 is shown on xs:element

     

    Hope this makes the problem more clearer. This error is shown when the XSD is opened in the editor and also when try to validate any xml file related to that.

    Thursday, August 28, 2008 12:25 PM
  • Then simply take the second error message into account which clearly states that the xs: all children only allow maxOccurs of 0 or 1 but not unbounded as you try to use. See the explanation of xs: all in the schema primer:

    http://www.w3.org/TR/xmlschema-0/#groups it gives an example of xs: all.
    Thursday, August 28, 2008 1:05 PM