Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 71d40963b505df4524269198e237b3e3 > files > 991

virtuoso-opensource-doc-6.1.4-2.fc14.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
 <head profile="http://internetalchemy.org/2003/02/profile">
  <link rel="foaf" type="application/rdf+xml" title="FOAF" href="http://www.openlinksw.com/dataspace/uda/about.rdf" />
  <link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" />
  <meta name="dc.title" content="13. XML Support" />
  <meta name="dc.subject" content="13. XML Support" />
  <meta name="dc.creator" content="OpenLink Software Documentation Team ;&#10;" />
  <meta name="dc.copyright" content="OpenLink Software, 1999 - 2009" />
  <link rel="top" href="index.html" title="OpenLink Virtuoso Universal Server: Documentation" />
  <link rel="search" href="/doc/adv_search.vspx" title="Search OpenLink Virtuoso Universal Server: Documentation" />
  <link rel="parent" href="webandxml.html" title="Chapter Contents" />
  <link rel="prev" href="webappdevelopment.html" title="Web Application Development" />
  <link rel="next" href="forxmlforsql.html" title="Rendering SQL Queries as XML (FOR XML Clause)" />
  <link rel="shortcut icon" href="../images/misc/favicon.ico" type="image/x-icon" />
  <link rel="stylesheet" type="text/css" href="doc.css" />
  <link rel="stylesheet" type="text/css" href="/doc/translation.css" />
  <title>13. XML Support</title>
  <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
  <meta name="author" content="OpenLink Software Documentation Team ;&#10;" />
  <meta name="copyright" content="OpenLink Software, 1999 - 2009" />
  <meta name="keywords" content="" />
  <meta name="GENERATOR" content="OpenLink XSLT Team" />
 </head>
 <body>
  <div id="header">
    <a name="webandxml" />
    <img src="../images/misc/logo.jpg" alt="" />
    <h1>13. XML Support</h1>
  </div>
  <div id="navbartop">
   <div>
      <a class="link" href="webandxml.html">Chapter Contents</a> | <a class="link" href="rubyhosting.html" title="Ruby Hosting">Prev</a> | <a class="link" href="forxmlforsql.html" title="Rendering SQL Queries as XML (FOR XML Clause)">Next</a>
   </div>
  </div>
  <div id="currenttoc">
   <form method="post" action="/doc/adv_search.vspx">
    <div class="search">Keyword Search: <br />
        <input type="text" name="q" /> <input type="submit" name="go" value="Go" />
    </div>
   </form>
   <div>
      <a href="http://www.openlinksw.com/">www.openlinksw.com</a>
   </div>
   <div>
      <a href="http://docs.openlinksw.com/">docs.openlinksw.com</a>
   </div>
    <br />
   <div>
      <a href="index.html">Book Home</a>
   </div>
    <br />
   <div>
      <a href="contents.html">Contents</a>
   </div>
   <div>
      <a href="preface.html">Preface</a>
   </div>
    <br />
   <div>
      <a href="overview.html">Overview</a>
   </div>
   <div>
      <a href="installation.html">Installation Guide</a>
   </div>
   <div>
      <a href="quicktours.html">Quick Start &amp; Tours</a>
   </div>
   <div>
      <a href="sampleapps.html">Sample ODBC &amp; JDBC Applications</a>
   </div>
   <div>
      <a href="concepts.html">Conceptual Overview</a>
   </div>
   <div>
      <a href="server.html">Administration</a>
   </div>
   <div>
      <a href="accessinterfaces.html">Data Access Interfaces</a>
   </div>
   <div>
      <a href="sqlreference.html">SQL Reference</a>
   </div>
   <div>
      <a href="sqlprocedures.html">SQL Procedure Language Guide</a>
   </div>
   <div>
      <a href="hooks.html">Database Event Hooks</a>
   </div>
   <div>
      <a href="repl.html">Data Replication, Synchronization and Transformation Services</a>
   </div>
   <div>
      <a href="webappdevelopment.html">Web Application Development</a>
   </div>
   <div class="selected">
      <a href="webandxml.html">XML Support</a>
    <div>
        <a href="forxmlforsql.html" title="Rendering SQL Queries as XML (FOR XML Clause)">Rendering SQL Queries as XML (FOR XML Clause)</a>
    </div>
    <div>
        <a href="composingxmlinsql.html" title="XML Composing Functions in SQL Statements (SQLX)">XML Composing Functions in SQL Statements (SQLX)</a>
    </div>
    <div>
        <a href="xmlservices.html" title="Virtuoso XML Services">Virtuoso XML Services</a>
    </div>
    <div>
        <a href="queryingxmldata.html" title="Querying Stored XML Data">Querying Stored XML Data</a>
    </div>
    <div>
        <a href="updategrams.html" title="Using UpdateGrams to Modify Data">Using UpdateGrams to Modify Data</a>
    </div>
    <div>
        <a href="xmltemplates.html" title="XML Templates">XML Templates</a>
    </div>
    <div>
        <a href="xmlschema.html" title="XML DTD and XML Schemas">XML DTD and XML Schemas</a>
    </div>
    <div>
        <a href="xq.html" title="XQuery 1.0 Support">XQuery 1.0 Support</a>
    </div>
    <div>
        <a href="xslttrans.html" title="XSLT Transformation">XSLT Transformation</a>
    </div>
    <div>
        <a href="xmltype.html" title="XMLType">XMLType</a>
    </div>
    <div>
        <a href="xmldom.html" title="Changing XML entities in DOM style">Changing XML entities in DOM style</a>
    </div>
   </div>
   <div>
      <a href="rdfandsparql.html">RDF Data Access and Data Management</a>
   </div>
   <div>
      <a href="webservices.html">Web Services</a>
   </div>
   <div>
      <a href="runtimehosting.html">Runtime Hosting</a>
   </div>
   <div>
      <a href="internetservices.html">Internet Services</a>
   </div>
   <div>
      <a href="freetext.html">Free Text Search</a>
   </div>
   <div>
      <a href="tpcc.html">TPC C Benchmark Kit</a>
   </div>
   <div>
      <a href="xa.html">Using Virtuoso with Tuxedo</a>
   </div>
   <div>
      <a href="appendixa.html">Appendix</a>
   </div>
   <div>
      <a href="functions.html">Virtuoso Functions Guide</a>
   </div>
    <br />
  </div>
  <div id="text">
   <div class="abstract">
      <h2>Abstract</h2>
      <p>This chapter covers Virtuoso&#39;s XML, full text retrieval and related functions.</p>
      <p>Virtuoso provides free text indexing capabilities for
    textual data, including XML data.  Virtuoso supports extraction of
    XML documents from SQL datasets.  It also supports <a href="fn_xpath_eval.html">XPath</a>,
<a href="xq.html">XQuery</a>,
    <a href="xslttrans.html">XSLT</a> and XML Schema validation.</p>
      <p>
An SQL long varchar, long xml or xmltype column in a database table can contain XML data as text or in a binary serialized format, respectively. If
 a column value is a well-formed XML fragment there are
special operations that can be performed on the value.
There is an SQL data type that represents an XML entity.
A string representing a
well-formed XML entity can be converted into an entity object
representing the root node.  XPath expressions can then be applied to
the entity in order to retrieve other entities or sets of entities.
Returning an XML entity to a client application or printing it out on
a dynamic web page will produce the text representation of the entity,
complete with start and end tags, attributes, namespaces, and so forth.
</p>
      <p>
An entity object can be stored as a value of a long varchar or varchar
column. This will produce and store the text corresponding to the
entity. Storing the same into a long xml or xmltype column will provide a more compact representation and will guarantee well-formedness and optionally schema validity, even if the data comes in as text.
</p>
      <p>
A long varchar column can contain huge XML documents as special
&quot;persistent XML entity&quot; objects. XML entities of this sort
consume only a little amount of memory and load small portions of data from
disk to memory on demand; an application can handle XML documents that
are order of magnitude larger than the amount of available memory.
<a href="sqlrefxmldatatype.html">LONG XML</a> column type is convenient
if a column contains only valid XML documents. An application can save
XML entities to LONG XML columns and retrieve them back without calling any
type conversion functions.
A special user-defined type <a href="">XMLType</a>
allows the use of an XML entity as a base for deriving user-defined types from it.
</p>
      <p>
