Package org.jaxen.dom

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


    {
        DOMXPath xpath = new DOMXPath(path);
        for (Iterator itr = namespaces.entrySet().iterator(); itr.hasNext();)
        {
            Map.Entry entry = (Map.Entry) itr.next();
            xpath.addNamespace((String) entry.getKey(), (String) entry.getValue());
        }
       
        return xpath.selectNodes(node);
    }
   
View Full Code Here


  {
    try
    {
      DOMXPath xPath = new DOMXPath(nodeSelector);
      for (String prefix : resource.getNamespaceContext().keySet())
        xPath.addNamespace(prefix, resource.getNamespaceContext().get(prefix));
      Node node = (Node) xPath.selectSingleNode(resource.getDocument().getDom());
      if (node == null)
        return null;
      return new XpathXmlResource(node);
    }
View Full Code Here

                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

                return prefix;
            }
           
        });
        try {
            xpath.addNamespace("pre", "foo");           
            fail("Added namespace");
        }
        catch (JaxenException ex) {
            assertNotNull(ex.getMessage());
        }
View Full Code Here

                                           testUtilities.javaToJS(endpoint.getAddress()),
                                           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 {
View Full Code Here

                return prefix;
            }
           
        });
        try {
            xpath.addNamespace("pre", "foo");           
            fail("Added namespace");
        }
        catch (JaxenException ex) {
            assertNotNull(ex.getMessage());
        }
View Full Code Here

    public void testQueryDefaultNamespace() throws JaxenException {
       
        Element root = doc.createElementNS("http://www.example.org/", "root");
        doc.appendChild(root);
        XPath xpath = new DOMXPath("/pre:root");
        xpath.addNamespace("pre", "http://www.example.org/");
        List result = xpath.selectNodes(root);
        assertEquals(1, result.size());
  
    }  
   
View Full Code Here

    private static DOMXPath getDOMXPath(String path, Map<String, String> namespaces) throws Exception {
        DOMXPath xpath = new DOMXPath(path);
        if (namespaces != null) {
            for (String prefix: namespaces.keySet()) {
                xpath.addNamespace(prefix, namespaces.get(prefix));
            }
        }
        return xpath;
    }
View Full Code Here

                                           testUtilities.javaToJS(endpoint.getAddress()),
                                           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 {
View Full Code Here

                                           testUtilities.javaToJS(endpoint.getAddress()),
                                           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("Hello \u05e9\u05dc\u05d5\u05dd", nodeText);
    }
   
    public String getStaticResourceURL() throws Exception {
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.