次のように、TITLE属性を持つBOOKタグを定義するXMLファイルがあるとします。
<BOOK TITLE="Tale of Two Cities"> It was the best of times. </BOOK>
タイトル属性を属性セクションとして定義するには、次のようにXML_SECTION_GROUPを作成し、属性セクションを定義します。
begin
ctx_ddl.create_section_group('myxmlgroup', 'XML_SECTION_GROUP');
ctx_ddl.add_attr_section('myxmlgroup', 'booktitle', 'book@title');
end;
索引付けは、次のように行います。
CREATE INDEX myindex
ON xmldocs(xmlfile)
INDEXTYPE IS ctxsys.context
PARAMETERS ('datastore ctxsys.default_datastore
filter ctxsys.null_filter
section group myxmlgroup'
);
XML属性セクションbooktitleは、次のように問い合せることができます。
'Cities within booktitle'