The <a href="">xpath_contains</a> SQL predicate can be used to
test whether a column value matches a given XPath expression.  If the
XPath expression specifies a node set and that set is non-empty for a
given column value, it is possible to bind a result variable to each
element of the set.  In this way a single row of data in a table can
produce multiple rows in an SQL result set, one for each entity
selected by the XPath predicate.
</p>
      <p>
If there is a free text index on a column it is possible to define
that the content be checked for well-formedness.  In this case both
<a href="queryingftcols.html#containspredicate">contains</a> and
<a href="">xpath_contains</a> predicates can be applied to the
same column in the same query.  You should create a free text index on
your XML data if you expect any content-based searches. The free text
index will recognize specific features of XML and allow their use in
searches.
 </p>
      <p>
The <a href="queryingxmldata.html#xcontainspredicate">xcontains</a> SQL predicate is a combination of
XPath and free text, making automatic use of the free text index for
evaluating an XPath expression.  This predicate also allows you to
test text values of entities for complex free text conditions such as
proximity.
</p>
      <p>
There is a user interface for using this feature on DAV resources.
The use of the <a href="">xpath_contains</a> predicate is not
limited to DAV resources though.  The use of XPath with XML values is
independent of free text indexing and of XML views.
</p>
      <p>
Virtuoso offers functions for XPath processing of well-formed XML
strings in SQL.  Together with the Virtuoso free text support, these
functions offer a powerful free-form and structured content retrieval
system.  You can search for XPath matches in any XML-populated column.
One practical example would be the RES_CONTENT column of the
WS.WS.SYS_DAV_RES table, which contains the contents of documents
stored in the WebDAV repository.  As with the sample database, which
contains the XML sources for this documentation, you may store XML
documents directly in the WebDAV repository.
</p>
      <p>
An SQL statement can return complex XML documents based on relational data.
Virtuoso supports both Microsoft&#39;s &quot;FOR XML&quot; syntax and the standard set of SQLX XML
composing functions like
<a href="fn_XMLELEMENT.html">XMLELEMENT</a> and
<a href="fn_XMLAGG.html">XMLAGG</a>.
Very complicated processing can be done in a single statement that combines
XML composing functions, <a href="fn_xquery_eval.html">xquery_eval</a>
and <a href="fn_xslt.html">xslt</a>.
</p>
      <p>
Virtuoso/PL routines can modify XML entities in DOM style (functions like
<a href="fn_XMLAppendChildren.html">XMLAppendChildren</a>
and
<a href="fn_XMLReplace.html">XMLReplace</a>). Doing local changes this way
can be simpler than via XSLT or XQuery; DOM modifications also help speed-critical applications
to avoid unnecessary copying of data.
</p>
      <p>
