Package org.apache.xmlbeans

Examples of org.apache.xmlbeans.XmlCalendar


        for (String mexId : instance.getMessageExchangeIds()) {
            MessageExchangeDAO mexDao = conn.getMessageExchange(mexId);

            Exchange e = Exchange.Factory.newInstance();
            list.add(e);
            e.setCreateTime(new XmlCalendar(mexDao.getCreateTime()));
            e.setOperation(mexDao.getOperation());
            try {
                e.setIn(XmlObject.Factory.parse(mexDao.getRequest().getData()));
            } catch (XmlException e1) {
                __log.error("", e1);
View Full Code Here


      writer.println("  w.focus();");
        writer.println("}");
        writer.println("</script>");

        writer.println("<h1>XML Schema Test Collection Results</h1>");
        writer.println("<p>Run on " + (new XmlCalendar(new Date())) + "</p>");
        writer.println("<table style='border: 1px solid black' cellpadding=0 cellspacing=0>");
        writer.println("<tr><td width=75%>Description</td><td width=12.5%>sch v</td><td width=12.5%>ins v</td></tr>");
        int failures = 0;
        int cases = 0;
        for (Iterator i = ltgFiles.iterator(); i.hasNext(); )
View Full Code Here

        // ./*
        xc.toNextToken();
        // ./*/timestamp
        xc.toChild(TIMESTAMP_QNAME);
        System.out.println(xc.xmlText());
        XmlCalendar calendar = new XmlCalendar(xc.getTextValue());
        // return getDateFormat().parse(xc.getTextValue()); // fixme: this
        // supports only one date format
        return calendar.getTime();
    }
View Full Code Here

   
    public static void testGregorianCalendar()
    {
        // this is a check of DST offsets
        Date date = new GDate("2002-04-18T23:59:59Z").getDate();
        GregorianCalendar gcal = new XmlCalendar(date);
        Assert.assertEquals(date, gcal.getTime());

        // now check out some things
        GDate gd = new GDate("2001-12-31T07:00:59.010");
        GregorianCalendar gc = gd.getCalendar();
        Date gdd = gd.getDate();
        Date gcd = gc.getTime();
        Assert.assertEquals(gdd, gcd);
       
        // set up 2/29, and read out Feb 29 in the year 1 BC.
        XmlCalendar gregcal = new GDate("--02-29").getCalendar();
        Assert.assertEquals(29, gregcal.peek(Calendar.DAY_OF_MONTH));
        Assert.assertEquals(2 - 1, gregcal.peek(Calendar.MONTH));
        Assert.assertEquals(1, gregcal.peek(Calendar.YEAR));
        Assert.assertEquals(0, gregcal.peek(Calendar.ERA));
        // repeat some tests to make sure it's stable.
        Assert.assertEquals(29, gregcal.peek(Calendar.DAY_OF_MONTH));
        Assert.assertEquals(2 - 1, gregcal.peek(Calendar.MONTH));

        // now try some setters
        gregcal = new GDate("--02-29").getCalendar();
        gregcal.set(Calendar.MONTH, 10);
        Assert.assertEquals("--11-29", gregcal.toString());
        // repeat to ensure it's stable.
        Assert.assertEquals("--11-29", gregcal.toString());
    }
View Full Code Here

                // verify that going through gcal gives us the same thing
                GregorianCalendar gcal = gdate.getCalendar();
                Assert.assertEquals(date, gcal.getTime());
               
                // double-check XmlCalendar constructor
                gcal = new XmlCalendar(date);
                Assert.assertEquals("Doing " + gdate, date, gcal.getTime());
            }
            else if (gdate.hasDate() && (gdate.getFraction() == null || gdate.getFraction().scale() <= 3))
            {
                // must be able to get a date if time+timezone is unset (midnight, ltz are assumed)
View Full Code Here

       //

       ImportantDate impdate = dtelement.addNewImportantDate();

       //Creating value for <holiday> element
       Calendar  holiday = new XmlCalendar("2004-07-04");

       //Creating value for <fun-begin-time> element
       Calendar  funbegintime = new XmlCalendar("10:30:33");

       //Creating value for <fun-end-time> element
       Calendar  funendtime = new XmlCalendar("12:40:12");

       //Creating value for <birthdatetime> element
       Calendar  birthdatetime = new XmlCalendar("1977-11-29T10:10:12");

       //Creating value for <job-duration> element
       GDuration jobduration =  new GDuration(1,2,4,5,10,12,15,null);

       //Creating value for <payday> element
       Calendar payday = new XmlCalendar("---12");

       //Setting all the elements
       impdate.addHoliday(holiday);
       impdate.setFunBeginTime(funbegintime);
       impdate.setFunEndTime(funendtime);
       impdate.setJobDuration(jobduration);
       impdate.setBirthdatetime(birthdatetime);
       impdate.setPayday(payday);
       impdate.setDescription("Using XmlCalendar");


       //
       // add another important date using Calendar
       //

       impdate = dtelement.addNewImportantDate();

       //Creating value for <holiday> element using XmlCalendar
       holiday = new XmlCalendar("2004-07-04");

       //Creating value for <fun-begin-time> element using GregorianCalendar
       funbegintime = Calendar.getInstance();
       funbegintime.clear();
       funbegintime.set(Calendar.AM_PM , Calendar.AM);
       funbegintime.set(Calendar.HOUR, 10);
       funbegintime.set(Calendar.MINUTE, 30 );
       funbegintime.set(Calendar.SECOND, 35 );

       //Creating value for <fun-end-time> element
       funendtime = Calendar.getInstance();
       funendtime.clear();
       funendtime.set(Calendar.AM_PM , Calendar.AM);
       funendtime.set(Calendar.HOUR, 12);
       funendtime.set(Calendar.MINUTE, 40 );
       funendtime.set(Calendar.SECOND, 12 );

       //Creating value for <birthdatetime> element
       birthdatetime = Calendar.getInstance();
       birthdatetime.clear();
       birthdatetime.set(1977,10,29,10,10,12);

       //Creating value for <job-duration> element
       jobduration =  new GDuration(1,2,4,5,10,12,15,null);

       //Creating value for <payday> element
       payday = Calendar.getInstance();
       payday.clear();
       payday.set(Calendar.DAY_OF_MONTH,12);

       //Setting all the elements
       impdate.addHoliday(holiday);
       impdate.setFunBeginTime(funbegintime);
       impdate.setFunEndTime(funendtime);
View Full Code Here

        writer.println("  w.focus();");
        writer.println("}");
        writer.println("</script>");

        writer.println("<h1>XML Schema Test Collection Results</h1>");
        writer.println("<p>Run on " + (new XmlCalendar(new Date())) + "</p>");
        writer.println("<p>Values in schema or instance valid columns are results from compiling or validating respectively.");
        writer.println("Red or orange background mean the test failed.</p>");
        writer.println("<table style='border: 1px solid black' cellpadding=0 cellspacing=0>");
        writer.println("<tr><td witdh=10%>id</td><td width=70%>Description</td><td width=10%>sch v</td><td width=10%>ins v</td></tr>");
        int failures = 0;
View Full Code Here

        for (String mexId : instance.getMessageExchangeIds()) {
            MessageExchangeDAO mexDao = conn.getMessageExchange(mexId);

            Exchange e = Exchange.Factory.newInstance();
            list.add(e);
            e.setCreateTime(new XmlCalendar(mexDao.getCreateTime()));
            e.setOperation(mexDao.getOperation());
            try {
                e.setIn(XmlObject.Factory.parse(mexDao.getRequest().getData()));
            } catch (XmlException e1) {
                __log.error("", e1);
View Full Code Here

      writer.println("  w.focus();");
        writer.println("}");
        writer.println("</script>");

        writer.println("<h1>XML Schema Test Collection Results</h1>");
        writer.println("<p>Run on " + (new XmlCalendar(new Date())) + "</p>");
        writer.println("<table style='border: 1px solid black' cellpadding=0 cellspacing=0>");
        writer.println("<tr><td width=75%>Description</td><td width=12.5%>sch v</td><td width=12.5%>ins v</td></tr>");
        int failures = 0;
        int cases = 0;
        for (Iterator i = ltgFiles.iterator(); i.hasNext(); )
View Full Code Here

        {
            Assert.assertEquals(((SimpleValue)dt[i]).gDateValue(), new GDate(gd[i]));
            Assert.assertEquals(gd[i], dt[i].objectValue());
        }

        Assert.assertEquals(new XmlCalendar("2001-08-06T03:34:00"), gd[0]);
        Assert.assertEquals(new XmlCalendar("2002-01-04"), gd[1]);
        Assert.assertEquals(new XmlCalendar("2002-08-26T23:10:00"), gd[2]);

        Assert.assertEquals(XmlDateTime.type, dt[0].instanceType());
        Assert.assertEquals(XmlDate.type, dt[1].instanceType());
        Assert.assertEquals(XmlDateTime.type, dt[2].instanceType());

        reports.setWhenArray(0, new XmlCalendar("1980-04-18"));
        reports.setWhenArray(1, new XmlCalendar("1970-12-20T04:33:00"));

        dt = reports.xgetWhenArray();
        gd = reports.getWhenArray();

        Assert.assertEquals(new XmlCalendar("1980-04-18"), gd[0]);
        Assert.assertEquals(new XmlCalendar("1970-12-20T04:33:00"), gd[1]);
        Assert.assertEquals(new XmlCalendar("2002-08-26T23:10:00"), gd[2]);

        Assert.assertEquals(XmlDate.type, dt[0].instanceType());
        Assert.assertEquals(XmlDateTime.type, dt[1].instanceType());
        Assert.assertEquals(XmlDateTime.type, dt[2].instanceType());
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.XmlCalendar

Copyright © 2018 www.massapicom. 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.