You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ma...@rrd.com on 2004/04/27 18:18:41 UTC

Problem binding Woody form to Map entries in Bean

Hi,

I am having a problem I hope someone can help me with.  I have a Bean with 
a Map of metadata in it and I want to be able to create a Woody form to 
update the metadata.  The Map keys are all strings and there is a 
getMetaData(String key) method.
I have been able to bind to Map entries with:

        <value id="foo" path="./metaData/foo"/>

The problem is some of the Map key strings have spaces in them.  For 
example

        <value id="foo" path="./metaData/Creation Date"/>

Which results in a JXPathException due to an invalid XPath.

Can anybody suggest how I can make this work?

Thanks

Mark

Re: Problem binding Woody form to Map entries in Bean

Posted by Joerg Heinicke <jo...@gmx.de>.
On 27.04.2004 18:18, Markx.Johnson@rrd.com wrote:

> Hi,
> 
> I am having a problem I hope someone can help me with.  I have a Bean with 
> a Map of metadata in it and I want to be able to create a Woody form to 
> update the metadata.  The Map keys are all strings and there is a 
> getMetaData(String key) method.
> I have been able to bind to Map entries with:
> 
>         <value id="foo" path="./metaData/foo"/>
> 
> The problem is some of the Map key strings have spaces in them.  For 
> example
> 
>         <value id="foo" path="./metaData/Creation Date"/>
> 
> Which results in a JXPathException due to an invalid XPath.
> 
> Can anybody suggest how I can make this work?

http://jakarta.apache.org/commons/jxpath/users-guide.html#Map%20Element%20Access

alternative syntax:

"addresses[@name='home']/zipCode"

So for your example it would probably be

<value id="foo" path="./metaData[@name = 'Creation Date']"/>

But no guarantee that this also works on saving the value back to the 
bean. Try it out if you get a JXPathException then too.

Joerg

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