• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

JAXB - sql.Date

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am trying to override the default binding of xs ate to java.util.Calendar to java.sql.Date.
The following is what I have added:
<xs:annotation>
<xs:appinfo>
<jaxb:globalBindings>
<jaxb:javaType name="java.sql.Date" xmlType="xs ate"
printMethod="valueOf" parseMethod="toString"/>
</jaxb:globalBindings>
</xs:appinfo>
</xs:annotation>
and I have an attribute that uses xs ate as the type.
I was able to generate using xjc, but the classes generated do not compiled.
Anyone has any suggestion? I have included some of the compiler error below.
../Mel
-------------
public void serializeBody(generated.impl.runtime.XMLSerializer context)
throws org.xml.sax.SAXException
{
context.startElement("http://govt.of.alberta.children.services", "Value");
context.endNamespaceDecls();
context.endAttributes();
try {
context.text(((java.sql.Date) _Value).valueOf(), "Value");
} catch (java.lang.Exception e) {
generated.impl.runtime.Util.handlePrintConversionException(this, e, context);
}
context.endElement();
}
-------------
private void eatText5(final java.lang.String value)
throws org.xml.sax.SAXException
{
try {
_InvoiceDate = java.sql.Date.toString(com.sun.xml.bind.WhiteSpaceProcessor.collapse(value));
} catch (java.lang.Exception e) {
handleParseConversionException(e);
}
}
 
Melody Siu
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, i fixed the problem already. I have the method name specified reversed.
../Mel
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic