IBM® Informix® 12.10

XML index parameters syntax

You can use XML index parameters to index XML tag and attribute values in separate fields either by tag name, attribute name, or by path.

When you do not use XML index parameters, XML documents are indexed as unstructured text. The XML tags, attributes, and values are included in searches and are indexed together in the contents field.

Any JSON or BSON documents in an XML document are indexed as unstructured text.

Include XML index parameters in the bts index definition when you create the bts index. See bts access method syntax.

Read syntax diagramSkip visual syntax diagram
XML Index Parameters

                         .-,-----.                         
                         V       |                 (1)     
|--+-xmltags--=--"--+-(----field-+--)---------+--"-----+-------->
   |                +-file:directory/filename-+        |   
   |                '-table:table.column------'        |   
   | .-,----------------------------------.            |   
   | V                             (2)    |            |   
   '---+-all_xmltags--=--+-"no"--+------+-+------------'   
       |                 '-"yes"-'      |                  
       |                            (3) |                  
       '-all_xmlattrs--=--+-"no"--+-----'                  
                          '-"yes"-'                        

   .-,-----------------------------------------.   
   V                                           |   
>----+---------------------------------------+-+----------------|
     |                                (4)    |     
     +-include_contents--=--+-"no"--+--------+     
     |                      '-"yes"-'        |     
     |                                  (5)  |     
     +-xmlpath_processing--=--+-"no"--+------+     
     |                        '-"yes"-'      |     
     |                             (6)       |     
     +-strip_xmltags--=--+-"no"--+-----------+     
     |                   '-"yes"-'           |     
     |                                  (7)  |     
     +-include_namespaces--=--+-"no"--+------+     
     |                        '-"yes"-'      |     
     |                                   (8) |     
     '-include_subtag_text--=--+-"no"--+-----'     
                               '-"yes"-'           

Notes:
  1. See The xmltags index parameter.
  2. See The all_xmltags index parameter.
  3. See The all_xmlattrs index parameter.
  4. See The include_contents index parameter.
  5. See The xmlpath_processing index parameter.
  6. See The strip_xmltags index parameter.
  7. See The include_namespaces index parameter.
  8. See The include_subtag_text index parameter.
Table 1. Options for XML index parameters
Element Description
column The column that contains tags to index.
directory The location of the file that contains tags to index.
field The XML tag or path to index. The field values can be full or relative XML paths if used with the xmlpath_processing parameter.
filename The name of the file that contains tags to index.
table The name of the table that contains the column with tags to index.

Example

For example, you have the following XML fragment:
<skipper>Captain Black</skipper>
You can create a bts index for searching the text within the <skipper> </skipper> tags:
CREATE INDEX boats_bts ON boats(xml_data bts_lvarchar_ops) 
USING bts(xmltags="(skipper)") IN bts_sbspace;
To search for a skipper's name that contains the word "Black," use the bts search predicate:
bts_contains(xml_data, 'skipper:black')


Examples exchange | Troubleshooting

To find the PDF, see Publications for the IBM Informix 12.10 family of products.
For the release notes, documentation notes, and/or machine notes, see the Release Notes page.