Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

Re: [jdom-interest] check if an element exists

Grzegorz Kaczor

2007-01-17

Replies:


> What could be the easiest way to check if a certain username exists?
> I have an xml like this:
>
> <tomcat-users>
>   <role rolename="tomcat"/>
>   <role rolename="role1"/>
>   <role rolename="manager"/>
>   <user username="tomcat" password="tomcat" roles="tomcat"/>
>   <user username="both" password="tomcat" roles="tomcat,role1"/>
>   <user username="role1" password="tomcat" roles="role1"/>
> </tomcat-users>
>
> When it comes to check if a certain user with a certain username
> exists, I don know an easy way to do that. Can someone help? Thnx.
You can use XPath, for example searching for //user[@(protected)>']

Regards
Grzegorz Kaczor
> ------------------------------------------------------------------------
>
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)

--
Grzegorz Kaczor
Computaris Poland



This email is subject to Computaris email terms of use: http://www.computaris.com/email_terms.html
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.