comparison flys-client/src/main/java/de/intevation/flys/client/server/WQInfoServiceImpl.java @ 5596:8fce35702908

Rolled XPath replacement back for main values.
author Sascha L. Teichmann <teichmann@intevation.de>
date Mon, 08 Apr 2013 16:42:50 +0200
parents 966237892c9b
children
comparison
equal deleted inserted replaced
5595:85fd42e308e7 5596:8fce35702908
7 7
8 import javax.xml.xpath.XPathConstants; 8 import javax.xml.xpath.XPathConstants;
9 9
10 import org.w3c.dom.Document; 10 import org.w3c.dom.Document;
11 import org.w3c.dom.Element; 11 import org.w3c.dom.Element;
12 import org.w3c.dom.Node;
12 import org.w3c.dom.NodeList; 13 import org.w3c.dom.NodeList;
13 14
14 import org.apache.log4j.Logger; 15 import org.apache.log4j.Logger;
15 16
16 import com.google.gwt.user.server.rpc.RemoteServiceServlet; 17 import com.google.gwt.user.server.rpc.RemoteServiceServlet;
128 129
129 List<WQInfoObject> objects = 130 List<WQInfoObject> objects =
130 new ArrayList<WQInfoObject>(num); 131 new ArrayList<WQInfoObject>(num);
131 132
132 for (int i = 0; i < num; i++) { 133 for (int i = 0; i < num; i++) {
133 WQInfoObject obj = buildWQInfoObject((Element)list.item(i)); 134 WQInfoObject obj = buildWQInfoObject(list.item(i));
134 135
135 if (obj != null) { 136 if (obj != null) {
136 objects.add(obj); 137 objects.add(obj);
137 } 138 }
138 } 139 }
173 * 174 *
174 * @param node The node that contains the information. 175 * @param node The node that contains the information.
175 * 176 *
176 * @return a valid WQInfoObject. 177 * @return a valid WQInfoObject.
177 */ 178 */
178 protected static WQInfoObject buildWQInfoObject(Element node) { 179 protected static WQInfoObject buildWQInfoObject(Node node) {
179 180
180 String uri = ArtifactNamespaceContext.NAMESPACE_URI; 181 String name = XMLUtils.xpathString(
181 182 node, "@name", ArtifactNamespaceContext.INSTANCE);
182 String name = node.getAttributeNS(uri, "name"); 183
183 String type = node.getAttributeNS(uri, "type"); 184 String type = XMLUtils.xpathString(
184 String value = node.getAttributeNS(uri, "value"); 185 node, "@type", ArtifactNamespaceContext.INSTANCE);
185 186
186 if (!name.isEmpty() && !type.isEmpty()) { 187 String value = XMLUtils.xpathString(
188 node, "@value", ArtifactNamespaceContext.INSTANCE);
189
190 if (name != null && type != null) {
187 try { 191 try {
188 return new WQInfoObjectImpl( 192 return new WQInfoObjectImpl(
189 name, 193 name,
190 type, 194 type,
191 new Double(value)); 195 new Double(value));

http://dive4elements.wald.intevation.org