|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.util.AbstractLogEnabled org.apache.cocoon.xml.AbstractXMLProducer org.apache.cocoon.generation.AbstractGenerator org.apache.cocoon.generation.ServiceableGenerator org.apache.cocoon.generation.TraversableGenerator org.apache.cocoon.generation.XPathTraversableGenerator
Generates an XML collection listing performing XPath queries on XML sources.
It can be used both as a plain TraversableGenerator or, if an XPath is specified, it will perform an XPath query on every XML resource, where "xml resource" is, by default, any resource ending with ".xml", which can be overriden by setting the (regexp) pattern "xmlFiles as a sitemap parameter, or where the name of the resource has a container-wide mime-type mapping to 'text/xml' such as specified by mime-mapping elements in a web.xml descriptor file. The XPath can be specified in two ways:
Field Summary | |
protected org.apache.cocoon.environment.Context |
context
The cocoon context used for mime-type mappings |
protected Document |
doc
The document that should be parsed and (partly) included. |
protected org.apache.cocoon.core.xml.DOMParser |
parser
The parser for the XML snippets to be included. |
protected org.apache.cocoon.generation.XPathTraversableGenerator.XPathPrefixResolver |
prefixResolver
The prefix resolver for namespaced queries |
protected XPathProcessor |
processor
The XPath processor. |
protected static String |
QUERY_ATTR_NAME
Attribute for the XPath query. |
protected static String |
RESULT_DOCID_ATTR
The document containing a successful XPath query |
protected RE |
xmlRE
The regular expression for the XML files pattern. |
protected String |
xpath
The XPath. |
protected static String |
XPATH_NODE_NAME
Local name for the element that contains the included XML snippet. |
Fields inherited from class org.apache.cocoon.generation.TraversableGenerator |
attributes, cacheKeyParList, COL_NODE_NAME, DATE_ATTR_NAME, dateFormatter, depth, excludeRE, includeRE, isRequestedSource, LASTMOD_ATTR_NAME, PREFIX, refreshDelay, RES_NAME_ATTR_NAME, RESOURCE_NODE_NAME, reverse, rootRE, SIZE_ATTR_NAME, sort, URI, URI_ATTR_NAME, validity |
Fields inherited from class org.apache.cocoon.generation.ServiceableGenerator |
manager |
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator |
objectModel, parameters, resolver, source |
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer |
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer |
Fields inherited from interface org.apache.cocoon.generation.Generator |
ROLE |
Constructor Summary | |
XPathTraversableGenerator()
|
Method Summary | |
protected void |
addContent(TraversableSource source)
Allow subclasses a chance to generate additional elements within collection and resource elements. |
void |
dispose()
|
protected boolean |
isXML(TraversableSource path)
Determines if a given TraversableSource shall be handled as XML. |
protected void |
performXPathQuery(TraversableSource in)
Performs an XPath query on the source. |
void |
recycle()
Recycle resources |
void |
service(ServiceManager manager)
|
void |
setParser(org.apache.cocoon.core.xml.DOMParser parser)
|
void |
setup(org.apache.cocoon.environment.SourceResolver resolver,
Map objectModel,
String src,
Parameters par)
Set the request parameters. |
void |
setXPathProcessor(XPathProcessor processor)
|
Methods inherited from class org.apache.cocoon.generation.TraversableGenerator |
addAncestorPath, addPath, endNode, generate, getAncestors, getKey, getValidity, isExcluded, isIncluded, isRoot, setNodeAttributes, startNode |
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer |
setConsumer, setContentHandler, setLexicalHandler |
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled |
getLogger, setLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.cocoon.xml.XMLProducer |
setConsumer |
Field Detail |
protected static final String XPATH_NODE_NAME
protected static final String QUERY_ATTR_NAME
protected static final String RESULT_DOCID_ATTR
protected RE xmlRE
protected org.apache.cocoon.core.xml.DOMParser parser
protected Document doc
protected String xpath
protected XPathProcessor processor
protected org.apache.cocoon.generation.XPathTraversableGenerator.XPathPrefixResolver prefixResolver
protected org.apache.cocoon.environment.Context context
Constructor Detail |
public XPathTraversableGenerator()
Method Detail |
public void setParser(org.apache.cocoon.core.xml.DOMParser parser)
public void setXPathProcessor(XPathProcessor processor)
public void setup(org.apache.cocoon.environment.SourceResolver resolver, Map objectModel, String src, Parameters par) throws org.apache.cocoon.ProcessingException, SAXException, IOException
TraversableGenerator
setup
in interface org.apache.cocoon.sitemap.SitemapModelComponent
setup
in class TraversableGenerator
resolver
- the SourceResolver objectobjectModel
- a Map
containing model objectsrc
- the Traversable Source to be XMLized specified as
src
attribute on <map:generate/>par
- configuration parameters
org.apache.cocoon.ProcessingException
SAXException
IOException
public void service(ServiceManager manager) throws ServiceException
ServiceException
public void recycle()
recycle
in interface Recyclable
recycle
in class TraversableGenerator
public void dispose()
protected void addContent(TraversableSource source) throws SAXException, org.apache.cocoon.ProcessingException
TraversableGenerator
addContent
in class TraversableGenerator
source
- the source to generate additional data for.
SAXException
org.apache.cocoon.ProcessingException
protected boolean isXML(TraversableSource path)
path
- the TraversableSource to check
protected void performXPathQuery(TraversableSource in) throws SAXException
in
- the Source the XPath is performed on.
SAXException
- if something goes wrong while adding the XML snippet.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |