XML Examples tutorial
Making a freetext index Freetext index over XML data

## Preliminaries

- Virtuoso provides a compact and efficient free text indexing capability for text and XML data. A free text index can be created on any character column, including wide and long data.

- If the column being indexed is XML data, this can be declared and enforced by the text index. XML data will be indexed specially to support efficient XPATH predicate evaluation with the xcontains predicate.

      create_freetext_index
      	: CREATE TEXT [XML] INDEX ON q_table_name '(' column ')'
      	[WITH KEY column]
      	[NOT INSERT]
      	[CLUSTERED WITH '(' column_commalist ')' ]
      	[USING FUNCTION]
      	[LANGUAGE STRING]
      	;

- The XML keyword specifies that the data is to be indexed as XML, hence element names and attributes will be processed separately for use with the XCONTAINS predicate.

## Example

- The script inserts the files into the table.
- The data is stored as text, not as persistent XML.
- A VSP page shows the list of rows in the table.

- Each row has the following links:

  - XML source - send the XML text as escaped text enclosed in an HTML <pre> tag.
  - Raw XML - send the XML to the user agent, which must be able to render XML.