TRIPsystem Kernel API 8.3
|
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) |
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.
int TdbExecuteXPath | ( | const char * | xpath, |
int * | searchSet | ||
) |
Execute an XPath based query on a JSON/XML database.
xpath | XPath query expression |
searchSet | Receives the number of the resulting serch set. |
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.
int TdbGetJsonBuffer | ( | TdbHandle | recordControl, |
char ** | jsondata, | ||
int * | length | ||
) |
Get a JSON/XML record formatted as a JSON document.
recordControl | Record control associated with a JSON/XML database |
jsondata | Receives a buffer containing the JSON document |
length | Receives the length of the data returned in jsondata |
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.
int TdbGetXmlBuffer | ( | TdbHandle | recordControl, |
char ** | xmldata, | ||
int * | length | ||
) |
Get a JSON/XML record formatted as an XML document.
recordControl | Record control associated with a JSON/XML database |
xmldata | Receives a buffer containing the XML document |
length | Receives the length of the data returned in xmldata |
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
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.
searchSetNo | Number of a search in a JSON/XML database |
xpath | XPath expression to use for the selection of document fragments |
startRis | The ordinal number of the record in the search at which to start extracting fragments |
endRis | The ordinal number of the record in the search at which to stop extracting fragments |
highlight | Pass true to apply search set highlighting markup to the resulting document |
buffer | Receives a buffer containing the requested fragment set |
length | Receives the length of the data returned in buffer |
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.
int TdbPutJsonBuffer | ( | TdbHandle | recordControl, |
const char * | jsondata, | ||
int | length | ||
) |
Store an in-memory JSON document into a JSON/XML database.
recordControl | Record control associated with a JSON/XML database |
jsondata | JSON document contents |
length | The length of the data in jsondata . |
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.
int TdbPutJsonFile | ( | TdbHandle | recordControl, |
const char * | jsonfile | ||
) |
Store a JSON document file into a JSON/XML database.
recordControl | Record control associated with a JSON/XML database |
jsonfile | Name of a local JSON file to import |
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.
int TdbPutXmlBuffer | ( | TdbHandle | recordControl, |
boolean | storeCopy, | ||
boolean | validate, | ||
const char * | xmldata, | ||
int | length | ||
) |
Store an in-memory XML document into a JSON/XML database.
recordControl | Record control associated with a JSON/XML database |
storeCopy | Pass true to store a binary copy in the D_XMLDOC field |
validate | Pass true to validate the XML according to DTD or Schema |
xmldata | XML document contents |
length | The length of the data in xmldata . |
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.
int TdbPutXmlFile | ( | TdbHandle | recordControl, |
boolean | storeCopy, | ||
boolean | validate, | ||
const char * | xmlfile | ||
) |
Store an XML document file into a JSON/XML database.
recordControl | Record control associated with a JSON/XML database |
storeCopy | Pass true to store a binary copy in the D_XMLDOC field |
validate | Pass true to validate the XML according to DTD or Schema |
xmlfile | Name of a local XML file to import |
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.