Skip to content
Johannes Lichtenberger edited this page Jan 11, 2019 · 8 revisions

In order to provide JSON-nodes within Sirix we need a node-transaction API similar to the XdmNodeReadTrx/XdmNodeWriteTrx-API for XML.

The JSON-resource is also bootstrapped with a DocumentRootNode.

JSONNodeWriteTrx:

  • insertObject() creates an empty object node and moves the node cursor to the created object node. Inserts the new nodeKey from the inserted object into the parent or the "left-sibling" node, even if there's no order among children in JSON. Otherwise a potential parent would grow and grow (which is always going to be copied).

Key:

  • insertObjectKey(String) creates an object-key node and moves the node cursor to the created object-key node

Value:

  • insertObjectValueString(String) creates a String node
  • insertObjectValueBoolean(boolean) creates a boolean node
  • insertObjectValueNull() creates a null node

on the object-key-node the insertObject()-method is valid as well as all of the following methods:

  • insertArray() creates an empty array and moves the node cursor to the created array node

  • insertStringAtIndex(int, String) (throws IndexOutOfBoundsException if necessary)

  • insertBooleanAtIndex(int, boolean) (throws IndexOutOfBoundsException if necessary)

  • insertNullAtIndex(int, null) (throws IndexOutOfBoundsException if necessary)

  • insertString(String) creates a String node

  • insertBoolean(boolean) creates a boolean node

  • insertNull() creates a null node

JSONNodeReadTrx:

moveTo(long), moveToObjectKey(long), moveToObjectValue(long)

Clone this wiki locally