public class JsonParser
extends java.lang.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()
Create a JSON parser
|
Modifier and Type | Method and Description |
---|---|
static int |
getFlags(java.util.Map<java.lang.String,Sequence> options,
XPathContext context,
java.lang.Boolean allowValidate) |
void |
parse(java.lang.String input,
int flags,
JsonHandler handler,
XPathContext context)
Parse the JSON string according to supplied options
|
static java.lang.String |
unescape(java.lang.String literal,
int flags,
java.lang.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 void parse(java.lang.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(java.util.Map<java.lang.String,Sequence> options, XPathContext context, java.lang.Boolean allowValidate) throws XPathException
XPathException
public static java.lang.String unescape(java.lang.String literal, int flags, java.lang.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)Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.