|| doc.getDocumentElement().getLocalName() .equalsIgnoreCase(SOSInterceptorGlobals.ELEMENT_SAMPLING_FEATURE_COLLECTION)) { NodeList gmlFoisNl = ctx.findIn(doc).all("./*/gml:" + SOSInterceptorGlobals.ELEMENT_FEATURE_MEMBER).get(); NodeList saFoisNl = ctx.findIn(doc).all("./*/sa:" + SOSInterceptorGlobals.ELEMENT_MEMBER).get(); ctx.findIn(nl) .all("./node()[@" + SOSInterceptorGlobals.ATTRIBUTE_GML_ID + "='" + id + "']") .get(); if (validGmlIdNl != null && validGmlIdNl.getLength() != 0) { for (int i = 0; i < validGmlIdNl.getLength(); i++) {
ctxResponse.findIn(member) .all("./*/" + documentPrefix + SOSInterceptorGlobals.ELEMENT_FEATURE_OF_INTEREST) .get(); NodeList gmlFoisNl = ctxResponse.findIn(featureOfInterest) .all("./*/gml:" + SOSInterceptorGlobals.ELEMENT_FEATURE_MEMBER).get(); NodeList saFoisNl = ctxResponse.findIn(featureOfInterest) .all("./*/sa:" + SOSInterceptorGlobals.ELEMENT_MEMBER).get(); .findIn(nl) .all("./node()[@" + SOSInterceptorGlobals.ATTRIBUTE_GML_ID + "='" + id + "']").get(); if (validGmlIdNl != null && validGmlIdNl.getLength() != 0) { for (int j = 0; j < validGmlIdNl.getLength(); j++) {
ctx.findIn(doc).all("//*/sos:ObservationOfferingList/sos:ObservationOffering").get(); ctx.findIn(doc) .all("//*/sos:ObservationOfferingList/sos:ObservationOffering[@gml:id='" + offeringID + "']/sos:procedure").get(); NodeList observedPropertyList = ctx.findIn(doc) .all("//*/sos:ObservationOfferingList/sos:ObservationOffering[@gml:id='" + offeringID + "']/sos:observedProperty").get(); NodeList featureOfInterestList = ctx.findIn(doc) .all("//*/sos:ObservationOfferingList/sos:ObservationOffering[@gml:id='" + offeringID + "']/sos:featureOfInterest").get();
ctx.findIn(doc) .all("//*/ows:Parameter[@name='" + SOSInterceptorGlobals.ELEMENT_OFFERING + "']/ows:AllowedValues/ows:Value").get(); for (int i = 0; i < nl.getLength(); i++) { if (allIds.getItem(nl.item(i).getTextContent()) == null) {
ctx.findIn(doc).all("//*/sos:Contents/sos:ObservationOfferingList/sos:ObservationOffering").get();
ctx.findIn(doc) .all("//*/ows:Parameter[@name='" + SOSInterceptorGlobals.ELEMENT_OFFERING + "']/ows:AllowedValues/ows:Value").get(); for (int i = 0; i < nl.getLength(); i++) { if (allIds.getItem(nl.item(i).getTextContent()) == null) {
NodeList nl = ctx.findIn(doc).all("/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType/wfs:Name").get(); for (int i = 0; i < nl.getLength(); i++) { if (targetItems.getItem(nl.item(i).getTextContent()) == null) {
"http://www.opengis.net/wfs/1.0.0").addNamespace("ogc", "http://www.opengis.net/ogc"); NodeList nl = ctx.findIn(m_requestDocument).all("/GetFeature/Query/@typeName").get(); for (int i = 0; i < nl.getLength(); i++) { features.add(nl.item(i).getTextContent());
"http://www.opengis.net/wfs/1.0.0"); NodeList nl = ctx.findIn(m_requestDocument).all("/DescribeFeatureType/TypeName").get(); for (int i = 0; i < nl.getLength(); i++) { features.add(nl.item(i).getFirstChild().getTextContent());
NodeList queryNodes = ctx.findIn(m_requestDocument).all("/GetFeature/Query").get();
.addNamespace("gml", "http://www.opengis.net/gml"); NodeList offerings = xPath.findIn(doc).all("//sos:ObservationOfferingList/sos:ObservationOffering").get();
NodeList nl = ctx.findIn(doc).all("/wps:Capabilities/wps:ProcessOfferings/wps:Process/ows:Identifier/text()").get(); for (int i = 0; i < nl.getLength(); i++) { Node processIdTextNode = nl.item(i);
NodeList nl = ctx.findIn(doc).all("//*/ows:Operation[@name]").get(); Map<String, Node> nodesMap = new HashMap<String, Node>();
ctx.findIn(doc) .all("//*/ows:Operation[@name='" + entry.getKey() + "']/ows:DCP/ows:HTTP/ows:" + SOSInterceptorGlobals.GET).get(); for (int i = 0; i < nl.getLength(); i++) { if (!entry.getValue().contains(nl.item(i).getLocalName())) ctx.findIn(doc) .all("//*/ows:Operation[@name='" + entry.getKey() + "']/ows:DCP/ows:HTTP/ows:" + SOSInterceptorGlobals.POST).get(); for (int i = 0; i < nl.getLength(); i++) { if (!entry.getValue().contains(nl.item(i).getLocalName()))
NodeList nodes = xmlPathContextFactory.createContext().findIn(lDoc).all("//" + mMultiElementName + "/*").get(); for (int i = 0; i < nodes.getLength(); i++) { String nodeStr = DOMUtil.nodeToString(nodes.item(i));
innerMap.put("title", title); innerMap.put("resourceType", lResourceType); NodeList identifiers = context.findIn(record).all("//gmd:identificationInfo[1]/*/gmd:citation/*/gmd:identifier/*").get(); List<String> resourceIdList = new ArrayList<>(); for (int i = 0; i < identifiers.getLength(); i++) {
private void addNodes(Node pNode, ITreeNode pTreeNode) { ITreeNode lCurrentNode = new TreeNode(); String lValue = xmlPathContextFactory.createContext().findIn(pNode).text("value").get(); String lName = xmlPathContextFactory.createContext().findIn(pNode).text("name").get(); LOG.debug("Node name is: {}", lName); LOG.debug("Node value is: {}", lValue); // add to pTreeNode if (pTreeNode.getName().equals("")) { pTreeNode.setId(lValue); pTreeNode.setName(lName); pTreeNode.setType(lValue); lCurrentNode = pTreeNode; } else { lCurrentNode.setId(lValue); lCurrentNode.setName(lName); lCurrentNode.setType(lValue); pTreeNode.addChild(lCurrentNode); } lCurrentNode.setObject(new HashMap<>(getDefaultOptions())); LOG.debug("added node with id {}", lCurrentNode.getId()); // has lChildrenList? NodeList lChildrenList = xmlPathContextFactory.createContext().findIn(pNode).all("./node").get(); if (lChildrenList != null) { LOG.debug("Node has ChildrenList"); for (int i = 0; i < lChildrenList.getLength(); i++) { addNodes(lChildrenList.item(i), lCurrentNode); } } LOG.debug("node has no ChildrenList"); }
public Payload replace(String pOldURL, Transferable res, String pEncoding, String pMimeType) { Document doc = DOMParser.createNew().parse(new InputSource(res.getPayload().getAsStream())); XMLPathCtx ctx = XMLPathCtx.createNew(); NodeList nodes = ctx.findIn(doc).all("//OnlineResource").get(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); if (node.getParentNode().getParentNode().getLocalName().equals("HTTP")) { String name = node.getParentNode().getLocalName(); node.getParentNode().getParentNode().replaceChild(buildReplacement(name, doc), node.getParentNode()); } } // WMS 1.? // TODO extend XPath for POST nodes: //DCPType/HTTP/*[self::Get // or self::Post]/OnlineResource // WFS 1.1 // TODO extend XPath for POST nodes: // //ows:Operation/ows:DCP/ows:HTTP/*[self::ows:Get or // self::ows:Post] // WFS 1.0 // TODO add XPath for WFS 1.0.0: //DCPType/HTTP/*[self::Get or // self::Post]/@onlineResource DOMSerializer serializer = DOMSerializer.createNew(); String response = serializer.serializeToString(doc); Pattern lPattern = Pattern.compile(pOldURL.replaceAll("\\?", "\\\\?")); Matcher mMatcher = lPattern.matcher(response); response = mMatcher.replaceAll(m_gatekeeperURL); sLogger.debug("Modified ResponseDocument:\n" + response); return new TextualPayload(response, pEncoding); }
/** * validates the backend bean properties against a given schematron (or else) validator * * @param target * @param errors */ public void validate(Object target, Errors errors) { BackendBean lBean = (BackendBean) target; // chekc if we need to validate if (lBean.getValidatorId() != null && !lBean.getValidatorId().equals("")) { // apply schematron transformation Document lReport = mService.validate(lBean.getValidatorId()); // add assertions to errors. XMLPathCtx context = xmlPathContextFactory.createContext(); NodeList nodeList = context.findIn(lReport).all("//svrl:failed-assert").get(); for (int i = 0; i < nodeList.getLength(); i++) { Node lNode = nodeList.item(i); String id = context.findIn(lNode).text("@id").get(); String text = context.findIn(lNode).text("svrl:text").get(); errors.rejectValue(id,text); } } } }