commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Diviacco <patrick.divia...@gmail.com>
Subject Re: [digester] how can I print children tags instead of only tag content ?
Date Fri, 13 May 2011 17:52:36 GMT
mhm, sorry.. just to be more clear.

Is there a way in Commons Digester to trigger a method only if a xml element
has a child ?

i.e.
digester.addCallMethod("collection/doc/categ/*",  "myMethod", 0);

This doesn't work. But it is actually what I need. If element <categ> has at
least a child, then trigger myMethod

thanks






On 13 May 2011 18:48, Patrick Diviacco <patrick.diviacco@gmail.com> wrote:

> I need to print the content of <categ> in my XML file (including children
> tags).
>
> For example, if I have <categ><child></child></categ>, I want
to print
> "<child></child>"
>
> I'm currently parsing the xml file with: digester.addCallMethod("collection/doc/categ",
>  "checkCateg", 0);
>
> and this is the checkCateg function:
> public void checkCateg(String categ) {
> System.out.println(categ);
> }
>
> It doesn't work. The string categ is always empty because it only contains
> text content in <categ> but not its children tags.
>
> thanks,
> Patrick
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message