Example: Index XML paths

Use XML path processing to restrict searches by paths.

Given the XML fragment:
<boat>
	<skipper>Captain Black</skipper>
	<boatname>The Queen Anne's Revenge</boatname>
	<alternate>
		<skipper>Captain Blue Beard</skipper>
	</alternate>
</boat>
Following are the possible XML paths and text values:
/boat/skipper:Captain Black
/boat/boathame:The Queen Anne's Revenge
/boat/alterate/skipper:Captain Blue Beard
To create an index for boat/skipper and skipper, use the statement:
CREATE INDEX boats_bts ON boats(xml_data bts_lvarchar_ops) 
using bts(xmltags="(boat/skipper,skipper)",xmlpath_processing=”yes”) 
IN bts_sbspace;
Each path is compared to the values specified by the xmltags parameter. The index then creates fields for the entire first matching path found for each xmltags value. In this example, the first path matches boat/skipper. The third path matches skipper. The index will contain two fields that can be searched:
/boat/skipper:Captain Black
/boat/alterate/skipper:Captain Blue Beard