Package javax.xml.datatype

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


    XMLGregorianCalendar cal2 = XMLGregorianCalendarImpl.parse(str);
    Duration dur;
    try {
      dur = DatatypeFactory.newInstance().newDuration(
          cal1.toGregorianCalendar().getTimeInMillis()
              - cal2.toGregorianCalendar().getTimeInMillis());
    } catch (DatatypeConfigurationException e) {
      return null;
    }
    return BuiltinHelper.createXSLiteral(
        dur.toString().substring(0, dur.toString().indexOf("D") + 1),
View Full Code Here


    XMLGregorianCalendar cal2 = XMLGregorianCalendarImpl.parse(str);
    Duration dur;
    try {
      dur = DatatypeFactory.newInstance().newDuration(
          cal1.toGregorianCalendar().getTimeInMillis()
              - cal2.toGregorianCalendar().getTimeInMillis());
    } catch (DatatypeConfigurationException e) {
      return null;
    }
    return BuiltinHelper.createXSLiteral(
        dur.toString().substring(0, dur.toString().indexOf("M") + 1),
View Full Code Here

      throws RDFDataException {
    log.debug("Trying to parse '" + s + "' as an xsd:dateTime");

    XMLGregorianCalendar xmlCalendar = dtFactory.newXMLGregorianCalendar(s);
    xmlCalendar = xmlCalendar.normalize();
    return xmlCalendar.toGregorianCalendar();

    // // TODO get rid of Jena dependency
    // XSDDateTime xsddate = (XSDDateTime) XSDDatatype.XSDdateTime.parse(s);
    //
    // if (xsddate == null)
View Full Code Here

    public Object createValue(Class<?> expected, String value)
        throws InstantiationException {
     
      try {
        XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(value);
        GregorianCalendar gregorianCalendar = xmlGregorianCalendar.toGregorianCalendar();
        return gregorianCalendar.getTime();
      }
      catch (Exception ex) {
        throw new RuntimeException(ex);
      }
View Full Code Here

        try {
            factory = DatatypeFactory.newInstance();
            XMLGregorianCalendar cal = factory.newXMLGregorianCalendar(newVal);

            pParsePosition.setIndex(idxSpc);
            return cal.toGregorianCalendar();
        } catch (DatatypeConfigurationException e) {
            pParsePosition.setErrorIndex(offset);
        }
        return null;
    }
View Full Code Here

        XMLGregorianCalendar createdCalendar =
            WSSConfig.datatypeFactory.newXMLGregorianCalendar(createdValue.getTextContent());
        // Add 5 seconds
        Duration duration = WSSConfig.datatypeFactory.newDuration(5000L);
        createdCalendar.add(duration);
        Date createdDate = createdCalendar.toGregorianCalendar().getTime();
        createdValue.setTextContent(zulu.format(createdDate));
       
        if (LOG.isDebugEnabled()) {
            String outputString =
                XMLUtils.PrettyDocumentToString(signedDoc);
View Full Code Here

                bspEnforcer.handleBSPRule(BSPRule.R3213);
            }
            if (createdCalendar.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
                bspEnforcer.handleBSPRule(BSPRule.R3217);
            }
            createdDate = createdCalendar.toGregorianCalendar().getTime();
        }
       
        if (strExpires != null) {
            XMLGregorianCalendar expiresCalendar = null;
            try {
View Full Code Here

                bspEnforcer.handleBSPRule(BSPRule.R3215);
            }
            if (expiresCalendar.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
                bspEnforcer.handleBSPRule(BSPRule.R3223);
            }
            expiresDate = expiresCalendar.toGregorianCalendar().getTime();
        }
    }


    /**
 
View Full Code Here

                        WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN,
                        "badUsernameToken",
                        "Error parsing UsernameToken Created value"
                    );
                }
                createdDate = createdCalendar.toGregorianCalendar().getTime();
            }
        }
    }

    /**
 
View Full Code Here

                    created = WSSConstants.datatypeFactory.newXMLGregorianCalendar(timestampType.getCreated().getValue());
                } catch (IllegalArgumentException e) {
                    throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY, e);
                }
                log.debug("Timestamp created: " + created);
                createdDate = created.toGregorianCalendar().getTime();
            }

            Date expiresDate = null;
            if (timestampType.getExpires() != null) {
                XMLGregorianCalendar expires;
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.