Jump to content

Problem with maxOccurs!

Recommended Posts

Help! My schema looks pretty much like this(only longer):<?xml version="1.0" encoding="ISO-8859-1"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"><xs:simpleType name="title"> <xs:restriction base="xs:string"/></xs:simpleType><xs:simpleType name="cell"> <xs:restriction/></xs:simpleType><xs:complexType name="head"> <xs:sequence> <xs:element name="title" type="title" maxOccurs="1"/> <xs:element name="cell" type="cell"/> </xs:sequence></xs:complexType><xs:complexType name="row"> <xs:sequence> <xs:element type="cell" maxOccurs="Unbounded"/> </xs:sequence></xs:complexType><xs:element name="head" type="head" maxOccurs="1"/><xs:element name="row" type="row" maxOccurs="unbounded"/></xs:schema>When I enter this in the XML schema validator (http://www.w3.org/2001/03/webdata/xsv), it says:docElt: {http://www.w3.org/2001/XMLSchema}schema Validation was strict, starting with type [Anonymous] The schema(s) used for schema-validation had no errors 3 schema-validity problems were found in the target --------------------------------------------------------------------------------Problems with the schema-validity of the targetfile:/usr/local/XSV/xsvlog/tmpQOdQeNuploaded:22:7: Invalid per cvc-attribute.1.2: attribute type check failed for {None}:maxOccurs: Unbounded no members of union succeeded: not in enumeration [unbounded]; is not a valid decimal literalfile:/usr/local/XSV/xsvlog/tmpQOdQeNuploaded:27:1: Invalid per cvc-complex-type.1.3: undeclared attribute {None}:maxOccursfile:/usr/local/XSV/xsvlog/tmpQOdQeNuploaded:28:1: Invalid per cvc-complex-type.1.3: undeclared attribute {None}:maxOccursWhat, exactly, am I doing wrong? I assume it has something to do with the maxOccurs indicator.

Link to post
Share on other sites

maxOccurs must be applied to contextual element declarations, not global ones. Any global element declaration is assumed to be a possible root element, and therefore be present zero or one times.You need a third element that will hold those in some kind of a complex type form (say, sequence?), and you can specify within that context the maxOccurs of those elements.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...