Package org.jaxen

Examples of org.jaxen.NamespaceContext


    }
   
    if (xmlNamespaceMap != null && xmlNamespaceMap.size() > 0)
    {
      if (context == null) {
        context = new NamespaceContext() {
         
          public String translateNamespacePrefixToUri(String prefix) {
            return xmlNamespaceMap.get(prefix);
          }
        };
View Full Code Here


    }
   
    public void testAddNamespaceWithNonSimpleNamespaceContext() throws JaxenException {
       
        BaseXPath xpath = new DOMXPath("/b/c");
        xpath.setNamespaceContext(new NamespaceContext() {

            public String translateNamespacePrefixToUri(String prefix) {
                return prefix;
            }
           
View Full Code Here

    }
   
    public void testAddNamespaceWithNonSimpleNamespaceContext() throws JaxenException {
       
        BaseXPath xpath = new DOMXPath("/b/c");
        xpath.setNamespaceContext(new NamespaceContext() {

            public String translateNamespacePrefixToUri(String prefix) {
                return prefix;
            }
           
View Full Code Here

        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",
                      nsContext.translateNamespacePrefixToUri( "squeeze" ) );

    }
View Full Code Here

 
  private static XPath prepare(String xpath, NodeWrapper<? extends Node> root) {
    try {
      MyNavigator nav = new MyNavigator(root);
      XPath xp = nav.parseXPath(xpath); // TODO: cache results of XPath parsing (per thread)?
      xp.setNamespaceContext(new NamespaceContext() {
        public String translateNamespacePrefixToUri(String prefix) {
          String ns = XML.getThreadNamespaceMap().get(prefix);
          if (ns == null)
            ns = XML.getNamespaceMap().get(prefix);
          return ns;
View Full Code Here

TOP

Related Classes of org.jaxen.NamespaceContext

Copyright © 2018 www.massapicom. 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.