|
Re: EMF support for block [message #655646 is a reply to message #655170] |
Tue, 22 February 2011 06:21 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Rob,
There's no support for block.
Rob wrote:
> Another edge case :)
> I have a schema that looks like the following
>
> <xsd:complexType name="coreIdentifier" block="#all">
> <xsd:sequence>
> <xsd:element name="surname" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:complexType name="enhancedIdentifier">
> <xsd:complexContent>
> <xsd:extension base="ns1:coreIdentifier">
> <xsd:sequence>
> <xsd:element name="firstname" type="xsd:string"/>
> </xsd:sequence>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
> <xsd:complexType name="Household">
> <xsd:sequence>
> <xsd:element name="family" type="ns1:coreIdentifier"/>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:element name="myBaseInfo" type="ns1:coreIdentifier"/>
> <xsd:element name="myFullInfo" type="ns1:enhancedIdentifier"/>
> <xsd:element name="myHousehold" type="ns1:Household"/>
>
> The code is generated fine, however with the use of block="#all" a
> user would
> normally expect it not to be possible to do the following:
>
> EnhancedIdentifier createenhancedIdentifier =
> ComplexBlockFactory.eINSTANCE.createEnhancedIdentifier();
> createenhancedIdentifier.setFirstname("Barney");
> createenhancedIdentifier.setSurname("Rubble");
>
> Household createHousehold =
> ComplexBlockFactory.eINSTANCE.createHousehold();
> createHousehold.setFamily(createenhancedIdentifier);
>
> As the "block" would prevent any coreIdentifier element being set with
> anything other than another coreIdentifier (i.e. nothing that extends
> coreIdentifier)
>
> Unfortunately, this does not fail on validate either, and it can also
> read in invalid XML OK.
>
> I have had a look at the ecore generated from this XSD and it does not
> appear to include anything to highlight
> the existance of the block.
>
> I have also investigated the use of block on elements:
>
> <xsd:complexType name="Household">
> <xsd:sequence>
> <xsd:element name="family" type="ns1:coreIdentifier"
> block="#all"/>
> </xsd:sequence>
> </xsd:complexType>
>
> And this appears to behave in the same way.
>
> Am I correct in assuming that this is one of the edge cases that EMF
> does not support, or have I miss-configured my system?
>
> Thanks, Rob
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03735 seconds