SE_xmlindexinfo_generate_from_doc
Generates an XML index by reading a sample document.
Usage syntax
LONG SE_xmlindexinfo_generate_from_doc
(SE_CONNECTION connection,
SE_XMLINDEXINFO xml_index,
SE_XMLDOC xml_doc);
Parameters
|
connection |
The current connection. |
|
xml_index |
An XML index object. |
|
xml_doc |
An XML document object. |
Description
This function generates a best-guess XML index definition or template from a sample document. It accumulates a list of unique tags and a best guess for their data types. The SE_XMLINDEXINFO structure must be previously allocated and initialized with a call to SE_xmlindexinfo_create.
The SE_XMLDOC object passed to this function must be valid and contain text. For example, you can initialize a new SE_XMLDOC object with SE_xmldoc_create and place text into it with SE_xmldoc_set_text.
You can build an XML index that is suitable for multiple documents by calling this function multiple times, providing additional example documents. The function is called once for each new document, specifying the same XMLINDEXINFO object each time. Additions and changes to the index are accumulated in the SE_XMLINDEXINFO object. With each call, the index description stored in the SE_XMLINDEXINFO object is updated with any new tags the function finds in the document.
If your application needs to clear any intermediate results in an SE_XMLINDEXINFO object, release the object with SE_xmlindexinfo_free and allocate a new one.
Returns
SE_SUCCESS
SE_INVALID_POINTER
SE_XML_PARSE_ERROR
SE_DB_IO_ERROR
SE_OUT_OF_SVMEM
SE_NET_FAILURE
Notes
After populating the SE_XMLINDEXINFO object, you can use it to create a new index template (using SE_xmlindex_create_template ) or add it to an SE_XMLCOLUMNINFO object (using SE_xmlcolumninfo_set_index ) which you can then use for creating an new XML column.
Doubles will automatically be demoted to strings when conflicts occur. For example, if a given tag has a value '10', it will be classified as a double. If the tag is encountered again in the current or subsequent document with a value of '10 feet', the data type will be changed (demoted) to a string.