Jump to content

Problem with maxOccurs!


rcccubs

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 comment
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 comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...