XSDEcoreBuilder, Validation [message #905456] |
Thu, 30 August 2012 12:18 |
Eclipse User |
|
|
|
Hello,
I'm using XSDEcoreBuilder load an XSD schema as Ecore meta model.
In the schema there is the following type:
<xs:complexType name="myType">
<xs:complexContent>
<xs:extension base="myOtherType">
<xs:choice>
<xs:element name="e1" type="e1" minOccurs="1" maxOccurs="1"/>
<xs:element name="e2" type="e2" minOccurs="1" maxOccurs="1"/>
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
By some automated process I create a model according to this meta model.
A flaw in that generation caused an object of myType to be created which
does neither contain an e1 or e2 element. I should say this is a model
violation, but
status = Diagnostician.INSTANCE.validate(o);
did not complain but returned Diagnostic.OK! Why is that? I tried to
apply the information in "XML Schema to Ecore Mapping" (2004) but could
not find the "exclusion" annotation in the generated model. I'm on
Eclipse 4.2.
After saving the resource, the XML output looked like this:
<myType/> <------ invalid!
<myType>
<e1/>
</myType>
<myType>
<e2/>
</myType>
An external XSD validator emitted a warning about this.
TIA
Marius
|
|
|
|
Re: XSDEcoreBuilder, Validation [message #905467 is a reply to message #905460] |
Thu, 30 August 2012 12:37 |
Eclipse User |
|
|
|
Hello Ed,
thanks for the quick response. Seems like I was hunting a ghost.
On 30.08.2012 14:24, Ed Merks wrote:
>> I tried to
>> apply the information in "XML Schema to Ecore Mapping" (2004) but could
>> not find the "exclusion" annotation in the generated model.
> There isn't one.
I think I missed the little hint "Note: implementation of this is
TBD"... :-)
> At this point, the best you can do declare a constraint on the EClass
> and implement it by hand.
All right then. For now we run a full blown XSD validator on the XML
output, so I think we're fine.
Regards
Marius
|
|
|
Powered by
FUDForum. Page generated in 0.03257 seconds