Exemplo n.º 1
0
 public XformParserODK() {
   XPathFactory xPathFactory = XPathFactory.newInstance();
   this.xPath = xPathFactory.newXPath();
   SimpleNamespaceContext namespaces = new SimpleNamespaceContext();
   namespaces.setBindings(NAMESPACE_MAP);
   this.xPath.setNamespaceContext(namespaces);
 }
  private XPathExpression compileXpathExpression(String expression, Map<String, String> namespaces)
      throws XPathExpressionException {

    SimpleNamespaceContext namespaceContext = new SimpleNamespaceContext();
    namespaceContext.setBindings(
        (namespaces != null) ? namespaces : Collections.<String, String>emptyMap());
    XPath xpath = XPathFactory.newInstance().newXPath();
    xpath.setNamespaceContext(namespaceContext);
    return xpath.compile(expression);
  }
Exemplo n.º 3
0
 void initXPath(XPath xpath) {
   SimpleNamespaceContext ctx = new SimpleNamespaceContext();
   ctx.bindNamespaceUri("kml", "http://www.opengis.net/kml/2.2");
   xpath.setNamespaceContext(ctx);
 }