java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.xml.AbstractXMLProducer
org.apache.cocoon.generation.AbstractGenerator
org.apache.cocoon.generation.ServiceableGenerator
org.apache.cocoon.generation.DirectoryGenerator
org.apache.cocoon.generation.XPathDirectoryGenerator
All Implemented Interfaces:
CacheableProcessingComponent, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.service.Serviceable, Generator, org.apache.avalon.excalibur.pool.Recyclable, XMLProducer
Generates - an XML directory listing performing XPath queries on XML files. It can be used both as a plain
DirectoryGenerator or, by specifying a parameter xpath, it will perform an XPath query on every XML
resource.xpathdirectory - content - Uses - the last modification date of the directory and the contained documentssitemap.generator.xpathdirectory -
Generates an XML directory listing performing XPath queries on XML files. It can be used both as a plain
DirectoryGenerator or, by specifying a parameter xpath, it will perform an XPath query on every XML
resource. A nsmapping parameter can be specified to point to a file containing lines to map prefixes
to namespaces like this:
prefix=namespace-uri
prefix2=namespace-uri-2
A parameter nsmapping-reload specifies if the prefix-2-namespace mapping file should be checked to be
reloaded on each request to this generator if it was modified since the last time it was read.
An additional parameter xmlFiles can be set in the sitemap setting the regular expression pattern for
determining if a file should be handled as XML file or not. The default value for this param is
\.xml$, so that it matches all files ending .xml.
<map:match pattern="documents/**">
<map:generate type="xpathdirectory" src="docs/{1}">
<map:parameter name="xpath" value="/article/title|/article/abstract"/>
<map:parameter name="nsmapping" value="mapping.properties"/>
<map:parameter name="nsmapping-reload" value="false"/>
<map:parameter name="xmlFiles" value="\.xml$"/>
</map:generate>
<map:serialize type="xml" />
</map:match>
Request:
http://www.some.host/documents/test
<dir:directory name="test" lastModified="1010400942000" date="1/7/02 11:55 AM" requested="true" xmlns:dir="http://apache.org/cocoon/directory/2.0"> <dir:directory name="subdirectory" lastModified="1010400942000" date="1/7/02 11:55 AM"/> <dir:file name="test.xml" lastModified="1011011579000" date="1/14/02 1:32 PM"> <dir:xpath query="/article/title"> <title>This is a test document</title> <abstract> <para>Abstract of my test article</para> </abstract> </dir:xpath> </dir:file> <dir:file name="test.gif" lastModified="1011011579000" date="1/14/02 1:32 PM"/> </dir:directory>
< - a href="mailto:giacomo@apache.org">Giacomo Pati< - a href="mailto:gianugo@apache.org">Gianugo Rabellino< - a href="mailto:joerg@apache.org">J\u00F6rg HeinickeCVS - $Id: XPathDirectoryGenerator.java 433543 2006-08-22 06:22:54Z crossley $| Field Summary | ||
|---|---|---|
| protected static final String | XPATH_NODE_NAME | Local name for the element that contains the included XML snippet. |
| protected static final String | QUERY_ATTR_NAME | Attribute for the XPath query. |
| protected static final Map | mappingFiles | All the mapping files lastmodified dates |
| protected DOMParser | parser | The parser for the XML snippets to be included. |
| protected Document | doc | The document that should be parsed and (partly) included. |
| protected PrefixResolver | prefixResolver | The PrefixResolver responsable for processing current request (if any). |
| protected RE | xmlRE | The regular expression for the XML files pattern. |
| protected String | xpath | The XPath. |
| protected XPathProcessor | processor | The XPath processor. |
| Fields inherited from org.apache.cocoon.generation.ServiceableGenerator: |
|---|
| manager |
| Fields inherited from org.apache.cocoon.generation.AbstractGenerator: |
|---|
| resolver, objectModel, parameters, source |
| Fields inherited from org.apache.cocoon.xml.AbstractXMLProducer: |
|---|
| EMPTY_CONTENT_HANDLER, xmlConsumer, contentHandler, lexicalHandler |
| Method from org.apache.cocoon.generation.XPathDirectoryGenerator Summary: |
|---|
| dispose, isXML, performXPathQuery, recycle, service, setup, startNode |
| Methods from org.apache.cocoon.generation.DirectoryGenerator: |
|---|
| addAncestorPath, addPath, endNode, generate, getAncestors, getKey, getValidity, isExcluded, isIncluded, isRoot, recycle, setNodeAttributes, setup, startNode |
| Methods from org.apache.cocoon.generation.ServiceableGenerator: |
|---|
| dispose, service |
| Methods from org.apache.cocoon.generation.AbstractGenerator: |
|---|
| recycle, setup |
| Methods from org.apache.cocoon.xml.AbstractXMLProducer: |
|---|
| recycle, setConsumer, setContentHandler, setLexicalHandler |
| Methods from java.lang.Object: |
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.apache.cocoon.generation.XPathDirectoryGenerator Detail: |
|---|
|
|
|
|
|
|
|