Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » TODO: The default literal value "EnumMemberA" is invalid
TODO: The default literal value "EnumMemberA" is invalid [message #603460] Thu, 13 November 2008 16:52
John T.E. Timm is currently offline John T.E. TimmFriend
Messages: 161
Registered: July 2009
Senior Member
I am having a problem with an attribute that is defined as fixed with a
simple type enumeration member:

<xs:attribute name="attr1" type="SimpleTypeA" fixed="EnumMemberA"/>

is generating:

protected static final Object ATTR1_EDEFAULT; // TODO The default value
literal "EnumMemberA" is not valid.
protected Object attr1 = ATTR1_EDEFAULT;

The causes a compilation error for unassigned static final field. I
believe that in the past (perhaps version EMF 2.2) it would have generated
this:

protected static final Object ATTR1_EDEFAULT =
ExampleFactory.eINSTANCE.createFromString(ExamplePackage.eIN STANCE.getSimpleTypeA(),
"EnumMemberA");
protected Object attr1 = ATTR1_EDEFAULT;

The full schema that was used for this example is:

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

<xs:simpleType name="SimpleBaseType">
<xs:restriction base="xs:token">
<xs:pattern value="[^\s]+"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="SimpleTypeA">
<xs:union memberTypes="SimpleTypeB SimpleTypeC"/>
</xs:simpleType>

<xs:simpleType name="SimpleTypeB">
<xs:restriction base="SimpleBaseType"/>
</xs:simpleType>

<xs:simpleType name="SimpleTypeC">
<xs:restriction base="SimpleBaseType">
<xs:enumeration value="EnumMemberA"/>
<xs:enumeration value="EnumMemberB"/>
<xs:enumeration value="EnumMemberC"/>
</xs:restriction>
</xs:simpleType>

<xs:complexType name="ComplexTypeA">
<xs:sequence>
<xs:element name="element1" type="xs:string"/>
<xs:element name="element2" type="xs:string"/>
</xs:sequence>
<xs:attribute name="attr1" type="SimpleTypeA" fixed="EnumMemberA"/>
</xs:complexType>

</xs:schema>

I am running Eclipse Ganymede 3.4.1 with EMF 2.4.1 on Windows XP SP3.

Thanks,

John
Previous Topic:XML schema "fixed" attribute and static final fields
Next Topic:Generated EObjectValidator class
Goto Forum:
  


Current Time: Thu Apr 25 17:34:42 GMT 2024

Powered by FUDForum. Page generated in 0.03297 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top