Results 1 to 2 of 2
  1. #1
    dustedrob is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Default XMLGregorianCalendar problems

    Hi, I'm having very weird problems when trying to set an XMLGregorianCalendar datatype. Here's what I'm trying to do:
    Java Code:
      try {
                        
                        GregorianCalendar c = new GregorianCalendar();
                        c.setTime(date); //date is in format dd/MM/YYYY
                        
                        DatatypeFactory dtf = DatatypeFactory.newInstance();
                       XMLGregorianCalendar date = dtf.newXMLGregorianCalendar(c);
    
                    } catch (Exception e) {                }
    And i get:

    java.lang.IllegalStateException: com.sun.org.apache.xerces.internal.jaxp.datatype.X MLGregorianCalendarImpl#getXMLSchemaType() :Invalid set of fields set for XMLGregorianCalendar
    What am i doing wrong??

  2. #2
    dustedrob is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Default add..

    Forgot to add the jaxb part:
    Java Code:
                javax.xml.bind.JAXBContext jaxbCtx = javax.xml.bind.JAXBContext.newInstance(comprobante.getClass().getPackage().getName());
                javax.xml.bind.Marshaller marshaller = jaxbCtx.createMarshaller();
                marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_ENCODING, "UTF-8"); //NOI18N
                marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
                marshaller.marshal(comprobante, System.out);
            } catch (javax.xml.bind.JAXBException ex) {
                // XXXTODO Handle exception
                java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, null, ex); //NOI18N
            }

Similar Threads

  1. Web Service from WSDL & XMLGregorianCalendar Issues
    By CoAstroGeek in forum NetBeans
    Replies: 2
    Last Post: 01-23-2010, 04:23 PM
  2. Gui problems
    By bulldog in forum Advanced Java
    Replies: 1
    Last Post: 12-11-2009, 12:35 PM
  3. Problems, problems, problems!
    By Empower5315 in forum New To Java
    Replies: 2
    Last Post: 08-28-2009, 04:27 AM
  4. many to many problems
    By cecily in forum JDBC
    Replies: 1
    Last Post: 08-02-2007, 05:51 PM
  5. Problems with the jar
    By Freddie in forum NetBeans
    Replies: 2
    Last Post: 05-29-2007, 03:50 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •