Full paths and relative paths in path processing
The XML path can be either a full path or a relative path.
Full paths
Full paths begins with a slash (/). If you use the all_xmltags parameter with xmlpath_processing, all of the full paths are indexed. You can index specific full or relative paths when you use the xmltags parameter.
Given
the XML fragment:
<text>
<book>
<title>Graph Theory</title>
<author>Stewart</author>
<date>January 14, 2006</date>
</book>
<text>
The following full XML paths can be processed
with the xmlpath_processing parameter:
/text/book/title
/text/book/author
/text/book/date
Tip: If you have indexed
a full path, include the initial slash (/) in the search predicate.
For example:
bts_contains("/text/book/author:stewart")
Relative paths
Relative paths begin with text. You can specify one or more relative or full paths with the xmltags parameter.
Based
on the preceding XML fragment, each of the following relative XML
paths can be processed with the xmlpath_processing parameter:
text/book/title
text/book/author
text/book/date
book/title
book/author
book/date
title
author
date
The field is created from the first matching path for the values specified with the xmltags parameter.
You
can create an index for the
book/title
and the title
fields: CREATE INDEX books_bts ON books(xml_data bts_lvarchar_ops)
using bts(xmltags="(book/title,title)",xmlpath_processing=”yes”)
IN bts_sbspace;
In that case, the index will contain
only the first matching field,
book/title
. It will
not contain a title
field: book/title:Graph Theory
To view the fields that you have indexed, use the bts_index_fields() function. See bts_index_fields() function.