Package org.jaxen.dom

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


    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


    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

    }
   
    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

        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.