Package org.jaxen

Examples of org.jaxen.XPath.addNamespace()


                                           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


        Iterator nsIter = namespaces.iterator();
       
        while (nsIter.hasNext())
        {
          OMNamespace tmpNs = (OMNamespace)nsIter.next();
          xp.addNamespace(tmpNs.getPrefix(), tmpNs.getNamespaceURI());
        }
       
        List selectedNodes = xp.selectNodes(envelope);
       
        Iterator nodesIter = selectedNodes.iterator();
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

      throws JaxenException {
    DocumentNavigator nav = new DocumentNavigator();
    XPath contextpath = new BaseXPath(path, nav);
    if (namespaces != null) {
      for (Map.Entry<String, String> entry : namespaces.entrySet()) {
        contextpath.addNamespace(entry.getKey(), entry.getValue());
      }
    }
    if (functions != null) {
      contextpath.setFunctionContext(
        getFunctionContext(
View Full Code Here

    }
   
    public void testDefaultContext() throws SAXPathException
    {
        XPath xpath = new DOMXPath("foo");
        xpath.addNamespace("cheese",
                           "http://cheese.org");
        xpath.addNamespace("squeeze",
                           "http://squeeze.org");
        NamespaceContext nsContext = xpath.getNamespaceContext();
        assertEquals( "http://cheese.org",
View Full Code Here

    public void testDefaultContext() throws SAXPathException
    {
        XPath xpath = new DOMXPath("foo");
        xpath.addNamespace("cheese",
                           "http://cheese.org");
        xpath.addNamespace("squeeze",
                           "http://squeeze.org");
        NamespaceContext nsContext = xpath.getNamespaceContext();
        assertEquals( "http://cheese.org",
                      nsContext.translateNamespacePrefixToUri( "cheese" ) );
        assertEquals( "http://squeeze.org",
View Full Code Here

    DocumentNavigator nav = new DocumentNavigator();
    XPath contextpath = new BaseXPath(path, nav);
    if (namespaces != null) {
      for (String key : namespaces.keySet()) {
        String value = namespaces.get(key);
        contextpath.addNamespace(key, value);
      }
    }
   
    return contextpath;
  }
View Full Code Here

        else {
        // HANDLE XPOINTER (as XPATH with JAXEN)
          XPath xpath = new DOMXPath(xpointer);
          for (Iterator it = doc.getNamespaceList().iterator();it.hasNext();) {
            CNamespace ns = (CNamespace)it.next();
            xpath.addNamespace(ns.getPrefix() == null ? "" : ns.getPrefix(), ns.getNamespaceURI());
          }
          List result = xpath.selectNodes(doc.getDocumentElement());
          for (final Iterator it = result.iterator();it.hasNext();) {
            final Node node = (Node)it.next();
            currentElement.appendChild(node);
View Full Code Here

          else {
            // HANDLE XPOINTER (as XPATH with JAXEN)
              XPath xpath = new DOMXPath(xpointer);
              for (Iterator it = doc.getNamespaceList().iterator();it.hasNext();) {
                CNamespace ns = (CNamespace)it.next();
                xpath.addNamespace(ns.getPrefix() == null ? "" : ns.getPrefix(), ns.getNamespaceURI());
              }
              List result = xpath.selectNodes(doc.getDocumentElement());
              for (final Iterator it = result.iterator();it.hasNext();) {
                final Node node = (Node)it.next();
              CDOM2SAX converter = new CDOM2SAX(node);
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.