[jdom-interest] check if an element exists

Grzegorz Kaczor grzegorz.kaczor at computaris.com
Wed Jan 17 02:52:28 PST 2007


> 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[@username='<user_name>']

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

-- 
Grzegorz Kaczor
Computaris Poland



This email is subject to Computaris email terms of use: http://www.computaris.com/email_terms.html


More information about the jdom-interest mailing list