Package net.sf.saxon.type

Examples of net.sf.saxon.type.ConversionResult


          Object value = Value.convertToJava(colItem);
          if (value instanceof Item) {
            Item i = (Item)value;
            BuiltInAtomicType bat = typeMapping.get(proColumn.getSymbol().getType());
            if (bat != null) {
              ConversionResult cr = StringValue.convertStringToBuiltInType(i.getStringValueCS(), bat, null);
              value = cr.asAtomic();
              value = Value.convertToJava((AtomicValue)value);
              if (value instanceof Item) {
                value = ((Item)value).getStringValue();
              }
            } else {
View Full Code Here


     * gYearMonth, gYear, gMonth, gMonthDay, or gDay
     * @return either a value of the appropriate type, or a ValidationFailure if the format is invalid
     */

    public static ConversionResult makeCalendarValue(CharSequence s) {
        ConversionResult cr = DateTimeValue.makeDateTimeValue(s);
        ConversionResult firstError = cr;
        if (cr instanceof ValidationFailure) {
            cr = DateValue.makeDateValue(s);
        }
        if (cr instanceof ValidationFailure) {
            cr = TimeValue.makeTimeValue(s);
View Full Code Here

     * is specified and it does not specify a time zone, then the date string format must not include
     * a time zone.
     */
    public static String date(String datetimeIn) {
        if (datetimeIn.indexOf('T') >= 0) {
            ConversionResult cr = DateTimeValue.makeDateTimeValue(datetimeIn);
            if (cr instanceof ValidationFailure) {
                return "";
            } else {
                return ((DateTimeValue)cr).toDateValue().getStringValue();
            }
        } else {
            ConversionResult cr = DateValue.makeDateValue(datetimeIn);
            if (cr instanceof ValidationFailure) {
                return "";
            } else {
                return ((AtomicValue)cr).getStringValue();
            }
View Full Code Here

     * @return the time part of the string
     */

    public static String time(String dateTime) {
        if (dateTime.indexOf('T') >= 0) {
            ConversionResult cr = DateTimeValue.makeDateTimeValue(dateTime);
            if (cr instanceof ValidationFailure) {
                return "";
            } else {
                return ((DateTimeValue)cr).toTimeValue().getStringValue();
            }
        } else {
            ConversionResult cr = TimeValue.makeTimeValue(dateTime);
            if (cr instanceof ValidationFailure) {
                return "";
            } else {
                return ((AtomicValue)cr).getStringValue();
            }
View Full Code Here

     * implementation also allows the input value to contain a timezone</p>
     * @throws XPathException
     */
    public static double year(String datetimeIn) {
        try {
            ConversionResult cr = CalendarValue.makeCalendarValue(datetimeIn);
            if (cr instanceof ValidationFailure) {
                return Double.NaN;
            }
            if (cr instanceof GMonthValue || cr instanceof GMonthDayValue ||
                    cr instanceof GDayValue || cr instanceof TimeValue) {
View Full Code Here

     * @return the month extracted from the dateTime
     */

    public static double monthInYear(String dateTime) {
        try {
            ConversionResult cr = CalendarValue.makeCalendarValue(dateTime);
            if (cr instanceof ValidationFailure) {
                return Double.NaN;
            }
            if (cr instanceof GYearValue || cr instanceof GDayValue ||
                    cr instanceof GDayValue || cr instanceof TimeValue) {
View Full Code Here

     * @return the day number within the month, as a double
     */

    public static double dayInMonth(String dateTime) throws XPathException {
        try {
            ConversionResult cr = CalendarValue.makeCalendarValue(dateTime);
            if (cr instanceof ValidationFailure) {
                return Double.NaN;
            }
            if (cr instanceof GYearValue || cr instanceof GYearMonthValue ||
                    cr instanceof GMonthValue || cr instanceof TimeValue) {
View Full Code Here

     * @return the hour
     */

    public static double hourInDay(String dateTime) {
        try {
            ConversionResult cr = CalendarValue.makeCalendarValue(dateTime);
            if (cr instanceof ValidationFailure) {
                return Double.NaN;
            }
            if (!(cr instanceof DateTimeValue || cr instanceof TimeValue)) {
                return Double.NaN;
View Full Code Here

     * @return the minute
     */

    public static double minuteInHour(String dateTime) {
        try {
            ConversionResult cr = CalendarValue.makeCalendarValue(dateTime);
            if (cr instanceof ValidationFailure) {
                return Double.NaN;
            }
            if (!(cr instanceof DateTimeValue || cr instanceof TimeValue)) {
                return Double.NaN;
View Full Code Here

     * @return the second
     */

    public static double secondInMinute(String dateTime) throws XPathException {
        try {
            ConversionResult cr = CalendarValue.makeCalendarValue(dateTime);
            if (cr instanceof ValidationFailure) {
                return Double.NaN;
            }
            if (!(cr instanceof DateTimeValue || cr instanceof TimeValue)) {
                return Double.NaN;
View Full Code Here

TOP

Related Classes of net.sf.saxon.type.ConversionResult

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.