Mercurial > dive4elements > river
changeset 3502:3a8884e06aaa
Avoid using XPath queries for getting attributes of a node
flys-client/trunk@5241 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Bjoern Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Thu, 23 Aug 2012 13:27:42 +0000 |
parents | 0de0ef04bcdc |
children | 56f17c6c6288 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/server/UserServiceImpl.java |
diffstat | 2 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Wed Aug 22 12:29:33 2012 +0000 +++ b/flys-client/ChangeLog Thu Aug 23 13:27:42 2012 +0000 @@ -1,3 +1,8 @@ +2012-08-23 Björn Ricks <bjoern.ricks@intevation.de> + + * src/main/java/de/intevation/flys/client/server/UserServiceImpl.java: + Avoid using XPath queries for getting attributes of a node. + 2012-08-22 Christian Lins <christian.lins@intevation.de> * src/main/java/de/intevation/flys/client/client/FLYS.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/server/UserServiceImpl.java Wed Aug 22 12:29:33 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/UserServiceImpl.java Thu Aug 23 13:27:42 2012 +0000 @@ -3,7 +3,7 @@ import javax.xml.xpath.XPathConstants; import org.w3c.dom.Document; -import org.w3c.dom.Node; +import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.apache.log4j.Logger; @@ -54,12 +54,12 @@ ArtifactNamespaceContext.INSTANCE); if (theUsers != null && theUsers.getLength() > 0) { - Node user = theUsers.item(0); + Element user = (Element)theUsers.item(0); - String uuid = XMLUtils.xpathString( - user, "@art:uuid", ArtifactNamespaceContext.INSTANCE); - String name = XMLUtils.xpathString( - user, "@art:name", ArtifactNamespaceContext.INSTANCE); + String uuid = user.getAttributeNS( + ArtifactNamespaceContext.NAMESPACE_URI, "uuid"); + String name = user.getAttributeNS( + ArtifactNamespaceContext.NAMESPACE_URI, "name"); return new DefaultUser(uuid, name); }