Example: Index all XML tags
You can use the all_xmltags parameter to index all of the tags in a column.
Given the XML fragment:
<book>
<title>Graph Theory</title>
<author>Stewart</author>
<date edition="second">January 14, 2006</date>
</book>
To create an index for all the XML tags, use the SQL statement:
CREATE INDEX book_bts ON books(xml_data bts_lvarchar_ops)
USING bts(all_xmltags="yes") IN bts_sbspace;
The index will contain three fields that can be searched:
title:graph theory
author:stewart
date:january 14, 2006
The top level <book></book>
tags
are not indexed because they do not contain text values. The edition
attribute
is also not indexed.
If you enable path processing with the xmlpath_processing parameter,
you can index the full paths:
CREATE INDEX book_bts ON books(xml_data bts_lvarchar_ops)
USING bts(all_xmltags="yes",xmlpath_processing=”yes”) IN bts_sbspace;
The
index will contain three fields with full paths that can be searched:
/book/title:graph theory
/book/author:stewart
/book/date:january 14, 2006