Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » XML schema "fixed" attribute and static final fields
XML schema "fixed" attribute and static final fields [message #76192] Tue, 11 November 2008 19:01 Go to next message
John T.E. Timm is currently offline John T.E. TimmFriend
Messages: 161
Registered: July 2009
Senior Member
I am having some issues with EMF 2.4 generating static final fields that
correspond to the "fixed" attribute in the schema definition. For example,
using this snippet my from XML Schema definition:

<xs:attribute name="classCode" type="RoleClass" use="optional"
default="BIRTHPL"/>

Under EMF 2.2, this is what gets generated:

protected static final Object CLASS_CODE_DEFAULT =
CDAR2Factory.eINSTANCE.createFromString(CDAR2Package.getRole Class(),
"BIRTHPL");
protected Object classCode = CLASS_CODE_DEFAULT;

Under EMF 2.4, this is what gets generated:

protected static final Object CLASS_CODE_DEFAULT; // TODO: the default
literal value "BIRTHPL" is not valid.
protected Object classCode = CLASS_CODE_DEFAULT;

which obviously fails compilation due to unassigned static final field.

What has changed between the two EMF versions that would cause this issue?
Is there a workaround?

Thanks,

JT
Re: XML schema "fixed" attribute and static final fields [message #76227 is a reply to message #76192] Tue, 11 November 2008 19:24 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
John,

Comments below.

John T.E. Timm wrote:
> I am having some issues with EMF 2.4 generating static final fields
> that correspond to the "fixed" attribute in the schema definition. For
> example, using this snippet my from XML Schema definition:
>
> <xs:attribute name="classCode" type="RoleClass" use="optional"
> default="BIRTHPL"/>
>
> Under EMF 2.2, this is what gets generated:
>
> protected static final Object CLASS_CODE_DEFAULT =
> CDAR2Factory.eINSTANCE.createFromString(CDAR2Package.getRole Class(),
> "BIRTHPL");
> protected Object classCode = CLASS_CODE_DEFAULT;
>
> Under EMF 2.4, this is what gets generated:
>
> protected static final Object CLASS_CODE_DEFAULT; // TODO: the default
> literal value "BIRTHPL" is not valid.
> protected Object classCode = CLASS_CODE_DEFAULT;
Probably I need to see more of the schema. What does RoleClass look
like? I wonder why its type would be java.lang.Object and not something
more specific...
>
> which obviously fails compilation due to unassigned static final field.
>
> What has changed between the two EMF versions that would cause this
> issue? Is there a workaround?
If you provide a test case I can use the reproduce the problem, I'll
look into it.
>
> Thanks,
>
> JT
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: XML schema "fixed" attribute and static final fields [message #76277 is a reply to message #76227] Tue, 11 November 2008 20:23 Go to previous message
John T.E. Timm is currently offline John T.E. TimmFriend
Messages: 161
Registered: July 2009
Senior Member
I can email you more of the schema and/or a working project/test case. Due
to licensing and copyright issues with the schema, this may be the best
option.

Thanks,

JT
Re: XML schema "fixed" attribute and static final fields [message #603436 is a reply to message #76192] Tue, 11 November 2008 19:24 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
John,

Comments below.

John T.E. Timm wrote:
> I am having some issues with EMF 2.4 generating static final fields
> that correspond to the "fixed" attribute in the schema definition. For
> example, using this snippet my from XML Schema definition:
>
> <xs:attribute name="classCode" type="RoleClass" use="optional"
> default="BIRTHPL"/>
>
> Under EMF 2.2, this is what gets generated:
>
> protected static final Object CLASS_CODE_DEFAULT =
> CDAR2Factory.eINSTANCE.createFromString(CDAR2Package.getRole Class(),
> "BIRTHPL");
> protected Object classCode = CLASS_CODE_DEFAULT;
>
> Under EMF 2.4, this is what gets generated:
>
> protected static final Object CLASS_CODE_DEFAULT; // TODO: the default
> literal value "BIRTHPL" is not valid.
> protected Object classCode = CLASS_CODE_DEFAULT;
Probably I need to see more of the schema. What does RoleClass look
like? I wonder why its type would be java.lang.Object and not something
more specific...
>
> which obviously fails compilation due to unassigned static final field.
>
> What has changed between the two EMF versions that would cause this
> issue? Is there a workaround?
If you provide a test case I can use the reproduce the problem, I'll
look into it.
>
> Thanks,
>
> JT
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: XML schema "fixed" attribute and static final fields [message #603451 is a reply to message #76227] Tue, 11 November 2008 20:23 Go to previous message
John T.E. Timm is currently offline John T.E. TimmFriend
Messages: 161
Registered: July 2009
Senior Member
I can email you more of the schema and/or a working project/test case. Due
to licensing and copyright issues with the schema, this may be the best
option.

Thanks,

JT
Previous Topic:Dealing with a set of large XML schemas
Next Topic:TODO: The default literal value "EnumMemberA" is invalid
Goto Forum:
  


Current Time: Thu Apr 25 22:50:02 GMT 2024

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

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

Back to the top