public class JsonHandlerXML extends Object implements JsonHandler
| Modifier and Type | Field and Description |
|---|---|
boolean |
allowAnyTopLevel |
static String |
JSON_NS |
boolean |
liberal |
static String |
PREFIX |
static String |
SCHEMA_URI |
HashMap<String,SchemaType> |
types |
boolean |
unescape |
boolean |
validate |
| Constructor and Description |
|---|
JsonHandlerXML(XPathContext context,
int flags)
Make the handler to construct the XML tree representation for JSON
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
containsEscape(String literal)
Check whether a string contains an escape sequence
|
void |
endArray()
Close the current array
|
void |
endMap()
Close the current object/map
|
Item |
getResult()
Return the complete parsed result
|
void |
setKey(String key)
Set the key to be written for the next entry in an object/map
|
void |
setType(String name,
SchemaType st)
Record a SchemaType for a particular name
|
void |
startArray()
Open a new array
|
void |
startMap()
Start a new object/map
|
void |
writeBoolean(boolean value)
Write a boolean value
|
void |
writeNull()
Write a null value
|
void |
writeNumeric(String asString,
double asDouble)
Write a numeric value
|
void |
writeString(String val)
Write a string value
|
public boolean unescape
public boolean allowAnyTopLevel
public boolean liberal
public boolean validate
public static final String SCHEMA_URI
public static final String JSON_NS
public static final String PREFIX
public HashMap<String,SchemaType> types
public JsonHandlerXML(XPathContext context, int flags) throws XPathException
context - the context in which the result tree is to be builtflags - flags indicating the chosen optionsXPathException - if initialization fails, for example because of problems loading the schemapublic void setType(String name, SchemaType st)
name - the name to be used for the type, e.g. "arrayType"st - the schema type to be used for typing such entitiespublic void setKey(String key)
setKey in interface JsonHandlerkey - the key for the entry - null implies no keypublic Item getResult() throws XPathException
getResult in interface JsonHandlerXPathExceptionprotected boolean containsEscape(String literal)
literal - the string to be checkedpublic void startArray()
throws XPathException
startArray in interface JsonHandlerXPathException - if a dynamic error occurspublic void endArray()
throws XPathException
endArray in interface JsonHandlerXPathException - if a dynamic error occurspublic void startMap()
throws XPathException
startMap in interface JsonHandlerXPathException - if a dynamic error occurspublic void endMap()
throws XPathException
endMap in interface JsonHandlerXPathException - if a dynamic error occurspublic void writeNumeric(String asString, double asDouble) throws XPathException
writeNumeric in interface JsonHandlerasString - the string representation of the valueasDouble - the double representation of the valueXPathException - if a dynamic error occurspublic void writeString(String val) throws XPathException
writeString in interface JsonHandlerval - the string to be written. This will be in unescaped form if unescaping was requested
in the flags, otherwise it may contain JSON escape sequencesXPathException - if a dynamic error occurspublic void writeBoolean(boolean value)
throws XPathException
writeBoolean in interface JsonHandlervalue - the boolean value to be writtenXPathException - if a dynamic error occurspublic void writeNull()
throws XPathException
writeNull in interface JsonHandlerXPathException - if a dynamic error occursCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.