Package net.sf.saxon.serialize
Class JSONEmitter
- java.lang.Object
- 
- net.sf.saxon.serialize.JSONEmitter
 
- 
 public class JSONEmitter extends java.lang.ObjectThis class implements the back-end text generation of the JSON serialization method. It takes as input a sequence of event-based calls such as startArray, endArray, startMap, endMap, and generates the lexical JSON output.
- 
- 
Constructor SummaryConstructors Constructor Description JSONEmitter(PipelineConfiguration pipe, UnicodeWriter writer, java.util.Properties outputProperties)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()End of the document.voidendArray()Output the end of an arrayvoidendMap()java.util.PropertiesgetOutputProperties()Get the output propertiesvoidsetCharacterMap(CharacterMap map)Set the CharacterMap to be used, if anyvoidsetMustClose(boolean mustClose)Say whether the output must be closed on completionvoidsetNormalizationForm(java.text.Normalizer.Form form)Set the Unicode normalizer to be used for normalizing strings.voidsetOutputProperties(java.util.Properties details)Set output propertiesvoidstartArray(boolean oneLiner)Output the start of an array.voidstartMap(boolean oneLiner)Output the start of an map.voidwriteAtomicValue(AtomicValue item)Append a singleton value (number, string, or boolean) to the outputvoidwriteKey(java.lang.String key)Output the key for an entry in a map.
 
- 
- 
- 
Constructor Detail- 
JSONEmitterpublic JSONEmitter(PipelineConfiguration pipe, UnicodeWriter writer, java.util.Properties outputProperties) 
 
- 
 - 
Method Detail- 
setMustClosepublic void setMustClose(boolean mustClose) Say whether the output must be closed on completion- Parameters:
- mustClose- true if the output must be closed
 
 - 
setOutputPropertiespublic void setOutputProperties(java.util.Properties details) Set output properties- Parameters:
- details- the output serialization properties
 
 - 
getOutputPropertiespublic java.util.Properties getOutputProperties() Get the output properties- Returns:
- the properties that were set using setOutputProperties
 
 - 
setNormalizationFormpublic void setNormalizationForm(java.text.Normalizer.Form form) Set the Unicode normalizer to be used for normalizing strings.- Parameters:
- form- the normalization form to be used (default is no normalization)
 
 - 
setCharacterMappublic void setCharacterMap(CharacterMap map) Set the CharacterMap to be used, if any- Parameters:
- map- the character map
 
 - 
writeKeypublic void writeKey(java.lang.String key) throws XPathExceptionOutput the key for an entry in a map. The corresponding value must be supplied in the following call.- Parameters:
- key- the value of the key, without any escaping of special characters
- Throws:
- XPathException- if any error occurs
 
 - 
writeAtomicValuepublic void writeAtomicValue(AtomicValue item) throws XPathException Append a singleton value (number, string, or boolean) to the output- Parameters:
- item- the atomic value to be appended, or null to append "null"
- Throws:
- XPathException- if the operation fails
 
 - 
startArraypublic void startArray(boolean oneLiner) throws XPathExceptionOutput the start of an array. This call must be followed by the members of the array, followed by a call onendArray().- Parameters:
- oneLiner- True if the caller thinks the value should be output without extra newlines after the open bracket or before the close bracket, even when indenting is on.
- Throws:
- XPathException- if any failure occurs
 
 - 
endArraypublic void endArray() throws XPathExceptionOutput the end of an array- Throws:
- XPathException- if any failure occurs
 
 - 
startMappublic void startMap(boolean oneLiner) throws XPathExceptionOutput the start of an map. This call must be followed by the entries in the map (each starting with a call onwriteKey(String), followed by a call onendMap().- Parameters:
- oneLiner- True if the caller thinks the value should be output without extra newlines after the open bracket or before the close bracket, even when indenting is on.
- Throws:
- XPathException- if any failure occurs
 
 - 
endMappublic void endMap() throws XPathException- Throws:
- XPathException
 
 - 
closepublic void close() throws XPathExceptionEnd of the document.- Throws:
- XPathException- if any error occurs
 
 
- 
 
-