You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Gianugo Rabellino <gi...@apache.org> on 2003/08/20 23:36:29 UTC

[miniRT] External namespaces in sitemaps

Quite a few sitemap components rely on parameters that actually contain 
XML element/attribute or XPath references: the first examples that cross 
my mind are XPath*Generator, HTMLGenerator and FilterTransformer (not to 
mention all the JXPath stuff).

Sometimes (a lot of times, actually) it's necessary to pass *namespaced* 
references, and the situation is only going to get worse with the 
increasing use of advanced XML (think about the SOAP or DAV nightmare). 
Currently only the XPathTraversableGenerator supports a way to pass 
namespaced elements, and to do that it uses a hack made of parameters 
starting with "xmlns:" whose value is the namespace URI. this seems 
silly to me, since the sitemap is an XML file. How better would it be to 
write (a' la XSLT):

<map:generate
   type="xpathtraversable"
   src="my.xml"
   xpath="/html:head/html:title"
   xmlns:html="http://www.w3.org/1999/xhtml"/>

instead than:

<map:generate
   type="xpathtraversable"
   src="my.xml"
   xpath="/html:head/html:title">
   <map:parameter name="xmlns:html"
        value=""http://www.w3.org/1999/xhtml"/>
</map:generate>

The former looks to me as the simplest and more consistent solution, 
with the only problem being the TreeProcessor being able to pass 
namespace informations to the components. It could be as easy as a 
NamespaceMap being available in the object model, but I'm sure that the 
TreeProcessor gurus might have a better idea to deal with this 
particular issue.

Does all this make sense?

-- 
Gianugo Rabellino
Pro-netics s.r.l. -  http://www.pro-netics.com
Orixo, the XML business alliance - http://www.orixo.com
     (Now blogging at: http://blogs.cocoondev.org/gianugo/)