Class JsonHandlerMap

java.lang.Object
net.sf.saxon.ma.json.JsonHandler
net.sf.saxon.ma.json.JsonHandlerMap

public class JsonHandlerMap extends JsonHandler
Event handler for the JSON parser which constructs a structure of maps and arrays representing the content of the JSON text.
  • Field Details

  • Constructor Details

  • Method Details

    • setNullRepresentation

      public void setNullRepresentation(GroundedValue representation)
    • getResult

      public Sequence getResult()
      Overrides:
      getResult in class JsonHandler
    • setKey

      public boolean setKey(UnicodeString key)
      Set the key to be written for the next entry in an object/map
      Overrides:
      setKey in class JsonHandler
      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:
      startArray in class JsonHandler
    • endArray

      public void endArray() throws XPathException
      Close the current array
      Overrides:
      endArray in class JsonHandler
      Throws:
      XPathException - if any error occurs
    • startMap

      public void startMap()
      Start a new object/map
      Overrides:
      startMap in class JsonHandler
    • endMap

      public void endMap() throws XPathException
      Close the current object/map
      Overrides:
      endMap in class JsonHandler
      Throws:
      XPathException - if any error occurs
    • writeNumeric

      public void writeNumeric(String asString, Item parsedValue) throws XPathException
      Write a numeric value
      Overrides:
      writeNumeric in class JsonHandler
      Parameters:
      asString - the string representation of the value
      parsedValue - the double representation of the value
      Throws:
      XPathException - if any error occurs
    • writeString

      public void writeString(UnicodeString val) throws XPathException
      Write a string value
      Overrides:
      writeString in class JsonHandler
      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

      public void writeBoolean(boolean value) throws XPathException
      Write a boolean value
      Overrides:
      writeBoolean in class JsonHandler
      Parameters:
      value - the boolean value to be written
      Throws:
      XPathException - if any error occurs
    • writeNull

      public void writeNull() throws XPathException
      Write a null value
      Overrides:
      writeNull in class JsonHandler
      Throws:
      XPathException - if any error occurs