You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ab...@bellsouth.net on 2005/07/14 19:00:42 UTC
digester
Here is my example xml:
<example-xml>
<tests>
<test key="abc" value="a" />
<test key="xyz" value="b />
</example-xml>
Java code snippet:
digester.addObjectCreate("example-xml/tests/", "Test.class");
digester.addCallMethod("example-xml/tests/test", "addTest", 2);
digester.addCallParam("example-xml/tests/test", 0, "key");
digester.addCallParam("example-xml/tests/test", 1, "value");
Test.addTest signature:
addTest(String key, String value)
This metod is never get called??? What I'm missing???
I guess I don't know how to handle attributes. I can change <test> related attributes to sub-elements and that will work but was hoping to figure out the solution with attributes?
I'd appreciate any response!!!
Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: digester
Posted by sc...@sce.carleton.ca.
On Thu, 2005-07-14 at 13:00 -0400, abukh@bellsouth.net wrote:
>> Here is my example xml:
>>
>> <example-xml>
>> <tests>
>> <test key="abc" value="a" />
>> <test key="xyz" value="b />
>> </example-xml>
Is this a copy&paste error or is the closing tag </tests> perhaps
missing in the original code, too?
Cheers,
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: digester
Posted by Simon Kitching <sk...@apache.org>.
On Thu, 2005-07-14 at 13:00 -0400, abukh@bellsouth.net wrote:
> Here is my example xml:
>
> <example-xml>
> <tests>
> <test key="abc" value="a" />
> <test key="xyz" value="b />
> </example-xml>
>
> Java code snippet:
>
> digester.addObjectCreate("example-xml/tests/", "Test.class");
> digester.addCallMethod("example-xml/tests/test", "addTest", 2);
> digester.addCallParam("example-xml/tests/test", 0, "key");
> digester.addCallParam("example-xml/tests/test", 1, "value");
>
> Test.addTest signature:
> addTest(String key, String value)
>
> This metod is never get called??? What I'm missing???
>
> I guess I don't know how to handle attributes. I can change <test> related attributes to sub-elements
> and that will work but was hoping to figure out the solution with attributes?
It all looks fine to me. I don't see where the problem might be.
You might like to look at the examples which can be found in the source
download for digester, in src/examples.
The other thing to try is to enable logging output for digester (a very
useful tool for these sorts of problems). See the FAQ on the wiki:
http://wiki.apache.org/jakarta-commons/Digester/FAQ
Just for the future, it would help if your email subject was a little
more explicit, eg:
[digester] problems passing attributes as parameters
This will allow people having similar problems in future to find this
thread in the email archives.
Regards,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: digester
Posted by Kyle Miller <ky...@sbcglobal.net>.
--- abukh@bellsouth.net wrote:
> Here is my example xml:
>
> <example-xml>
> <tests>
> <test key="abc" value="a" />
> <test key="xyz" value="b />
</tests>
> </example-xml>
>
> Java code snippet:
>
> digester.addObjectCreate("example-xml/tests/",
> "Test.class");
> digester.addCallMethod("example-xml/tests/test",
> "addTest", 2);
> digester.addCallParam("example-xml/tests/test", 0,
> "key");
> digester.addCallParam("example-xml/tests/test", 1,
> "value");
//As longs as the attributes are named the same as the
java properties
digester.addSetProperties("example-xml/tests/test");
>
> Test.addTest signature:
> addTest(String key, String value)
>
> This metod is never get called??? What I'm
> missing???
>
> I guess I don't know how to handle attributes. I can
> change <test> related attributes to sub-elements and
> that will work but was hoping to figure out the
> solution with attributes?
>
> I'd appreciate any response!!!
>
> Thanks
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-dev-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org