dgis / xsddiagram

XSD Diagram is a free Xml Schema Definition (XSD) diagram viewer for Windows written in c# Framework.NET 2.0
http://regis.cosnier.free.fr/?page=XSDDiagram&nomenu
GNU General Public License v2.0
225 stars 52 forks source link

Fixed min/maxOccurs for group references. #6

Closed Cleric-K closed 9 years ago

Cleric-K commented 9 years ago

Let's consider the schema:

<?xml version="1.0"?>
<xs:schema version="1.0"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           elementFormDefault="qualified">

    <xs:group name="grp" >
        <xs:sequence>
            <xs:element name="el" />
        </xs:sequence>
    </xs:group>

    <xs:element name="root">
        <xs:complexType>
            <xs:group ref="grp" minOccurs="7" maxOccurs="12" />
        </xs:complexType>
    </xs:element>
</xs:schema>

Currently if we add the root element to the diagram and expand it, the grp element is rendered as having minOccurs=1 and maxOccurs=1 - these are the default values and they are taken from the definition of the group. But this is incorrect because the values should be taken from the tag with the ref attribute. Furthermore it is illegal to have these attributes at the group definition.

Corrections are made in Diagram.AddCompositors() in the same way that the problem is already avoided in Diagram.AddElement()

dgis commented 9 years ago

Thank you very much!