castor
  1. castor
  2. CASTOR-1676

Invalid schema generated with <xsd:all> containing element with maxOccurs unbounded value.

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Blocker Blocker
    • Resolution: Unresolved
    • Affects Version/s: 1.0.4
    • Fix Version/s: None
    • Component/s: XML
    • Labels:
      None
    • Environment:
      Windows Xp
    • Number of attachments :
      0

      Description

      I am generating schema from xml instance using the XMLInstance2Schema API.
      Schema st_schema =
      new XMLInstance2Schema().createSchema(l_reader_xmlInstance);

      The input XML instance is

      <CONTACT>
      <NAME index="1">a</NAME>
      <FAX index="1">a</FAX>
      <NAME index="1">a</NAME>
      <TELEPHONE index="1">a</TELEPHONE>
      </CONTACT>

      Generated schema is:

      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:element name="CONTACT">
      <xsd:complexType>
      <xsd:all>
      <xsd:element name="NAME" maxOccurs="unbounded">
      <xsd:complexType mixed="true">
      <xsd:sequence/>
      <xsd:attribute name="index" type="xsd:integer"/>
      </xsd:complexType>
      </xsd:element>
      <xsd:element name="FAX">
      <xsd:complexType mixed="true">
      <xsd:sequence/>
      <xsd:attribute name="index" type="xsd:integer"/>
      </xsd:complexType>
      </xsd:element>
      <xsd:element name="TELEPHONE">
      <xsd:complexType mixed="true">
      <xsd:sequence/>
      <xsd:attribute name="index" type="xsd:integer"/>
      </xsd:complexType>
      </xsd:element>
      </xsd:all>
      </xsd:complexType>
      </xsd:element>
      </xsd:schema>

      The generated schema contains <xsd:all> with <xsd:element name="NAME" maxOccurs="unbounded">.
      where as maxOccurs in <xsd:all> element does not allow unbounded as the value. maxOccurs in xsd:all element allows either 0 or 1 only.
      So schema validation is failing in my application.

      Please do favour ASAP and thanks in advance.

        Issue Links

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Adisesha Rao
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: