home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / xpathdirectory-generator.xml < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  4.8 KB  |  113 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.   Copyright 1999-2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17. <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "document-v10.dtd">
  18.  
  19. <document>
  20.   <header>
  21.     <title>XPath Directory Generator</title>
  22.     <version>1.0</version>
  23.     <type>Technical document</type>
  24.     <authors>
  25.       <person name="J├╢rg Heinicke" email="joerg@apache.org"/>
  26.     </authors>
  27.     <abstract>This document describes the XPath Directory Generator of Cocoon.</abstract>
  28.   </header>
  29.   <body>
  30.     <s1 title="XPath Directory Generator">
  31.       <p>Generates an XML directory listing performing XPath queries on XML files.</p>
  32.       <ul>
  33.         <li>Name: xpathdirectory</li>
  34.         <li>Class: org.apache.cocoon.generation.XPathDirectoryGenerator</li>
  35.         <li>Cacheable: yes</li>
  36.       </ul>
  37.       <p>The XPath Directory Generator provides all the functionality of the
  38.         <link href="directory-generator.html">Directory Generator</link>. Additionaly it is possible
  39.         to get XML snippets out of the XML files the Directory Generator finds.</p>
  40.     </s1>
  41.     <s1 title="Additional Configuration">
  42.       <source><![CDATA[
  43.   <map:generate type="xpathdirectory" src="the/requested/directory">
  44.     <map:parameter name="xpath" value="/article/title|/article/abstract"/>
  45.     <map:parameter name="xmlFiles" value="\.x.*$"/>
  46.   </map:generate>
  47.       ]]></source>
  48.       <p>The XPath Directory Generator has two additional parameters, both are optional.</p>
  49.       <ul>
  50.         <li>xpath: Sets the XPath the XPath Directory Generator should use for queries on XML files.
  51.             If you don't set this parameter it will behave like the Directory Generator.</li>
  52.         <li>xmlFiles: The xml files pattern. Specifies the files that should be handled as XML
  53.             files. XPath queries will only be tried on files matching this pattern. The XPath
  54.             Directory Generator does not fail on non-XML files or files that are not
  55.             well-formed or not valid. All Exceptions on parsing the files will be caught and
  56.             ignored. But of course, useless parsing, throwing and catching exceptions is very
  57.             time consuming, so the <code>xmlFiles</code> pattern should not be too generic.<br/>
  58.             If you specify an empty pattern all files will be handled as XML files. The default
  59.             pattern when not specifying this parameter is <code>\.xml$</code>, so that all files
  60.             ending <code>.xml</code> are handled as XML files.<br/>
  61.             The pattern is a regular expression as described in the API docs of the
  62.             <link href="http://jakarta.apache.org/regexp/apidocs/org/apache/regexp/RE.html">
  63.             Apache RegExp project</link>.</li>
  64.       </ul>
  65.     </s1>
  66.     <s1 title="Extended DTD">
  67.       <source><![CDATA[
  68.   <!ELEMENT directory (directory|file)*>
  69.   <!ATTLIST directory
  70.     name         CDATA #REQUIRED
  71.     lastModified CDATA #REQUIRED
  72.     date         CDATA #REQUIRED
  73.     size         CDATA #REQUIRED
  74.     requested    CDATA #IMPLIED
  75.     sort         CDATA #IMPLIED
  76.     reverse      CDATA #IMPLIED>
  77.  
  78.   <!ELEMENT file (xpath?)>
  79.   <!ATTLIST file
  80.     name         CDATA #REQUIRED
  81.     lastModified CDATA #REQUIRED
  82.     date         CDATA #REQUIRED
  83.     size         CDATA #REQUIRED>
  84.  
  85.   <!ELEMENT xpath #ALL>
  86.   <!ATTLIST xpath
  87.     query        CDATA #REQUIRED>
  88.       ]]></source>
  89.     </s1>
  90.     <s1 title="Example">
  91.       <p>The current XPath Directory Generator may generate following xml:</p>
  92.       <source><![CDATA[
  93. <dir:directory xmlns:dir="http://apache.org/cocoon/directory/2.0"
  94.     name="articles" lastModified="1057183738609" date="03.07.03 00:08" size="0"
  95.     requested="true" sort="name" reverse="false">
  96.   <dir:directory name="images" lastModified="1057183738609" date="03.07.03 00:08" size="0"/>
  97.   <dir:file name="article1.xml" lastModified="1057183738609" date="03.07.03 00:08" size="123">
  98.     <dir:xpath query="/article/title">
  99.       <title>My first article!</title>
  100.     </dir:xpath>
  101.   </dir:file>
  102.   <dir:file name="article2.html" lastModified="1057183738609" date="03.07.03 00:08" size="345"/>
  103.   <dir:file name="article2.xml" lastModified="1057183738609" date="03.07.03 00:08" size="234">
  104.     <dir:xpath query="/article/title">
  105.       <title>My second article!</title>
  106.     </dir:xpath>
  107.   </dir:file>
  108. </dir:directory>
  109.       ]]></source>
  110.     </s1>
  111.   </body>
  112. </document>
  113.