You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Markus Vaterlaus <mv...@gmail.com> on 2005/12/29 23:33:12 UTC

namespaces and xpath directory generator

Hi all,

just figured out, that the xpath directory generator needs additional
parameters if it has to deal with namespaces:

 <map:match pattern="my_content.xml">
    <map:generate type="xpathdirectory" src="content">
         <map:parameter name="xpath" value="/my:contentitem"/>
         <map:parameter name="nsmapping" value="mapping.properties"/>
         <map:parameter name="nsmapping-reload" value="false"/>
         <map:parameter name="xmlFiles" value="\.x.*$"/>
     </map:generate>
   <map:serialize type="xml"/>
</map:match>

Also figured out that mapping.properties is just a simple text file
with just one line

my="http://www.somedomain.com/my/1.0

However, can't figure out, if there is any additional documentation
about  mapping.properties or its syntax. Anybody any clues?

THX in advance.

--mv

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: namespaces and xpath directory generator

Posted by Antonio Gallardo <ag...@agssa.net>.
Edwin Kapauni wrote:

> Just found it described in the API docs 
> <http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/generation/XPathDirectoryGenerator.html> 
> (with a typo on "mapping.proeprties").
>
Thanks. Typo fixed.

Best Regards,

Antonio Gallardo


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: namespaces and xpath directory generator

Posted by Markus Vaterlaus <mv...@gmail.com>.
Hello Edwin

On 12/30/05, Edwin Kapauni <ed...@arcor.de> wrote:
> Markus Vaterlaus wrote:
> > Hi all,
> >
> > just figured out, that the xpath directory generator needs additional
> > parameters if it has to deal with namespaces:
> Does this mean we no longer need to use "*[local-name()='something'"
> expressions in the xpath parameter like given below?
>

Correct, if you define the namespaces in mapping.properties you can
avoid workarounds as mentioned below.

Your workaround provides - asfaik - valid results for the following elements:

 my:something
 mynamespace:something
 xs:something
 ...

Maybe the results are not the ones expected. Especially  if you are
interested in the results just from one specific namespace.

> <map:generate type="xpathdirectory" src="./">
>     <map:parameter name="xpath"
> value="/*[local-name()='html']/*[local-name()='head']/*[local-name()='title']"/>
>     <map:parameter name="xmlFiles" value="\.*"/>
>     <map:parameter name="depth" value="999"/>
>     <map:parameter name="exclude" value="img|logics|sitemap.xmap|.*~"/>
> </map:generate>
>
>
> Just found it described in the API docs
> <http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/generation/XPathDirectoryGenerator.html>
> (with a typo on "mapping.proeprties").
>
> [...]
>  > However, can't figure out, if there is any additional documentation
>  > about  mapping.properties or its syntax. Anybody any clues?
>
> Guess it's a plain text file with one namespace per line and the syntax
> like in your example. But the API-doc lists it without quotation marks.
> Which one is correct?
>
>      prefix="namespace-uri"
> or  prefix=namespace-uri
>

It works without quotation marks. At least with cocoon 2.1.8

> Did you find out the location where to place the text file
> "mapping.properties"? Should it be in the same directory like sitemap:xmap?
>

I placed it in the same directory as the application's sitemap.xmap

--mv

>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: namespaces and xpath directory generator

Posted by Edwin Kapauni <ed...@arcor.de>.
Markus Vaterlaus wrote:
> Hi all,
> 
> just figured out, that the xpath directory generator needs additional
> parameters if it has to deal with namespaces:
Does this mean we no longer need to use "*[local-name()='something'" 
expressions in the xpath parameter like given below?

<map:generate type="xpathdirectory" src="./">
    <map:parameter name="xpath" 
value="/*[local-name()='html']/*[local-name()='head']/*[local-name()='title']"/>
    <map:parameter name="xmlFiles" value="\.*"/>
    <map:parameter name="depth" value="999"/>
    <map:parameter name="exclude" value="img|logics|sitemap.xmap|.*~"/>
</map:generate>


Just found it described in the API docs 
<http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/generation/XPathDirectoryGenerator.html> 
(with a typo on "mapping.proeprties").

[...]
 > However, can't figure out, if there is any additional documentation
 > about  mapping.properties or its syntax. Anybody any clues?

Guess it's a plain text file with one namespace per line and the syntax 
like in your example. But the API-doc lists it without quotation marks. 
Which one is correct?

     prefix="namespace-uri"
or  prefix=namespace-uri

Did you find out the location where to place the text file 
"mapping.properties"? Should it be in the same directory like sitemap:xmap?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org