Package net.sf.saxon.ma.json
Class JsonHandlerMap
java.lang.Object
net.sf.saxon.ma.json.JsonHandler
net.sf.saxon.ma.json.JsonHandlerMap
Event handler for the JSON parser which constructs a structure of maps and arrays
representing the content of the JSON text.
-
Field Summary
FieldsFields inherited from class net.sf.saxon.ma.json.JsonHandler
charChecker, escape -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidendArray()Close the current arrayvoidendMap()Close the current object/mapbooleansetKey(UnicodeString key) Set the key to be written for the next entry in an object/mapvoidsetNullRepresentation(GroundedValue representation) voidOpen a new arrayvoidstartMap()Start a new object/mapvoidwriteBoolean(boolean value) Write a boolean valuevoidWrite a null valuevoidwriteNumeric(String asString, Item parsedValue) Write a numeric valuevoidwriteString(UnicodeString val) Write a string valueMethods inherited from class net.sf.saxon.ma.json.JsonHandler
getContext, getFallbackFunction, markAsEscaped, setContext, setFallbackFunction
-
Field Details
-
keys
-
-
Constructor Details
-
JsonHandlerMap
-
-
Method Details
-
setNullRepresentation
-
getResult
- Overrides:
getResultin classJsonHandler
-
setKey
Set the key to be written for the next entry in an object/map- Overrides:
setKeyin classJsonHandler- Parameters:
key- the key for the entry (null implies no key) in unescaped form (backslashes, if present, do not signal an escape sequence)- Returns:
- true if the key is already present in the map, false if it is not
-
startArray
public void startArray()Open a new array- Overrides:
startArrayin classJsonHandler
-
endArray
Close the current array- Overrides:
endArrayin classJsonHandler- Throws:
XPathException- if any error occurs
-
startMap
public void startMap()Start a new object/map- Overrides:
startMapin classJsonHandler
-
endMap
Close the current object/map- Overrides:
endMapin classJsonHandler- Throws:
XPathException- if any error occurs
-
writeNumeric
Write a numeric value- Overrides:
writeNumericin classJsonHandler- Parameters:
asString- the string representation of the valueparsedValue- the double representation of the value- Throws:
XPathException- if any error occurs
-
writeString
Write a string value- Overrides:
writeStringin classJsonHandler- Parameters:
val- The string to be written (which may or may not contain JSON escape sequences, according to the options that were set)- Throws:
XPathException- if a dynamic error occurs
-
writeBoolean
Write a boolean value- Overrides:
writeBooleanin classJsonHandler- Parameters:
value- the boolean value to be written- Throws:
XPathException- if any error occurs
-
writeNull
Write a null value- Overrides:
writeNullin classJsonHandler- Throws:
XPathException- if any error occurs
-