public class JsonParser extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ALLOW_ANY_TOP_LEVEL |
static int |
DEBUG |
static int |
DUPLICATES_FIRST |
static int |
DUPLICATES_LAST |
static int |
DUPLICATES_REJECTED |
static int |
DUPLICATES_RETAINED |
static int |
DUPLICATES_SPECIFIED |
static int |
ESCAPE |
static int |
LIBERAL |
static int |
VALIDATE |
Constructor and Description |
---|
JsonParser(IntPredicate charChecker)
Create a JSON parser
|
Modifier and Type | Method and Description |
---|---|
static MapItem |
checkOptions(MapItem map,
XPathContext context) |
static int |
getFlags(MapItem options,
XPathContext context,
Boolean allowValidate) |
void |
parse(String input,
int flags,
JsonHandler handler,
XPathContext context)
Parse the JSON string according to supplied options
|
static String |
unescape(String literal,
int flags,
String errorCode)
Unescape a JSON string literal,
|
public static final int ESCAPE
public static final int ALLOW_ANY_TOP_LEVEL
public static final int LIBERAL
public static final int VALIDATE
public static final int DEBUG
public static final int DUPLICATES_RETAINED
public static final int DUPLICATES_LAST
public static final int DUPLICATES_FIRST
public static final int DUPLICATES_REJECTED
public static final int DUPLICATES_SPECIFIED
public JsonParser(IntPredicate charChecker)
charChecker
- a predicate that determines which characters are acceptedpublic void parse(String input, int flags, JsonHandler handler, XPathContext context) throws XPathException
input
- JSON input stringflags
- options for the conversion as a map of xs:string : value pairshandler
- event handler to which parsing events are notifiedcontext
- XPath evaluation contextXPathException
- if the syntax of the input is incorrectpublic static int getFlags(MapItem options, XPathContext context, Boolean allowValidate) throws XPathException
XPathException
public static String unescape(String literal, int flags, String errorCode) throws XPathException
literal
- the string literal to be processedflags
- parsing optionserrorCode
- Error codeXPathException
- if a dynamic error occurs (such as invalid JSON input)public static MapItem checkOptions(MapItem map, XPathContext context) throws XPathException
XPathException
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.