Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Hook to modify how xsd:double is serialized by XMLResource
Hook to modify how xsd:double is serialized by XMLResource [message #987235] Sat, 24 November 2012 20:40 Go to next message
David Rees is currently offline David ReesFriend
Messages: 47
Registered: September 2012
Member
Could someone point me to where I can hook into how the XSD types are serialized by XMLResource? I am specifically interested in modifying how xsd:double types are written.

Right now, even if they have no fractional portion it still puts a ".0" at the end. For example:
<MYFLOAT>7.0</MYFLOAT>
<MYFLOAT>0.0</MYFLOAT>


For consistency with external tools we are integrating with I would prefer it to not add the .0 when there is no fractional portion. For example:
<MYFLOAT>7</MYFLOAT>
<MYFLOAT>0</MYFLOAT>

Thanks,
dave
Re: Hook to modify how xsd:double is serialized by XMLResource [message #987244 is a reply to message #987235] Sun, 25 November 2012 06:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Dave,

This is done in, like for any other EDataType, in the generated factory
for that data type. In this case in
org.eclipse.emf.ecore.xml.type.impl.XMLTypeFactoryImpl.convertDoubleToString(EDataType,
Object). You can't specialize that class, but if you create your own
specialized EDataType, i.e., if you define your own derived
xsd:simpleType, you'll have your own factory method you can specialize.


On 24/11/2012 9:40 PM, David Rees wrote:
> Could someone point me to where I can hook into how the XSD types are
> serialized by XMLResource? I am specifically interested in modifying
> how xsd:double types are written.
>
> Right now, even if they have no fractional portion it still puts a
> ".0" at the end. For example:
> <MYFLOAT>7.0</MYFLOAT>
> <MYFLOAT>0.0</MYFLOAT>
>
>
> For consistency with external tools we are integrating with I would
> prefer it to not add the .0 when there is no fractional portion. For
> example:
> <MYFLOAT>7</MYFLOAT>
> <MYFLOAT>0</MYFLOAT>
>
> Thanks,
> dave
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Hook to modify how xsd:double is serialized by XMLResource [message #987245 is a reply to message #987235] Sun, 25 November 2012 06:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Dave,

This is done in, like for any other EDataType, in the generated factory
for that data type. In this case in
org.eclipse.emf.ecore.xml.type.impl.XMLTypeFactoryImpl.convertDoubleToString(EDataType,
Object). You can't specialize that class, but if you create your own
specialized EDataType, i.e., if you define your own derived
xsd:simpleType, you'll have your own factory method you can specialize.


On 24/11/2012 9:40 PM, David Rees wrote:
> Could someone point me to where I can hook into how the XSD types are
> serialized by XMLResource? I am specifically interested in modifying
> how xsd:double types are written.
>
> Right now, even if they have no fractional portion it still puts a
> ".0" at the end. For example:
> <MYFLOAT>7.0</MYFLOAT>
> <MYFLOAT>0.0</MYFLOAT>
>
>
> For consistency with external tools we are integrating with I would
> prefer it to not add the .0 when there is no fractional portion. For
> example:
> <MYFLOAT>7</MYFLOAT>
> <MYFLOAT>0</MYFLOAT>
>
> Thanks,
> dave
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Hook to modify how xsd:double is serialized by XMLResource [message #987246 is a reply to message #987235] Sun, 25 November 2012 06:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Dave,

This is done in, like for any other EDataType, in the generated factory
for that data type. In this case in
org.eclipse.emf.ecore.xml.type.impl.XMLTypeFactoryImpl.convertDoubleToString(EDataType,
Object). You can't specialize that class, but if you create your own
specialized EDataType, i.e., if you define your own derived
xsd:simpleType, you'll have your own factory method you can specialize.


On 24/11/2012 9:40 PM, David Rees wrote:
> Could someone point me to where I can hook into how the XSD types are
> serialized by XMLResource? I am specifically interested in modifying
> how xsd:double types are written.
>
> Right now, even if they have no fractional portion it still puts a
> ".0" at the end. For example:
> <MYFLOAT>7.0</MYFLOAT>
> <MYFLOAT>0.0</MYFLOAT>
>
>
> For consistency with external tools we are integrating with I would
> prefer it to not add the .0 when there is no fractional portion. For
> example:
> <MYFLOAT>7</MYFLOAT>
> <MYFLOAT>0</MYFLOAT>
>
> Thanks,
> dave
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Hook to modify how xsd:double is serialized by XMLResource [message #987247 is a reply to message #987235] Sun, 25 November 2012 06:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Dave,

This is done in, like for any other EDataType, in the generated factory
for that data type. In this case in
org.eclipse.emf.ecore.xml.type.impl.XMLTypeFactoryImpl.convertDoubleToString(EDataType,
Object). You can't specialize that class, but if you create your own
specialized EDataType, i.e., if you define your own derived
xsd:simpleType, you'll have your own factory method you can specialize.


On 24/11/2012 9:40 PM, David Rees wrote:
> Could someone point me to where I can hook into how the XSD types are
> serialized by XMLResource? I am specifically interested in modifying
> how xsd:double types are written.
>
> Right now, even if they have no fractional portion it still puts a
> ".0" at the end. For example:
> <MYFLOAT>7.0</MYFLOAT>
> <MYFLOAT>0.0</MYFLOAT>
>
>
> For consistency with external tools we are integrating with I would
> prefer it to not add the .0 when there is no fractional portion. For
> example:
> <MYFLOAT>7</MYFLOAT>
> <MYFLOAT>0</MYFLOAT>
>
> Thanks,
> dave
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Hook to modify how xsd:double is serialized by XMLResource [message #987248 is a reply to message #987235] Sun, 25 November 2012 06:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Dave,

This is done in, like for any other EDataType, in the generated factory
for that data type. In this case in
org.eclipse.emf.ecore.xml.type.impl.XMLTypeFactoryImpl.convertDoubleToString(EDataType,
Object). You can't specialize that class, but if you create your own
specialized EDataType, i.e., if you define your own derived
xsd:simpleType, you'll have your own factory method you can specialize.


On 24/11/2012 9:40 PM, David Rees wrote:
> Could someone point me to where I can hook into how the XSD types are
> serialized by XMLResource? I am specifically interested in modifying
> how xsd:double types are written.
>
> Right now, even if they have no fractional portion it still puts a
> ".0" at the end. For example:
> <MYFLOAT>7.0</MYFLOAT>
> <MYFLOAT>0.0</MYFLOAT>
>
>
> For consistency with external tools we are integrating with I would
> prefer it to not add the .0 when there is no fractional portion. For
> example:
> <MYFLOAT>7</MYFLOAT>
> <MYFLOAT>0</MYFLOAT>
>
> Thanks,
> dave
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Hook to modify how xsd:double is serialized by XMLResource [message #987249 is a reply to message #987235] Sun, 25 November 2012 06:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Dave,

This is done in, like for any other EDataType, in the generated factory
for that data type. In this case in
org.eclipse.emf.ecore.xml.type.impl.XMLTypeFactoryImpl.convertDoubleToString(EDataType,
Object). You can't specialize that class, but if you create your own
specialized EDataType, i.e., if you define your own derived
xsd:simpleType, you'll have your own factory method you can specialize.


On 24/11/2012 9:40 PM, David Rees wrote:
> Could someone point me to where I can hook into how the XSD types are
> serialized by XMLResource? I am specifically interested in modifying
> how xsd:double types are written.
>
> Right now, even if they have no fractional portion it still puts a
> ".0" at the end. For example:
> <MYFLOAT>7.0</MYFLOAT>
> <MYFLOAT>0.0</MYFLOAT>
>
>
> For consistency with external tools we are integrating with I would
> prefer it to not add the .0 when there is no fractional portion. For
> example:
> <MYFLOAT>7</MYFLOAT>
> <MYFLOAT>0</MYFLOAT>
>
> Thanks,
> dave
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Hook to modify how xsd:double is serialized by XMLResource [message #987250 is a reply to message #987235] Sun, 25 November 2012 06:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Dave,

This is done in, like for any other EDataType, in the generated factory
for that data type. In this case in
org.eclipse.emf.ecore.xml.type.impl.XMLTypeFactoryImpl.convertDoubleToString(EDataType,
Object). You can't specialize that class, but if you create your own
specialized EDataType, i.e., if you define your own derived
xsd:simpleType, you'll have your own factory method you can specialize.


On 24/11/2012 9:40 PM, David Rees wrote:
> Could someone point me to where I can hook into how the XSD types are
> serialized by XMLResource? I am specifically interested in modifying
> how xsd:double types are written.
>
> Right now, even if they have no fractional portion it still puts a
> ".0" at the end. For example:
> <MYFLOAT>7.0</MYFLOAT>
> <MYFLOAT>0.0</MYFLOAT>
>
>
> For consistency with external tools we are integrating with I would
> prefer it to not add the .0 when there is no fractional portion. For
> example:
> <MYFLOAT>7</MYFLOAT>
> <MYFLOAT>0</MYFLOAT>
>
> Thanks,
> dave
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Hook to modify how xsd:double is serialized by XMLResource [message #987251 is a reply to message #987235] Sun, 25 November 2012 06:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Dave,

This is done in, like for any other EDataType, in the generated factory
for that data type. In this case in
org.eclipse.emf.ecore.xml.type.impl.XMLTypeFactoryImpl.convertDoubleToString(EDataType,
Object). You can't specialize that class, but if you create your own
specialized EDataType, i.e., if you define your own derived
xsd:simpleType, you'll have your own factory method you can specialize.


On 24/11/2012 9:40 PM, David Rees wrote:
> Could someone point me to where I can hook into how the XSD types are
> serialized by XMLResource? I am specifically interested in modifying
> how xsd:double types are written.
>
> Right now, even if they have no fractional portion it still puts a
> ".0" at the end. For example:
> <MYFLOAT>7.0</MYFLOAT>
> <MYFLOAT>0.0</MYFLOAT>
>
>
> For consistency with external tools we are integrating with I would
> prefer it to not add the .0 when there is no fractional portion. For
> example:
> <MYFLOAT>7</MYFLOAT>
> <MYFLOAT>0</MYFLOAT>
>
> Thanks,
> dave
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Hook to modify how xsd:double is serialized by XMLResource [message #987252 is a reply to message #987235] Sun, 25 November 2012 06:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Dave,

This is done in, like for any other EDataType, in the generated factory
for that data type. In this case in
org.eclipse.emf.ecore.xml.type.impl.XMLTypeFactoryImpl.convertDoubleToString(EDataType,
Object). You can't specialize that class, but if you create your own
specialized EDataType, i.e., if you define your own derived
xsd:simpleType, you'll have your own factory method you can specialize.


On 24/11/2012 9:40 PM, David Rees wrote:
> Could someone point me to where I can hook into how the XSD types are
> serialized by XMLResource? I am specifically interested in modifying
> how xsd:double types are written.
>
> Right now, even if they have no fractional portion it still puts a
> ".0" at the end. For example:
> <MYFLOAT>7.0</MYFLOAT>
> <MYFLOAT>0.0</MYFLOAT>
>
>
> For consistency with external tools we are integrating with I would
> prefer it to not add the .0 when there is no fractional portion. For
> example:
> <MYFLOAT>7</MYFLOAT>
> <MYFLOAT>0</MYFLOAT>
>
> Thanks,
> dave
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Hook to modify how xsd:double is serialized by XMLResource [message #987253 is a reply to message #987235] Sun, 25 November 2012 06:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Dave,

This is done in, like for any other EDataType, in the generated factory
for that data type. In this case in
org.eclipse.emf.ecore.xml.type.impl.XMLTypeFactoryImpl.convertDoubleToString(EDataType,
Object). You can't specialize that class, but if you create your own
specialized EDataType, i.e., if you define your own derived
xsd:simpleType, you'll have your own factory method you can specialize.


On 24/11/2012 9:40 PM, David Rees wrote:
> Could someone point me to where I can hook into how the XSD types are
> serialized by XMLResource? I am specifically interested in modifying
> how xsd:double types are written.
>
> Right now, even if they have no fractional portion it still puts a
> ".0" at the end. For example:
> <MYFLOAT>7.0</MYFLOAT>
> <MYFLOAT>0.0</MYFLOAT>
>
>
> For consistency with external tools we are integrating with I would
> prefer it to not add the .0 when there is no fractional portion. For
> example:
> <MYFLOAT>7</MYFLOAT>
> <MYFLOAT>0</MYFLOAT>
>
> Thanks,
> dave
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Hook to modify how xsd:double is serialized by XMLResource [message #987254 is a reply to message #987235] Sun, 25 November 2012 06:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Dave,

This is done in, like for any other EDataType, in the generated factory
for that data type. In this case in
org.eclipse.emf.ecore.xml.type.impl.XMLTypeFactoryImpl.convertDoubleToString(EDataType,
Object). You can't specialize that class, but if you create your own
specialized EDataType, i.e., if you define your own derived
xsd:simpleType, you'll have your own factory method you can specialize.


On 24/11/2012 9:40 PM, David Rees wrote:
> Could someone point me to where I can hook into how the XSD types are
> serialized by XMLResource? I am specifically interested in modifying
> how xsd:double types are written.
>
> Right now, even if they have no fractional portion it still puts a
> ".0" at the end. For example:
> <MYFLOAT>7.0</MYFLOAT>
> <MYFLOAT>0.0</MYFLOAT>
>
>
> For consistency with external tools we are integrating with I would
> prefer it to not add the .0 when there is no fractional portion. For
> example:
> <MYFLOAT>7</MYFLOAT>
> <MYFLOAT>0</MYFLOAT>
>
> Thanks,
> dave
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Hook to modify how xsd:double is serialized by XMLResource [message #987276 is a reply to message #987244] Sun, 25 November 2012 15:26 Go to previous messageGo to next message
David Rees is currently offline David ReesFriend
Messages: 47
Registered: September 2012
Member
Thanks Ed

I should have mentioned in my original post that I am using dynamic EMF, so I have no generated code to modify. Is there still a hook, perhaps to override the "dynamic object" factory where I can check the type being serialized and catch it there?

Thanks,
dave

Ed Merks wrote on Sun, 25 November 2012 01:12
Dave,

This is done in, like for any other EDataType, in the generated factory
for that data type. In this case in
org.eclipse.emf.ecore.xml.type.impl.XMLTypeFactoryImpl.convertDoubleToString(EDataType,
Object). You can't specialize that class, but if you create your own
specialized EDataType, i.e., if you define your own derived
xsd:simpleType, you'll have your own factory method you can specialize.


On 24/11/2012 9:40 PM, David Rees wrote:
> Could someone point me to where I can hook into how the XSD types are
> serialized by XMLResource? I am specifically interested in modifying
> how xsd:double types are written.
>
> Right now, even if they have no fractional portion it still puts a
> ".0" at the end. For example:
> <MYFLOAT>7.0</MYFLOAT>
> <MYFLOAT>0.0</MYFLOAT>
>
>
> For consistency with external tools we are integrating with I would
> prefer it to not add the .0 when there is no fractional portion. For
> example:
> <MYFLOAT>7</MYFLOAT>
> <MYFLOAT>0</MYFLOAT>
>
> Thanks,
> dave
>

Re: Hook to modify how xsd:double is serialized by XMLResource [message #987304 is a reply to message #987276] Sun, 25 November 2012 21:17 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
David,

No, there's not much you can do in this case, except perhaps
specializing
org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.convertToString(EFactory,
EDataType, Object)


On 25/11/2012 4:26 PM, David Rees wrote:
> Thanks Ed
>
> I should have mentioned in my original post that I am using dynamic
> EMF, so I have no generated code to modify. Is there still a hook,
> perhaps to override the "dynamic object" factory where I can check the
> type being serialized and catch it there?
>
> Thanks,
> dave
>
> Ed Merks wrote on Sun, 25 November 2012 01:12
>> Dave,
>>
>> This is done in, like for any other EDataType, in the generated
>> factory for that data type. In this case in
>> org.eclipse.emf.ecore.xml.type.impl.XMLTypeFactoryImpl.convertDoubleToString(EDataType,
>> Object). You can't specialize that class, but if you create your own
>> specialized EDataType, i.e., if you define your own derived
>> xsd:simpleType, you'll have your own factory method you can specialize.
>>
>>
>> On 24/11/2012 9:40 PM, David Rees wrote:
>> > Could someone point me to where I can hook into how the XSD types
>> are > serialized by XMLResource? I am specifically interested in
>> modifying > how xsd:double types are written.
>> >
>> > Right now, even if they have no fractional portion it still puts a
>> > ".0" at the end. For example:
>> > <MYFLOAT>7.0</MYFLOAT>
>> > <MYFLOAT>0.0</MYFLOAT>
>> >
>> >
>> > For consistency with external tools we are integrating with I
>> would > prefer it to not add the .0 when there is no fractional
>> portion. For > example:
>> > <MYFLOAT>7</MYFLOAT>
>> > <MYFLOAT>0</MYFLOAT>
>> >
>> > Thanks,
>> > dave
>> >
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[EMFStore] Workspace singularity
Next Topic:Teneo EMF @OneToOne and @ManyToOne
Goto Forum:
  


Current Time: Fri Mar 29 09:23:36 GMT 2024

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

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

Back to the top