TRIPsystem Kernel API 8.3
Loading...
Searching...
No Matches
JSON/XML Functions

Functions for interaction with JSON/XML databases. More...

Functions

int TdbExecuteXPath (const char *xpath, int *searchSet)
 
int TdbGetJsonBuffer (TdbHandle recordControl, char **jsondata, int *length)
 
int TdbGetXmlBuffer (TdbHandle recordControl, char **xmldata, int *length)
 
int TdbGetXmlFragments (int searchSetNo, const char *xpath, int startRis, int endRis, boolean highlight, void **buffer, int *length)
 
int TdbPutJsonBuffer (TdbHandle recordControl, const char *jsondata, int length)
 
int TdbPutJsonFile (TdbHandle recordControl, const char *jsonfile)
 
int TdbPutXmlBuffer (TdbHandle recordControl, boolean storeCopy, boolean validate, const char *xmldata, int length)
 
int TdbPutXmlFile (TdbHandle recordControl, boolean storeCopy, boolean validate, const char *xmlfile)
 

Detailed Description

Functions for interaction with JSON/XML databases.

Commands to programmatically interact with JSON/XML databases, primarily to load JSON and XML documents into TRIPxml databases, and to read JSON and XML documents from TRIPxml databases.

Function Documentation

◆ TdbExecuteXPath()

int TdbExecuteXPath ( const char *  xpath,
int *  searchSet 
)

Execute an XPath based query on a JSON/XML database.

Parameters
xpathXPath query expression
searchSetReceives the number of the resulting serch set.
Returns
1 or other odd value on success, even value on error

Description

The use of this function requries that the session is started in Unicode (UTF-8) mode, and that a JSON/XML database ís currently open for search.

Refer to the TRIPsystem product document "JSON and XML Databases" for information about the supported XPath syntax.

Use the value returned in the searchSet parameter with the TdbSearchInfo() function to obtain information about record and hit count.

◆ TdbGetJsonBuffer()

int TdbGetJsonBuffer ( TdbHandle  recordControl,
char **  jsondata,
int *  length 
)

Get a JSON/XML record formatted as a JSON document.

Parameters
recordControlRecord control associated with a JSON/XML database
jsondataReceives a buffer containing the JSON document
lengthReceives the length of the data returned in jsondata
Returns
1 or other odd value on success, even value on error

Description

The buffer returned in jsondata must be deallocated by the caller. Use the free() function for this purpose on Linux/UNIX. On Windows, it is necessary to use HeapFree() Win32 API function on the heap returned by the GetProcessHeap() Win32 API function. Using the regular free() function to release this memory will on Windows cause a crash or put the application into an unstable state.

◆ TdbGetXmlBuffer()

int TdbGetXmlBuffer ( TdbHandle  recordControl,
char **  xmldata,
int *  length 
)

Get a JSON/XML record formatted as an XML document.

Parameters
recordControlRecord control associated with a JSON/XML database
xmldataReceives a buffer containing the XML document
lengthReceives the length of the data returned in xmldata
Returns
1 or other odd value on success, even value on error

Description

The buffer returned in xmldata must be deallocated by the caller. Use the free() function for this purpose on Linux/UNIX. On Windows, it is necessary to use HeapFree() Win32 API function on the heap returned by the GetProcessHeap() Win32 API function. Using the regular free() function to release this memory will on Windows cause a crash or put the application

◆ TdbGetXmlFragments()

int TdbGetXmlFragments ( int  searchSetNo,
const char *  xpath,
int  startRis,
int  endRis,
boolean  highlight,
void **  buffer,
int *  length 
)

Get a JSON/XML search result formatted as an XML fragment set document.

Parameters
searchSetNoNumber of a search in a JSON/XML database
xpathXPath expression to use for the selection of document fragments
startRisThe ordinal number of the record in the search at which to start extracting fragments
endRisThe ordinal number of the record in the search at which to stop extracting fragments
highlightPass true to apply search set highlighting markup to the resulting document
bufferReceives a buffer containing the requested fragment set
lengthReceives the length of the data returned in buffer
Returns
1 or other odd value on success, even value on error

Description

This function uses an XPath expression to transform a search set of TRIPxml records containing XML or JSON documents into a single XML document with fragments from each document. The XPath expression is used to specify the fragment to include from each document in the output.

Refer to the TRIPsystem product document "JSON and XML Databases" for information about the supported XPath syntax.

The buffer returned in buffer must be deallocated by the caller. Use the free() function for this purpose on Linux/UNIX. On Windows, it is necessary to use HeapFree() Win32 API function on the heap returned by the GetProcessHeap() Win32 API function. Using the regular free() function to release this memory will on Windows cause a crash or put the application into an unstable state.

◆ TdbPutJsonBuffer()

int TdbPutJsonBuffer ( TdbHandle  recordControl,
const char *  jsondata,
int  length 
)

Store an in-memory JSON document into a JSON/XML database.

Parameters
recordControlRecord control associated with a JSON/XML database
jsondataJSON document contents
lengthThe length of the data in jsondata.
Returns
1 or other odd value on success, even value on error

Description

If this function succeeds, the record is ready for further customization by the application, and when/if no further customization is needed, to commit to the database using the TdbPutRecord() function.

See also
TdbPutRecord()

◆ TdbPutJsonFile()

int TdbPutJsonFile ( TdbHandle  recordControl,
const char *  jsonfile 
)

Store a JSON document file into a JSON/XML database.

Parameters
recordControlRecord control associated with a JSON/XML database
jsonfileName of a local JSON file to import
Returns
1 or other odd value on success, even value on error

Description

If this function succeeds, the record is ready for further customization by the application, and when/if no further customization is needed, to commit to the database using the TdbPutRecord() function.

See also
TdbPutRecord()

◆ TdbPutXmlBuffer()

int TdbPutXmlBuffer ( TdbHandle  recordControl,
boolean  storeCopy,
boolean  validate,
const char *  xmldata,
int  length 
)

Store an in-memory XML document into a JSON/XML database.

Parameters
recordControlRecord control associated with a JSON/XML database
storeCopyPass true to store a binary copy in the D_XMLDOC field
validatePass true to validate the XML according to DTD or Schema
xmldataXML document contents
lengthThe length of the data in xmldata.
Returns
1 or other odd value on success, even value on error

Description

If this function succeeds, the record is ready for further customization by the application, and when/if no further customization is needed, to commit to the database using the TdbPutRecord() function.

See also
TdbPutRecord()

◆ TdbPutXmlFile()

int TdbPutXmlFile ( TdbHandle  recordControl,
boolean  storeCopy,
boolean  validate,
const char *  xmlfile 
)

Store an XML document file into a JSON/XML database.

Parameters
recordControlRecord control associated with a JSON/XML database
storeCopyPass true to store a binary copy in the D_XMLDOC field
validatePass true to validate the XML according to DTD or Schema
xmlfileName of a local XML file to import
Returns
1 or other odd value on success, even value on error

Description

If this function succeeds, the record is ready for further customization by the application, and when/if no further customization is needed, to commit to the database using the TdbPutRecord() function.

See also
TdbPutRecord()