Package javax.xml.datatype

Examples of javax.xml.datatype.XMLGregorianCalendar.toXMLFormat()


            createStartElementAndOutputAsEvent(subOutputProcessorChain, headerElementName, true, null);
            createStartElementAndOutputAsEvent(subOutputProcessorChain, WSSConstants.TAG_wsu_Created, false, null);
            createCharactersAndOutputAsEvent(subOutputProcessorChain, created.toXMLFormat());
            createEndElementAndOutputAsEvent(subOutputProcessorChain, WSSConstants.TAG_wsu_Created);
            createStartElementAndOutputAsEvent(subOutputProcessorChain, WSSConstants.TAG_wsu_Expires, false, null);
            createCharactersAndOutputAsEvent(subOutputProcessorChain, expires.toXMLFormat());
            createEndElementAndOutputAsEvent(subOutputProcessorChain, WSSConstants.TAG_wsu_Expires);
            createEndElementAndOutputAsEvent(subOutputProcessorChain, headerElementName);

            outputProcessorChain.removeProcessor(this);
        }
View Full Code Here


  public void canConvertDate_toGregorianCalendar() {
    LocalDate lt = new LocalDate(2000, 1, 2);
    DateMidnight dm = lt.toDateMidnight(DateTimeZone.UTC);
   
    XMLGregorianCalendar gc = XmlUtils.asXMLGregorianCalendar(dm.toDate());
    Assert.assertEquals("2000-01-02T00:00:00.000Z", gc.toXMLFormat());
  }
 
  @Test
  public void canConvert_GregorianCalendar_toDate() {
    LocalDate lt = new LocalDate(2000, 1, 2);
View Full Code Here

        // ELEMENT: start
        final XMLGregorianCalendar start = timer.start;
        if (start != null) {
            writer.writeStartElement(prefix, "start", "http://java.sun.com/xml/ns/javaee");
            writer.writeCharacters(start.toXMLFormat());
            writer.writeEndElement();
        }

        // ELEMENT: end
        final XMLGregorianCalendar end = timer.end;
View Full Code Here

        // ELEMENT: end
        final XMLGregorianCalendar end = timer.end;
        if (end != null) {
            writer.writeStartElement(prefix, "end", "http://java.sun.com/xml/ns/javaee");
            writer.writeCharacters(end.toXMLFormat());
            writer.writeEndElement();
        }

        // ELEMENT: timeoutMethod
        final NamedMethod timeoutMethod = timer.timeoutMethod;
View Full Code Here

    try {
      final GregorianCalendar gregorianCalendar = new GregorianCalendar( _timeZone );
      gregorianCalendar.setTime( _date );
      final XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar( gregorianCalendar );
      xmlGregorianCalendar.setTimezone( DatatypeConstants.FIELD_UNDEFINED );
      final String dateValue = xmlGregorianCalendar.toXMLFormat();
      return dateValue;
    } catch (DatatypeConfigurationException e) {
      throw new ConfigurationException( e );
    }
  }
View Full Code Here

        }

        // gDay
        if (XMLConstants.G_DAY_QNAME.equals(schemaTypeQName)) {
            xgc.setDay(cal.get(Calendar.DATE));
            return xgc.toXMLFormat();
        }
        // gMonth
        if (XMLConstants.G_MONTH_QNAME.equals(schemaTypeQName)) {
            xgc.setMonth(cal.get(Calendar.MONTH) + 1);
            // Note: 'XML Schema:  Datatypes' indicates that the lexical representation is "--MM--"
View Full Code Here

        if (XMLConstants.G_MONTH_QNAME.equals(schemaTypeQName)) {
            xgc.setMonth(cal.get(Calendar.MONTH) + 1);
            // Note: 'XML Schema:  Datatypes' indicates that the lexical representation is "--MM--"
            // but the truncated representation as described in 5.2.1.3 of ISO 8601:1988 is "--MM".
            // We always want to return the 1.5 syntax ("--MM--") to comply with the JAXB RI.
            String xmlFormat = xgc.toXMLFormat();
            String pre  = xmlFormat.substring(0, 4); // will always be --MM
            String post = XMLConstants.EMPTY_STRING;

            // --MM--
            if (xmlFormat.length() == 6) {
View Full Code Here

        }
        // gMonthDay
        if (XMLConstants.G_MONTH_DAY_QNAME.equals(schemaTypeQName)) {
            xgc.setMonth(cal.get(Calendar.MONTH) + 1);
            xgc.setDay(cal.get(Calendar.DATE));
            return xgc.toXMLFormat();
        }
        // gYear
        if (XMLConstants.G_YEAR_QNAME.equals(schemaTypeQName)) {
            if (cal.get(Calendar.ERA) == GregorianCalendar.BC){
                xgc.setYear(-cal.get(Calendar.YEAR));
View Full Code Here

                xgc.setYear(-cal.get(Calendar.YEAR));
            } else {
                xgc.setYear(cal.get(Calendar.YEAR));
            }
            xgc.setMonth(cal.get(Calendar.MONTH) + 1);
            return xgc.toXMLFormat();
        }
        // Date
        if (XMLConstants.DATE_QNAME.equals(schemaTypeQName)) {
            if (cal.get(Calendar.ERA) == GregorianCalendar.BC){
                xgc.setYear(-cal.get(Calendar.YEAR));
View Full Code Here

            } else {
                xgc.setYear(cal.get(Calendar.YEAR));
            }
            xgc.setMonth(cal.get(Calendar.MONTH) + 1);
            xgc.setDay(cal.get(Calendar.DATE));
            return xgc.toXMLFormat();
        }
        // Time
        if (XMLConstants.TIME_QNAME.equals(schemaTypeQName)) {
            xgc.setTime(
                    cal.get(Calendar.HOUR_OF_DAY),
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.