Class UnparsedTextFunction

All Implemented Interfaces:
Callable, FunctionItem, GroundedValue, Item, Sequence
Direct Known Subclasses:
UnparsedText, UnparsedTextAvailable, UnparsedTextLines

public abstract class UnparsedTextFunction extends SystemFunction
Abstract superclass containing common code supporting the functions unparsed-text(), unparsed-text-lines(), and unparsed-text-available()
  • Constructor Details

    • UnparsedTextFunction

      public UnparsedTextFunction()
  • Method Details

    • getSpecialProperties

      public int getSpecialProperties(Expression[] arguments)
      Description copied from class: SystemFunction
      Determine the special properties of this function. The general rule is that a system function call is non-creative unless more details are defined in a subclass.
      Overrides:
      getSpecialProperties in class SystemFunction
      Parameters:
      arguments - the actual arguments supplied in a call to the function
      Returns:
      the properties
    • readFile

      public static void readFile(URI absoluteURI, String encoding, UniStringConsumer output, XPathContext context) throws XPathException
      Supporting routine to load one external file given a URI (href) and a baseURI
      Parameters:
      absoluteURI - the absolutized URI
      encoding - the character encoding
      output - the consumer to which the contents of the file will be sent
      context - the XPath dynamic context
      Throws:
      XPathException - if the file cannot be read
    • getAbsoluteURI

      public static URI getAbsoluteURI(String href, String baseURI, XPathContext context) throws XPathException
      Throws:
      XPathException
    • handleIOError

      public static XPathException handleIOError(URI absoluteURI, IOException ioErr)
    • getErrorCode

      public static String getErrorCode(IOException ioErr)
    • readFile

      public static UnicodeString readFile(IntPredicateProxy checker, Reader reader) throws IOException, XPathException
      Read the contents of an unparsed text file
      Parameters:
      checker - predicate for checking whether characters are valid XML characters
      reader - Reader to be used for reading the file
      Returns:
      the contents of the file, as a UnicodeString
      Throws:
      IOException - if a failure occurs reading the file
      XPathException - if the file contains illegal characters
    • readFile

      public static void readFile(IntPredicateProxy checker, Reader reader, UniStringConsumer output) throws IOException, XPathException
      Read the contents of an unparsed text file
      Parameters:
      checker - predicate for checking whether characters are valid XML characters
      reader - Reader to be used for reading the file
      output - a consumer object that is supplied incrementally with the contents of the file
      Throws:
      IOException - if a failure occurs reading the file
      XPathException - if the file contains illegal characters