Oracle8i Application Developer's Guide - XML Release 3 (8.1.7) Part Number A86030-01 |
Library | Service | Contents | Index

Using interMedia Text to Search and Retrieve Data from XML Documents, 15 of 22

## Querying SECTION GROUPS

### Distinguishing Tags Across DocTypes

In previous releases, the XML section group was unable to distinguish between tags in different DTD's. For instance, perhaps you have a DTD for storing contact information:

      <!DOCTYPE contact>
      <contact>
        <address>506 Blue Pool Road</address>
        <email>dudeman@radical.com</email>
      </contact>

Appropriate sections might look like:

      ctx_ddl.add_field_section('mysg','email',  'email');
      ctx_ddl.add_field_section('mysg','address','address');

This is fine until you have a different kind of document in the same table:

    <!DOCTYPE mail>
     <mail>
       <address>dudeman@radical.com</address>
    </mail>

Now your address section, originally intended for street addresses, starts picking up email addresses, because of tag collision.

### Specifying Doctype Limiters to Distinguish Between Tags

Oracle8i release 8.1.5 and higher allow you to specify doctype limiters to distinguish between these tags across doctypes. Simply specify the doctype in parentheses before the tag as follows:

      ctx_ddl.add_field_section('mysg','email','email');
      ctx_ddl.add_field_section('mysg','address','(contact)address');
      ctx_ddl.add_field_section('mysg','email','(mail)address');

Now when the XML section group sees an address tag, it will index it as the address section when the document type is`contact`, or as the email section when the document type is `mail`.

### Doctype-Limited and Unlimited Tags in a Section Group

If you have both doctype-limited and unlimited tags in a section group:

      ctx_ddl.add_field_section('mysg','sec1','(type1)tag1');
      ctx_ddl.add_field_section('mysg','sec2','tag1');

Then the limited tag applies when in the doctype, and the unlimited tag applies in all other doctypes.

Querying is unaffected by this -- the query is done on the section name, not the tag, so querying for an email address would be done like:

      radical WITHIN email

which, since we have mapped two different kinds of tags to the same section name, finds documents independent of which tags are used to express the email address.

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index