Package org.jaxen.dom

Examples of org.jaxen.dom.DOMXPath.selectSingleNode()


     */
    public ElementAssertion(Document content, String xpathExpression) {
        this.context = content.getDocumentElement();
        try {
            DOMXPath xpath = new DOMXPath(xpathExpression);
            Object matchingNode = xpath.selectSingleNode(context);
            if (matchingNode == null) {
                Assert.fail("No element found with XPath expression " + xpathExpression);
            } else if (Element.class.isAssignableFrom(matchingNode.getClass())) {
                context = (Element) matchingNode;
            }
View Full Code Here


                                           testUtilities.javaToJS(xml));
        assertNotNull(xmlResponse);
        Document doc = (Document)xmlResponse.getWrappedNode();
        XPath echoStringPath = new DOMXPath("//t:responseType/text()");
        echoStringPath.addNamespace("t", "http://apache.org/hello_world_xml_http/wrapped/types");
        String nodeText = echoStringPath.stringValueOf(echoStringPath.selectSingleNode(doc));
        assertEquals(nodeText, "Hello \u05e9\u05dc\u05d5\u05dd");
    }
   
    public String getStaticResourceURL() throws Exception {
        File staticFile = new File(this.getClass().getResource("test.html").toURI());
View Full Code Here

    {
        try
        {
            final DOMXPath path = new DOMXPath( str );
            path.setNamespaceContext( new JaxenResolver(resolver) );
            return (Node)path.selectSingleNode( contextNode );
        }
        catch( final Exception e )
        {
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Failed to evaluate '" + str + "'", e);
View Full Code Here

          } catch (NullPointerException exc) {
          }
        }
      } else {
        try {
          Object ilNodo = xpath.selectSingleNode(DomDocument);
          xpath = new DOMXPath(xPath.substring(0, xPath.lastIndexOf("@")) + "halala/@name");
          Object highLightNode = xpath.selectSingleNode(DomDocument);
          if (ilNodo != null) {
            ilValore = ((Node) ilNodo).getNodeValue();
          } else {
View Full Code Here

        }
      } else {
        try {
          Object ilNodo = xpath.selectSingleNode(DomDocument);
          xpath = new DOMXPath(xPath.substring(0, xPath.lastIndexOf("@")) + "halala/@name");
          Object highLightNode = xpath.selectSingleNode(DomDocument);
          if (ilNodo != null) {
            ilValore = ((Node) ilNodo).getNodeValue();
          } else {
            ilValore = "";
          }
View Full Code Here

     */
    public Node selectSingleNode(Node contextNode, String str)
    {
        try {
            DOMXPath path = new DOMXPath(str);
            return (Node)path.selectSingleNode((Object)contextNode);
        } catch (Exception e){
            // ignore it
        }
        return null;
    }
View Full Code Here

        Element root = doc.createElement("root");
        doc.appendChild(root);
        Element child = doc.createElement("child");
        root.appendChild(child);
       
        assertEquals(child, xpath.selectSingleNode(doc));
       
    }
   
   
    public void testEvaluateWithMultiNodeAnswer() throws JaxenException {
View Full Code Here

      throws JaxenException {
       
        BaseXPath xpath = new DOMXPath("id('p1')");
        org.w3c.dom.Element a = doc.createElementNS("", "a");
        doc.appendChild(a);
        Object result = xpath.selectSingleNode(doc);
        assertNull(result);
       
   
   
    public void testSAXPathExceptionThrownFromConstructor() {
View Full Code Here

                                           testUtilities.javaToJS(xml));
        assertNotNull(xmlResponse);
        Document doc = (Document)xmlResponse.getWrappedNode();
        XPath echoStringPath = new DOMXPath("//t:responseType/text()");
        echoStringPath.addNamespace("t", "http://apache.org/hello_world_xml_http/wrapped/types");
        String nodeText = echoStringPath.stringValueOf(echoStringPath.selectSingleNode(doc));
        assertEquals(nodeText, "Hello \u05e9\u05dc\u05d5\u05dd");
    }
   
    public String getStaticResourceURL() throws Exception {
        File staticFile = new File(this.getClass().getResource("test.html").toURI());
View Full Code Here

     */
    public Node selectSingleNode(Node contextNode, String str)
    {
        try {
            DOMXPath path = new DOMXPath(str);
            return (Node)path.selectSingleNode((Object)contextNode);
        } catch (Exception e){
            // ignore it
        }
        return null;
    }
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.