Vadim Gritsenko wrote:
On Mar 26, 2008, at 5:19 PM, Luca Morandini wrote:
... though... why is it returning every document in sight, instead of
limiting itself to the "*.jx" ones ?
<map:match pattern="pages.xml">
<map:generate type="xpathtraversable" src="blockcontext:/">
<map:parameter name="depth" value="4"/>
<map:parameter name="xmlFiles" value="\.jx"/>
Perhaps because of this method?
protected boolean isXML(TraversableSource path) {
String mimeType = this.context.getMimeType(path.getName());
return this.xmlRE.match(path.getName()) ||
"text/xml".equalsIgnoreCase(mimeType);
}
Actually, I thought xmlFiles was a way to restrict the scope of the
search, not to enlarge it... it seems I was utterly wrong :(
The Javadoc says: <<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.>>
So, it seems the correct behavior, given my setup, would be: add "*.jx"
files to the known list of XML resources within the depth of 4 and
perform the XPath query.
If you could confirm this, I would be glad to add some documentation to
the XPathTraversableGenerator page.
<map:parameter name="xpath" value="/*/content/title"/>
This parameter is optional, so you can omit it and get a better
performance.
I understand this is a performance-killer, but I need the "title"
element for further processing.
Regards,
--------------------
Luca Morandini
www.lucamorandini.it
--------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]