dizzzz / jing-trang

Automatically exported from code.google.com/p/jing-trang
Other
0 stars 0 forks source link

Invalid schema generated from XML input containing recursive type #189

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
trang generates this invalid schema for the XML input below:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified">
  <xs:element name="a">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" ref="b"/>
        <xs:element minOccurs="0" ref="a"/>    <!-- mistake on this line -->
        <xs:element minOccurs="0" ref="c"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="b" type="xs:string"/>
  <xs:element name="c" type="xs:string"/>
</xs:schema>

XML:

<a>
    <b>some text</b>
    <a>
        <c>some other text</c>
    </a>
    <a/>
</a>

The problem is on line 7 in the schema, which says that type <a> may occur at 
most once in the sequence, whereas the XML input has two <a>s inside the 
top-level <a> element.

Original issue reported on code.google.com by melgam...@webalo.com on 13 Nov 2014 at 3:34