users@jaxb.java.net

R: DateTime error

From: EBAStep2 <ebastep2_at_sia.it>
Date: Wed, 11 Jun 2003 19:22:25 +0200

Hi,
this is my source code :


public static void createFvr() throws Exception, JAXBException,
javax.xml.bind.ValidationException {

        try {

                JAXBContext oj = JAXBContext.newInstance("FvrSchema");

                ObjectFactory objFactory = new ObjectFactory();

                XctFvrSTPPlusBlkCdtTrf xmlFvr =
objFactory.createXctFvrSTPPlusBlkCdtTrf();

                PaymentInformation4 grHd =
objFactory.createPaymentInformation4();
                grHd.setCreDt("2002-11-18T17:18:52");
                ...
                ...
                ...
                ...

                //Assign namespace prefix by David Megginson
                XMLWriter writer = new XMLWriter();
                writer.setPrefix("urn:XctFvr:xsd:$XctFvrSTPPlusBlkCdtTrf",
"XctFvr");
                writer.setPrefix("urn:swift:xsd:$STPPlusBlkCdtTrfRjct",
"swift");
                writer.forceNSDecl("urn:swift:xsd:$STPPlusBlkCdtTrfRjct");
                try {
                        writer.setOutput(
                                new PrintWriter(
                                        new BufferedWriter(new
FileWriter(FvrGenerator.pathFvr + fvrFlNm))));
                } catch (FileNotFoundException ioe) {
                        FvrGenerator.traceErrore = ioe.getMessage();
                        throw ioe;
                }

                //Validate before marshal
                javax.xml.bind.Validator v = oj.createValidator();
                try{
                        validateFvr = v.validate(xmlFvr);
                }catch (javax.xml.bind.ValidationException ve){
                        FvrGenerator.traceErrore = ve.toString();
                        throw ve;
                }
                
                /marshalling
                Marshaller m = oj.createMarshaller();
                m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
Boolean.TRUE);
                m.setProperty(
                        Marshaller.JAXB_SCHEMA_LOCATION,
                        "urn:XctFvr:xsd:$XctFvrSTPPlusBlkCdtTrf
XctFvrSTPPlusBlkCdtTrf.xsd");

                m.marshal(xmlFvr, writer);


        } catch (javax.xml.bind.MarshalException me) {
                FvrGenerator.traceErrore = me.getMessage();
                throw me;
        } catch (JAXBException je) {
                FvrGenerator.traceErrore = je.getMessage();
                throw je;
        } catch (Exception e) {
                //e.printStackTrace();
                throw e;
        }

}

I get the error when I try to validate befor marshalling. In the schema the
"CreDt" element is defined as "dateTime" datatype (timezone is not mandatory
for this datatype).
I'm using JAXB 1.0 beta because we cannot upgrade at this time of the
project. I hope this does't linked to my problem, otherwise we will not make
any validation and we just skip it...
The XML file generated (without any validation) is good if I pass it into
some fileprocessor (XML SPy, Tibco Turbo XML...)
Thanks,
Tito


-----Messaggio originale-----
Da: Ed Mooney [mailto:Ed.Mooney_at_Sun.COM]
Inviato: mercoled? 11 giugno 2003 17.19
A: JAXB-INTEREST_at_JAVA.SUN.COM
Oggetto: Re: DateTime error


Hi Tito,

Could you send an example?

Regards,
--
Ed Mooney         |Sun Microsystems, Inc.|Time flies like
Java Web Services |UBUR02-201            |an arrow, but
Ed.Mooney_at_Sun.COM |1 Network Drive       |fruit flies like
781-442-0459      |Burlington, MA  01803 |a banana. Groucho
SUBSCRIBE JAXB-INTEREST Tito wrote:
> Hi,
> I get a "DefaultValidationEventHandler" with JAXB if I use a value like
"2002-11-18T17:18:52" for a "dateTime" element.
> Is the timezone part optional?
> If so why I get this error?
> Thanks,
> Tito
*******************Internet Email Confidentiality Footer******************* 
Qualsiasi utilizzo non autorizzato del presente messaggio nonche' dei suoi
allegati e' vietato e potrebbe costituire reato. Se lei ha ricevuto
erroneamente il presente messaggio, Le saremmo grati se, via e-mail, ce ne
comunicasse la ricezione e provvedesse alla distruzione del messaggio stesso
e dei suoi eventuali allegati. Le dichiarazioni contenute nel presente
messaggio nonche' nei suoi eventuali allegati devono essere attribuite
esclusivamente al mittente e non possono essere considerate come trasmesse o
autorizzate da SIA S.p.A.; le medesime dichiarazioni non impegnano SIA
S.p.A. nei confronti del destinatario o di terzi. 
SIA S.p.A. non si assume alcuna responsabilita' per eventuali
intercettazioni, modifiche o danneggiamenti del presente messaggio e-mail. 
Any unauthorized use of this e-mail or any of its attachments is prohibited
and could constitute an offence. If you are not the intended addressee
please advise immediately the sender by using the reply facility in your
e-mail software and destroy the message and its attachments. The statements
and opinions expressed in this e-mail message are those of the author of the
message and do not necessarily represent those of SIA. Besides, The contents
of this message shall be understood as neither given nor endorsed by SIA
S.p.A.. 
SIA S.p.A. does not accept liability for corruption, interception or
amendment, if any, or the consequences thereof.