Examples of DOMXPath


Examples of org.jaxen.dom.DOMXPath

     * @return the compiled {@code XPathExpression}
     * @throws XPathParseException when the given expression cannot be parsed
     */
    public static XPathExpression createXPathExpression(String expression, Map<String, String> namespaces) {
        try {
            XPath xpath = new DOMXPath(expression);
            xpath.setNamespaceContext(new SimpleNamespaceContext(namespaces));
            return new JaxenXpathExpression(xpath);
        }
        catch (JaxenException ex) {
            throw new org.springframework.xml.xpath.XPathParseException(
                    "Could not compile [" + expression + "] to a XPathExpression: " + ex.getMessage(), ex);
View Full Code Here

Examples of org.jaxen.dom.DOMXPath

        {
            throw new QueryEvaluationErrorException( MSG.getMessage( Keys.BAD_XPATH_NAMESPACE_CONTEXT ) );
        }
        try
        {
            XPath xpath = new DOMXPath( xpathExpr.getValue() );
            xpath.setNamespaceContext( new JaxenNamespaceContext( xpathExpr.getNamespaceContext() ) );
            return xpath.evaluate( evalContextNode );
        }
        catch ( JaxenException je )
        {
            throw new QueryEvaluationErrorException( MSG.getMessage( Keys.XPATH_FAILED, xpathExpr.getValue(),
                    je ) );
View Full Code Here

Examples of org.jaxen.dom.DOMXPath

    }

    // Implementation methods
    //-------------------------------------------------------------------------
    protected XPath createXPath(String xpath) throws JaxenException {
        return new DOMXPath(xpath);
    }
View Full Code Here

Examples of org.jaxen.dom.DOMXPath

    }

    private XPath compile(OXPath10Expression exp) throws JaxenException {
        XPath xpath = _compiledExpressions.get(exp.xpath);
        if (xpath == null) {
            xpath = new DOMXPath(exp.xpath);
            synchronized (_compiledExpressions) {
                _compiledExpressions.put(exp.xpath, xpath);
            }
        }
        return xpath;
View Full Code Here

Examples of org.jaxen.dom.DOMXPath

                    (XPDLUtil.XPDL_EXTN_V1_1_NS, "Parameter");               
            }
            for (int i = 0; i < paramNodeList.getLength(); i++) {
                Element param = (Element)paramNodeList.item(i);
                String name = param.getAttribute("Name");
                XPath xpath = new DOMXPath (param.getAttribute("Select"));
                if (nsNodeList != null) {
                    for (int j = 0; j < nsNodeList.getLength(); j++) {
                        Element ns = (Element)nsNodeList.item(j);
                        String prefix = ns.getAttribute("Prefix");
                        String uri = ns.getAttribute("Uri");
                        xpath.addNamespace(prefix, uri);
                    }
                }
                returnParamInfo.put(name, xpath);
            }
        } catch (Exception e) {
View Full Code Here

Examples of org.jaxen.dom.DOMXPath

    transHand.setResult(domResult);
    myBuffer.emit(transHand);
    Element returnResult = ((Document)domResult.getNode())
        .getDocumentElement();

    XPath xpath = new DOMXPath("/BLUB/root/element1");
    Element element1
        = (Element)xpath.selectSingleNode(returnResult);
    String value1 = element1.getAttribute("attr1");
    // check testXSLT.xml for the expected result
    assertTrue(value1.equals("42"));

    xpath = new DOMXPath("/BLUB/root/element2");
    Element element2
        = (Element)xpath.selectSingleNode(returnResult);
    String value2 = element2.getAttribute("attr2");
    // check testXSLT.xml for the expected result
    assertTrue(value2.equals("66"));

      }
View Full Code Here

Examples of org.jaxen.dom.DOMXPath

    }

    private XPath compile(OXPath10Expression exp) throws JaxenException {
        XPath xpath = _compiledExpressions.get(exp.xpath);
        if (xpath == null) {
            xpath = new DOMXPath(exp.xpath);
            synchronized (_compiledExpressions) {
                _compiledExpressions.put(exp.xpath, xpath);
            }
        }
        return xpath;
View Full Code Here

Examples of org.jaxen.dom.DOMXPath

    transHand = saxTransFact.newTransformerHandler();
    transHand.setResult(domResult);
    myBuffer.emit(transHand);
    Element returnResult = ((Document)domResult.getNode())
        .getDocumentElement();
    XPath xpath = new DOMXPath("/parent/firstChild");
    String value2 = xpath.stringValueOf(returnResult);
    assertTrue(value2.equals("I'm number one"));


    XPath xpath2 = new DOMXPath("/parent/thirdChild");
    Element child = (Element)xpath2.selectSingleNode(returnResult);
    System.out.println("child = " + child.getClass());
     org.jdom.Element child2 = new org.jdom.input.DOMBuilder().build(child);
     org.jdom.output.XMLOutputter output= new org.jdom.output.XMLOutputter();
     java.io.StringWriter sw = new java.io.StringWriter();
     output.output(child2, sw);
View Full Code Here

Examples of org.jaxen.dom.DOMXPath

//         (javax.xml.transform.OutputKeys.INDENT,"yes");
//        serializer.transform
//            (new javax.xml.transform.dom.DOMSource(returnResult),
//          streamResult);

    XPath xpath = new DOMXPath("/table/record[1]/painter");
    String value = xpath.stringValueOf(returnResult);
    // check testXSLT.xml for the expected result
    assertTrue(value.equals("Matisse, Henri"));
      }
  }
    }
View Full Code Here

Examples of org.jaxen.dom.DOMXPath

//         (javax.xml.transform.OutputKeys.INDENT,"yes");
//        serializer.transform
//            (new javax.xml.transform.dom.DOMSource(returnResult),
//          streamResult);

    XPath xpath = new DOMXPath("/table/record[1]/city");
    String value = xpath.stringValueOf(returnResult);
    // check testXSLT.xml for the expected result
    assertTrue(value.equals("Weiterstadt"));
      }
  }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.