Package javax.xml.datatype

Examples of javax.xml.datatype.DatatypeFactory.newXMLGregorianCalendar()


        try {
            datatypeFactory = DatatypeFactory.newInstance();
        } catch (DatatypeConfigurationException e) {
            throw new RuntimeException(e);
        }
        XMLGregorianCalendar xmlGregCal = datatypeFactory.newXMLGregorianCalendar(calendar);
        return xmlGregCal;
    }

    private static String replaceTimeToken(String string) {
        XMLGregorianCalendar calendar = getCalendar();
View Full Code Here


     * @return XMLGregorianCalendar
     */
    private XMLGregorianCalendar calendarToXMLGregorianCalendar(Calendar calendar) throws DatatypeConfigurationException {

        DatatypeFactory dtf = DatatypeFactory.newInstance();
        XMLGregorianCalendar xgc = dtf.newXMLGregorianCalendar();
        xgc.setYear(calendar.get(Calendar.YEAR));
        xgc.setMonth(calendar.get(Calendar.MONTH) + 1);
        xgc.setDay(calendar.get(Calendar.DAY_OF_MONTH));
        xgc.setHour(calendar.get(Calendar.HOUR_OF_DAY));
        xgc.setMinute(calendar.get(Calendar.MINUTE));
View Full Code Here

    private void performTestNewXMLGregorianCalendar(StandardTypesServiceClient serviceClient)
        throws DatatypeConfigurationException {
        DatatypeFactory df = DatatypeFactory.newInstance();
        XMLGregorianCalendar[] xgcals = new XMLGregorianCalendar[3];
        xgcals[0] = df.newXMLGregorianCalendar(new GregorianCalendar(1974, GregorianCalendar.APRIL, 19));
        xgcals[1] = df.newXMLGregorianCalendar(new GregorianCalendar(1978, GregorianCalendar.OCTOBER, 13));
        xgcals[2] = df.newXMLGregorianCalendar(new GregorianCalendar(2006, GregorianCalendar.JUNE, 16));

        for (int i = 0; i < xgcals.length; ++i) {
            XMLGregorianCalendar actual = serviceClient.getNewXMLGregorianCalendarForward(xgcals[i]);
View Full Code Here

    private void performTestNewXMLGregorianCalendar(StandardTypesServiceClient serviceClient)
        throws DatatypeConfigurationException {
        DatatypeFactory df = DatatypeFactory.newInstance();
        XMLGregorianCalendar[] xgcals = new XMLGregorianCalendar[3];
        xgcals[0] = df.newXMLGregorianCalendar(new GregorianCalendar(1974, GregorianCalendar.APRIL, 19));
        xgcals[1] = df.newXMLGregorianCalendar(new GregorianCalendar(1978, GregorianCalendar.OCTOBER, 13));
        xgcals[2] = df.newXMLGregorianCalendar(new GregorianCalendar(2006, GregorianCalendar.JUNE, 16));

        for (int i = 0; i < xgcals.length; ++i) {
            XMLGregorianCalendar actual = serviceClient.getNewXMLGregorianCalendarForward(xgcals[i]);
            xgcals[i].setDay(xgcals[i].getDay() + 5);
View Full Code Here

        throws DatatypeConfigurationException {
        DatatypeFactory df = DatatypeFactory.newInstance();
        XMLGregorianCalendar[] xgcals = new XMLGregorianCalendar[3];
        xgcals[0] = df.newXMLGregorianCalendar(new GregorianCalendar(1974, GregorianCalendar.APRIL, 19));
        xgcals[1] = df.newXMLGregorianCalendar(new GregorianCalendar(1978, GregorianCalendar.OCTOBER, 13));
        xgcals[2] = df.newXMLGregorianCalendar(new GregorianCalendar(2006, GregorianCalendar.JUNE, 16));

        for (int i = 0; i < xgcals.length; ++i) {
            XMLGregorianCalendar actual = serviceClient.getNewXMLGregorianCalendarForward(xgcals[i]);
            xgcals[i].setDay(xgcals[i].getDay() + 5);
            Assert.assertEquals(xgcals[i], actual);
View Full Code Here

    private void performTestNewXMLGregorianCalendarArray(StandardTypesServiceClient serviceClient)
        throws DatatypeConfigurationException {
        DatatypeFactory df = DatatypeFactory.newInstance();
        XMLGregorianCalendar[] xgcals = new XMLGregorianCalendar[3];
        xgcals[0] = df.newXMLGregorianCalendar(new GregorianCalendar(1974, GregorianCalendar.APRIL, 19));
        xgcals[1] = df.newXMLGregorianCalendar(new GregorianCalendar(1978, GregorianCalendar.OCTOBER, 13));
        xgcals[2] = df.newXMLGregorianCalendar(new GregorianCalendar(2006, GregorianCalendar.JUNE, 16));

        XMLGregorianCalendar[] actual = serviceClient.getNewXMLGregorianCalendarArrayForward(xgcals);
        Assert.assertEquals(xgcals.length, actual.length);
View Full Code Here

    private void performTestNewXMLGregorianCalendarArray(StandardTypesServiceClient serviceClient)
        throws DatatypeConfigurationException {
        DatatypeFactory df = DatatypeFactory.newInstance();
        XMLGregorianCalendar[] xgcals = new XMLGregorianCalendar[3];
        xgcals[0] = df.newXMLGregorianCalendar(new GregorianCalendar(1974, GregorianCalendar.APRIL, 19));
        xgcals[1] = df.newXMLGregorianCalendar(new GregorianCalendar(1978, GregorianCalendar.OCTOBER, 13));
        xgcals[2] = df.newXMLGregorianCalendar(new GregorianCalendar(2006, GregorianCalendar.JUNE, 16));

        XMLGregorianCalendar[] actual = serviceClient.getNewXMLGregorianCalendarArrayForward(xgcals);
        Assert.assertEquals(xgcals.length, actual.length);
        for (int i = 0; i < xgcals.length; ++i) {
View Full Code Here

        throws DatatypeConfigurationException {
        DatatypeFactory df = DatatypeFactory.newInstance();
        XMLGregorianCalendar[] xgcals = new XMLGregorianCalendar[3];
        xgcals[0] = df.newXMLGregorianCalendar(new GregorianCalendar(1974, GregorianCalendar.APRIL, 19));
        xgcals[1] = df.newXMLGregorianCalendar(new GregorianCalendar(1978, GregorianCalendar.OCTOBER, 13));
        xgcals[2] = df.newXMLGregorianCalendar(new GregorianCalendar(2006, GregorianCalendar.JUNE, 16));

        XMLGregorianCalendar[] actual = serviceClient.getNewXMLGregorianCalendarArrayForward(xgcals);
        Assert.assertEquals(xgcals.length, actual.length);
        for (int i = 0; i < xgcals.length; ++i) {
            xgcals[i].setDay(xgcals[i].getDay() + 5);
View Full Code Here

            newVal = pString.substring(offset, idxSpc);
        }
        DatatypeFactory factory;
        try {
            factory = DatatypeFactory.newInstance();
            XMLGregorianCalendar cal = factory.newXMLGregorianCalendar(newVal);

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

            Element created = (Element) ((Element) nodeList.item(0)).getElementsByTagNameNS(WSSConstants.TAG_wsu_Created.getNamespaceURI(), WSSConstants.TAG_wsu_Created.getLocalPart()).item(0);
            Element expires = (Element) ((Element) nodeList.item(0)).getElementsByTagNameNS(WSSConstants.TAG_wsu_Expires.getNamespaceURI(), WSSConstants.TAG_wsu_Expires.getLocalPart()).item(0);

            DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();
            GregorianCalendar gregorianCalendarCreated = datatypeFactory.newXMLGregorianCalendar(created.getTextContent()).toGregorianCalendar();
            GregorianCalendar gregorianCalendarExpires = datatypeFactory.newXMLGregorianCalendar(expires.getTextContent()).toGregorianCalendar();

            Assert.assertTrue(gregorianCalendarCreated.before(gregorianCalendarExpires));
            GregorianCalendar now = new GregorianCalendar();
            Assert.assertTrue(now.after(gregorianCalendarCreated));
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.