membrane / soa-model

Toolkit and Java API for WSDL, WADL and XML Schema.
http://www.membrane-soa.org/soa-model/
Apache License 2.0
93 stars 73 forks source link

Schema compare does not find certain changes when refs are used #162

Closed ithena closed 10 years ago

ithena commented 10 years ago

When using refs instead of name+type for elements some differences between Schemas are not found. This due to the compare algorithm regularly using the comparison a.name == b.name. When refs are used a.name and b.name are both null.

The link provides two XSD files that when compared do not have any differences, while they contain several changes to the references.

https://www.dropbox.com/s/s4kat000mw99wga/RefStructChanges_v001.xsd https://www.dropbox.com/s/ubkjppodira3qn0/RefStructChanges_v002.xsd

Would it be a solution to have the name function of an element returning the ref in case name == null? Or would this cause undesired changes in other parts of the library?

ithena commented 10 years ago

@keshavarzi , Some of the Difference descriptions still exclusively use Element.name, resulting in descriptions like "Position of element null changed from 4 to 6."

ithena commented 10 years ago

The difference in a choice is not identified:

    <xsd:element name="AnotherComplex" type="AnotherComplexType"/>
    <xsd:complexType name="AnotherComplexType">
        <xsd:choice>
            <xsd:element minOccurs="0" ref="AlternativeEnterpriseNumber"/>
            <xsd:element minOccurs="0" ref="AlternativeEnterpriseIdentification"/>
        </xsd:choice>
    </xsd:complexType>
    <xsd:element name="AnotherComplex" type="AnotherComplexType"/>
    <xsd:complexType name="AnotherComplexType">
        <xsd:choice>
            <xsd:element minOccurs="0" ref="EnterpriseNumber"/>
            <xsd:element minOccurs="0" ref="EnterpriseIdentification"/>
        </xsd:choice>
    </xsd:complexType>
keshavarzi commented 10 years ago

@ithena please check the latest commit out and give a new try!

ithena commented 10 years ago

Seems to work correctly now. Thx!