Re: How to customize the date type of xsd in EMF [message #426342] |
Sat, 27 December 2008 13:03 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------070107080704070708090608
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Tracy,
It's best to ask about EMF using the EMF newsgroup, which I've added to
the "to" list of the reply.
tracy wrote:
> Hi, all
> I meet an issue, if there is date type for a xsd's element, the
> ecore generated by XSDEcoreBuilder will use the default instanceClass
> "javax/xml/datatype/XMLGregorianCalendar" for date type. this class is
> not serializable
Since https://bugs.eclipse.org/bugs/show_bug.cgi?id=246418, EMF provides
an implementation like this:
public final class XMLCalendar extends XMLGregorianCalendar implements
Serializable
You can use XMLTypeFactory.eINSTANCE.createDate to create instances of it.
> . Now I want to use
> " com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregoria nCalendarImpl "
> to replace it, Do you know how to complish it?
It's really a JRE question. Likely there is some magical JRE
incantation for replacing which version created by
DatatypeFactory.newInstance()
which EMF uses under the covers and wraps with the above internal
implementation.
> Is it possible that change the options in resource.save(options) to
> change the instanceClass?
No. But I'm a bit confused though, since the instance value doesn't
need to be java.io.Serializable in order to be saved in a resource...
> BTW: I know if I add the annotation for instanceClass in xsd, it can
> work fine, But I think maybe there is another way.
That's the only way to use a different data type than the one EMF would
use by default.
> Can you help me with this?
I wonder why you need it the data value to be java.io.Serializable? It
shouldn't cause you any problems when saving a resource either way...
It seems to me a bug that the Xerces implementation isn't Serializable....
> Thanks a lot!
>
--------------070107080704070708090608
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Tracy,<br>
<br>
It's best to ask about EMF using the EMF newsgroup, which I've added to
the "to" list of the reply.<br>
<br>
tracy wrote:
<blockquote
cite="mid:21a5b09fea149f646764f6c2a4e7fceb$1@www.eclipse.org"
type="cite">Hi, all
<br>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02956 seconds