Mercurial > dive4elements > http-client
changeset 27:73b211b559e2
Replaced some XPath attribute extraction by simple DOM getAttributeNS() calls.
http-client/trunk@2534 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 23 Aug 2011 13:49:16 +0000 |
parents | c4431f39926a |
children | 68163c3ca407 |
files | ChangeLog src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactProtocolUtils.java |
diffstat | 2 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Jul 04 10:17:22 2011 +0000 +++ b/ChangeLog Tue Aug 23 13:49:16 2011 +0000 @@ -1,3 +1,8 @@ +2011-08-23 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactProtocolUtils.java: + Replaced some XPath attribute extraction by simple DOM getAttributeNS() calls. + 2011-07-04 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java,
--- a/src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactProtocolUtils.java Mon Jul 04 10:17:22 2011 +0000 +++ b/src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactProtocolUtils.java Tue Aug 23 13:49:16 2011 +0000 @@ -17,7 +17,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; -import org.w3c.dom.Node; import org.w3c.dom.NodeList; import de.intevation.artifacts.httpclient.objects.Artifact; @@ -42,12 +41,14 @@ ArtifactFactory[] facs = new ArtifactFactory[elements.getLength()]; - for (int idx = 0; idx < elements.getLength(); idx++) { - Node factory = elements.item(idx); - String desc = XMLUtils.getStringXPath(factory, "@art:description"); - String name = XMLUtils.getStringXPath(factory, "@art:name"); + String uri = ArtifactNamespaceContext.NAMESPACE_URI; - if (name != null) { + for (int idx = 0, N = elements.getLength(); idx < N; idx++) { + Element factory = (Element)elements.item(idx); + String desc = factory.getAttributeNS(uri, "description"); + String name = factory.getAttributeNS(uri, "name"); + + if (name.length() != 0) { facs[idx] = new ArtifactFactory(name, desc); } }