commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "s[e]th & h[o]lth" <seth.ho...@gmail.com>
Subject Re: [digester] Retrieving two child-nodes
Date Wed, 24 May 2006 19:15:22 GMT
I don't remember excatly what you've to do but this
article<http://www.theserverside.com/tt/articles/article.tss?l=Digester>is
a very good entry point to this exercise.
Good luck !

On 5/24/06, Sven Schliesing <sven@schliesing.de> wrote:
>
> Hi,
>
> I'm having a xml-file like this:
> ------
> <users>
>   <user nick="John" pwHash="bla" isAdmin="true"/>
>   <user nick="Mary" pwHash="bla" isAdmin="true"/>
> </users>
>
> parsing it with this snippet:
> ------
> Digester digester = new Digester();
> digester.setValidating(false);
> digester.addObjectCreate("users/user", IrcUser.class);
> digester.addSetProperties("users/user");
> try {
>         IrcUser ircUser = (IrcUser) digester.parse(configFile);
>         System.out.println(ircUser);
> } catch (IOException e) {
>         throw new ModuleException(e);
> } catch (SAXException e) {
>         throw new ModuleException(e);
> }
> ------
>
> The output I get is:
> ------
> Mary
> ------
>
> How do I get the Object for "John", too?
>
> Thanks in advance!
>
> Sven
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

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