Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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
 
I guess everyone has an angle. Fine, what do you want? Just know that you cannot have this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic