Class ParseIetfDate

All Implemented Interfaces:
Callable, FunctionItem, GroundedValue, Item, Sequence

public class ParseIetfDate extends SystemFunction implements Callable
This class implements the function parse-ietf-date(), which is a standard function in XPath 3.1
  • Constructor Details

    • ParseIetfDate

      public ParseIetfDate()
  • Method Details

    • call

      public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException
      Evaluate the expression
      Specified by:
      call in interface Callable
      Parameters:
      context - the dynamic evaluation context
      arguments - the values of the arguments, supplied as Sequence objects
      Returns:
      the result of the evaluation, in the form of a Sequence
      Throws:
      XPathException - if a dynamic error occurs during the evaluation of the expression
    • parse

      public DateTimeValue parse(String input, XPathContext context) throws XPathException
      Parse a supplied string to obtain a dateTime
      Parameters:
      input - a string containing the date and time in IETF format
      context - the XPath context
      Returns:
      either a DateTimeValue representing the input supplied, or a ValidationFailure if the input string was invalid
      Throws:
      XPathException
    • parseTime

      public int parseTime(List<String> tokens, int currentPosition, List<TimeValue> result, String input) throws XPathException
      Parse part of a string (already tokenized) to obtain a TimeValue
      Parameters:
      tokens - tokenized string containing the date and time in IETF format
      currentPosition - index of current token
      result - TimeValue produced from parsing time from tokens
      Returns:
      index of token after parsing the time
      Throws:
      XPathException
    • isValidTime

      public static boolean isValidTime(int hour, int minute, int second, int microsecond, int tz)
      Determine whether a given time is valid
      Parameters:
      hour - the hour (0-24)
      minute - the minute (0-59)
      second - the second (0-59)
      microsecond - the microsecond (0-999999)
      tz - the timezone displacement in minutes from UTC
      Returns:
      true if this is a valid time