Virtuoso&#39;s XML parser can read XML documents of any complexity.
It can validate source documents against DTD and XML schema,
load compound documents or their fragments,
recover from errors in ill-formed HTML documents like popular browsers can.
</p>
   </div>
    <h2>Table of Contents</h2>
   <div class="minitoc">
    <div>
        <a class="sect1" href="forxmlforsql.html">13.1. Rendering SQL Queries as XML (FOR XML Clause)</a>
    </div>
    <div>
        <a class="sect2" href="forxmlforsql.html#forxmlexplicmode">13.1.1. FOR XML EXPLICIT Mode</a>
    </div>
    <div>
        <a class="sect2" href="forxmlforsql.html#examplesofforxml">13.1.2. Examples of FOR XML</a>
    </div>
    <div>
        <a class="sect2" href="forxmlforsql.html#forxmlfunc">13.1.3. Functions</a>
    </div>
    <div>
        <a class="sect2" href="forxmlforsql.html#forxmlsyntax">13.1.4. FOR XML Syntax</a>
    </div>
    <div>
        <a class="sect1" href="composingxmlinsql.html">13.2. XML Composing Functions in SQL Statements (SQLX)</a>
    </div>
    <div>
        <a class="sect1" href="xmlservices.html">13.3. Virtuoso XML Services</a>
    </div>
    <div>
        <a class="sect2" href="xmlservices.html#xpath_sql">13.3.1. XPATH Implementation and SQL</a>
    </div>
    <div>
        <a class="sect2" href="xmlservices.html#XPATHopts">13.3.2. XPATH Query Options</a>
    </div>
    <div>
        <a class="sect2" href="xmlservices.html#xmlviews1">13.3.3. XML Views - Representing SQL Data as Dynamic and Persistent XML</a>
    </div>
    <div>
        <a class="sect2" href="xmlservices.html#xmlviewextentref">13.3.4. External Entity References in Stored XML</a>
    </div>
    <div>
        <a class="sect2" href="xmlservices.html#xpproc">13.3.5. Using XPATH in SQL Queries and Procedures</a>
    </div>
    <div>
        <a class="sect2" href="xmlservices.html#xquery_sql">13.3.6. XQUERY and XML view</a>
    </div>
    <div>
        <a class="sect2" href="xmlservices.html#mapping_schemas">13.3.7. Mapping Schemas as XML Views</a>
    </div>
    <div>
        <a class="sect2" href="xmlservices.html#view4xmldifferences">13.3.8. Differences Between SQLX, FOR XML and XML Views</a>
    </div>
    <div>
        <a class="sect1" href="queryingxmldata.html">13.4. Querying Stored XML Data</a>
    </div>
    <div>
        <a class="sect2" href="queryingxmldata.html#xpathcontainsSQLPred">13.4.1. XPATH_CONTAINS SQL Predicate</a>
    </div>
    <div>
        <a class="sect2" href="queryingxmldata.html#qryusingxpath_eval">13.4.2. Using xpath_eval()</a>
    </div>
    <div>
        <a class="sect2" href="queryingxmldata.html#wxmlextentrefinxml">13.4.3. External Entity References in Stored XML</a>
    </div>
    <div>
        <a class="sect2" href="queryingxmldata.html#wamlschmdtdfuncs">13.4.4. XML Schema &amp; DTD Functions</a>
    </div>
    <div>
        <a class="sect2" href="queryingxmldata.html#usingxmlfreetext">13.4.5. Using XML and Free Text</a>
    </div>
    <div>
        <a class="sect2" href="queryingxmldata.html#xcontainspredicate">13.4.6. XCONTAINS predicate</a>
    </div>
    <div>
        <a class="sect2" href="queryingxmldata.html#textcontainsxpath">13.4.7. text-contains XPath Predicate</a>
    </div>
    <div>
        <a class="sect2" href="queryingxmldata.html#xmlfreetextrules">13.4.8. XML Free Text Indexing Rules</a>
    </div>
    <div>
        <a class="sect2" href="queryingxmldata.html#xmlencoding">13.4.9. XML Processing &amp; Free Text Encoding Issues</a>
    </div>
    <div>
        <a class="sect1" href="updategrams.html">13.5. Using UpdateGrams to Modify Data</a>
    </div>
    <div>
        <a class="sect2" href="updategrams.html#updategrambasics">13.5.1. Updategrams Basics</a>
    </div>
    <div>
        <a class="sect2" href="updategrams.html#elementsdesc">13.5.2. Elements Description</a>
    </div>
    <div>
        <a class="sect2" href="updategrams.html#determiningactions">13.5.3. Determining Actions</a>
    </div>
    <div>
        <a class="sect2" href="updategrams.html#usinginparams">13.5.4. Using Input Parameters</a>
    </div>
    <div>
        <a class="sect2" href="updategrams.html#examples">13.5.5. Examples</a>
    </div>
    <div>
        <a class="sect1" href="xmltemplates.html">13.6. XML Templates</a>
    </div>
    <div>
        <a class="sect2" href="xmltemplates.html#xmltemplatesyntax">13.6.2. Syntax</a>
    </div>
    <div>
        <a class="sect2" href="xmltemplates.html#saveqrytoxmltemplatessql">13.6.3. Saving SQL Queries to XML Template</a>
    </div>
    <div>
        <a class="sect2" href="xmltemplates.html#saveqrytoxmltemplatessql">13.6.4. Saving XQUERY Queries to XML Template</a>
    </div>
    <div>
        <a class="sect2" href="xmltemplates.html#saveqrytoxmltemplatessql">13.6.5. Saving XPATH Queries to XML Template</a>
    </div>
    <div>
        <a class="sect2" href="xmltemplates.html#xmltemplatesexamples">13.6.6. Programmatic Examples</a>
    </div>
    <div>
        <a class="sect1" href="xmlschema.html">13.7. XML DTD and XML Schemas</a>
    </div>
    <div>
        <a class="sect2" href="xmlschema.html#dtd_intro">13.7.1. XML Document Type Definition (DTD)</a>
    </div>
    <div>
        <a class="sect2" href="xmlschema.html#dtd_config">13.7.2. Configuration Options of the DTD Validator</a>
    </div>
    <div>
        <a class="sect2" href="xmlschema.html#xsd_interface">13.7.3. XML Schema Definition Language</a>
    </div>
    <div>
        <a class="sect2" href="xmlschema.html#xsd_interface">13.7.4. XML Schema Functions</a>
    </div>
    <div>
        <a class="sect2" href="xmlschema.html#xmlschemaandsoap">13.7.5. XML Schema &amp; SOAP</a>
    </div>
    <div>
        <a class="sect1" href="xq.html">13.8. XQuery 1.0 Support</a>
    </div>
    <div>
        <a class="sect2" href="xq.html#xq_supported_expns">13.8.1. Types of XQuery Expressions</a>
    </div>
    <div>
        <a class="sect2" href="xq.html#xq_supported_syntax">13.8.2. Details of XQuery Syntax</a>
    </div>
    <div>
        <a class="sect2" href="xq.html#xq_precompilation">13.8.3. Pre-compilation of XPath and XQuery Expressions</a>
    </div>
    <div>
        <a class="sect1" href="xslttrans.html">13.9. XSLT Transformation</a>
    </div>
    <div>
        <a class="sect2" href="xslttrans.html#namespaces">13.9.1. Namespaces </a>
    </div>
    <div>
        <a class="sect2" href="xslttrans.html#xsloutputelt">13.9.2. The &lt;xsl:output&gt; Tag</a>
    </div>
    <div>
        <a class="sect2" href="xslttrans.html#xsltextparams">13.9.3. External Parameters in XSLT Stylesheets</a>
    </div>
    <div>
        <a class="sect2" href="xslttrans.html#xsltfunctions">13.9.4. Functions</a>
    </div>
    <div>
        <a class="sect2" href="xslttrans.html#xsltexamples">13.9.5. XSLT Examples</a>
    </div>
    <div>
        <a class="sect2" href="xslttrans.html#userdefxpathfunc4xsl">13.9.6. XPath Function Extensions for XSLT</a>
    </div>
    <div>
        <a class="sect2" href="xslttrans.html#xsltsupport">13.9.7. Status Of XSLT And XPath Implementation</a>
    </div>
    <div>
        <a class="sect1" href="xmltype.html">13.10. XMLType</a>
    </div>
    <div>
        <a class="sect1" href="xmldom.html">13.11. Changing XML entities in DOM style</a>
    </div>
    <div>
        <a class="sect2" href="xmldom.html#xmldomtypecasting">13.11.1. Composing Document Fragments From DOM Function Arguments</a>
    </div>
   </div>
    <br />
   <table border="0" width="90%" id="navbarbottom">
    <tr>
        <td align="left" width="33%">
          <a href="rubyhosting.html" title="Ruby Hosting">Previous</a>
          <br />Ruby Hosting</td>
     <td align="center" width="34%">
          <a href="webandxml.html">Chapter Contents</a>
     </td>
        <td align="right" width="33%">
          <a href="forxmlforsql.html" title="Rendering SQL Queries as XML (FOR XML Clause)">Next</a>
          <br />Rendering SQL Queries as XML (FOR XML Clause)</td>
    </tr>
   </table>
  </div>
  <div id="footer">
    <div>Copyright© 1999 - 2009 OpenLink Software All rights reserved.</div>
   <div id="validation">
    <a href="http://validator.w3.org/check/referer">
        <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" />
    </a>
    <a href="http://jigsaw.w3.org/css-validator/">
        <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" height="31" width="88" />
    </a>
   </div>
  </div>
 </body>
</html>