Class JsonParser

java.lang.Object
net.sf.saxon.ma.json.JsonParser

public class JsonParser extends Object
Parser for JSON, which notifies parsing events to a JsonHandler
  • Field Details

  • Constructor Details

    • JsonParser

      public JsonParser()
      Create a JSON parser
  • Method Details

    • parse

      public void parse(String input, int flags, JsonHandler handler, XPathContext context) throws XPathException
      Parse the JSON string according to supplied options
      Parameters:
      input - JSON input string
      flags - options for the conversion as a map of xs:string : value pairs
      handler - event handler to which parsing events are notified
      context - XPath evaluation context
      Throws:
      XPathException - if the syntax of the input is incorrect
    • getFlags

      public static int getFlags(Map<String,Sequence> options, XPathContext context, Boolean allowValidate) throws XPathException
      Throws:
      XPathException
    • unescape

      public static String unescape(String literal, int flags, String errorCode, int lineNumber) throws XPathException
      Unescape a JSON string literal,
      Parameters:
      literal - the string literal to be processed
      flags - parsing options
      errorCode - Error code
      Returns:
      the result of parsing and conversion to XDM
      Throws:
      XPathException - if a dynamic error occurs (such as invalid JSON input)
    • toString

      public static String toString(net.sf.saxon.ma.json.JsonParser.JsonToken token, String currentTokenValue)