Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Serializing number formats requiring padding
Serializing number formats requiring padding [message #535789] Tue, 25 May 2010 16:03 Go to next message
Eclipse UserFriend
Originally posted by: Jo.Calder.m-ais.com

Hi,

I have a data type specified as follows:

<xsd:simpleType name="valAngleBrgBase">
<xsd:restriction base="xsd:decimal">
<xsd:minInclusive value="000"/>
<xsd:maxInclusive value="360"/>
<xsd:pattern value="\d{3}(\.\d{1,4}){0,1}"/>
</xsd:restriction>
</xsd:simpleType>

The use case is in representing compass bearings relative to north. For practical reasons, reflection as a numeric data
type (while not essential) is highly desirable.

When EMF serializes items of type valAngleBrgBase, the standard serialization of decimal number is used, and no leading
zeros are added for, say the value "31.5". As a consequence, EMF will serialize to schema-invalid documents. Is there
a method that can be overridden, or some eCore annotation available, to force serialization into the necessary format?

TIA, -- Jo Calder
Re: Serializing number formats requiring padding [message #535790 is a reply to message #535789] Tue, 25 May 2010 16:21 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Jo,

You'll need to specialize XyzFactoryImpl.convertValAngleBrgBaseToString.


Jo Calder wrote:
> Hi,
>
> I have a data type specified as follows:
>
> <xsd:simpleType name="valAngleBrgBase">
> <xsd:restriction base="xsd:decimal">
> <xsd:minInclusive value="000"/>
> <xsd:maxInclusive value="360"/>
> <xsd:pattern value="\d{3}(\.\d{1,4}){0,1}"/>
> </xsd:restriction>
> </xsd:simpleType>
>
> The use case is in representing compass bearings relative to north.
> For practical reasons, reflection as a numeric data type (while not
> essential) is highly desirable.
>
> When EMF serializes items of type valAngleBrgBase, the standard
> serialization of decimal number is used, and no leading zeros are
> added for, say the value "31.5". As a consequence, EMF will serialize
> to schema-invalid documents. Is there a method that can be
> overridden, or some eCore annotation available, to force serialization
> into the necessary format?
>
> TIA, -- Jo Calder
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Problem removing EMF element
Next Topic:[Teneo/EclipseLink]ORM file mixing up interfaces and implementation classes when mapping @EmbeddedId
Goto Forum:
  


Current Time: Thu Apr 25 02:05:21 GMT 2024

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

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

Back to the top