Package nu.xom

Examples of nu.xom.Element.addNamespaceDeclaration()


        }
        else {
          if (DEBUG) System.err.println(
            "Adding additional namespace declaration for prefix="
            + prefix + ", uri=" + uri);
          elem.addNamespaceDeclaration(prefix, uri);
        }
      }
      i++;
    }
    prefixes = null; // help gc
View Full Code Here


     
//      template = new Element("item:namespace", ns); // xom >= 1.1 only
//      templates.put(Namespace.class.getName(), template);
     
      template = new Element("item:items", ns);
      template.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
      templates.put(Nodes.class.getName(), template);

      return templates;
    }
  }
View Full Code Here

    public void testPredicateWithNamespaceAxis() {
       
        Element parent = new Element("Test");
        Element child = new Element("child", "http://www.example.com");
        Element grandchild = new Element("child", "http://www.example.com");
        grandchild.addNamespaceDeclaration("pre", "http://www.w3.org/");
        parent.appendChild(child);
        child.appendChild(grandchild);
       
        // Every node has at least a mapping for xml prefix.
        Nodes result = parent.query("self::*[count(namespace::*)=0]");
 
View Full Code Here

    public void testPredicateWithNamespaceAxis2() {
       
        Element parent = new Element("Test");
        Element child = new Element("child", "http://www.example.com");
        Element grandchild = new Element("child", "http://www.example.com");
        grandchild.addNamespaceDeclaration("pre", "http://www.w3.org/");
        parent.appendChild(child);
        child.appendChild(grandchild);
       
        // Every node has at least a mapping for xml prefix.
        Nodes result = parent.query("*[count(namespace::*)=0]");
 
View Full Code Here

        Element parent = new Element("Test", "http://www.example.org");
        Element child = new Element("child", "http://www.example.org");
        parent.appendChild(child);
       
        Element test = new Element("test");
        test.addNamespaceDeclaration("pre", "http://www.example.org");
        XPathContext context = XPathContext.makeNamespaceContext(test);
        Nodes result = parent.query("child::pre:child", context);
        assertEquals(1, result.size());
        assertEquals(child, result.get(0));  
       
View Full Code Here

        Element parent = new Element("Test", "http://www.example.org");
        Element child = new Element("child", "http://www.example.org");
        parent.appendChild(child);
       
        Element test = new Element("test");
        test.addNamespaceDeclaration("pre", "http://www.example.org");
        Element testChild = new Element("testchild");
        test.appendChild(testChild);
        XPathContext context = XPathContext.makeNamespaceContext(testChild);
        Nodes result = parent.query("child::pre:child", context);
        assertEquals(1, result.size());
View Full Code Here

                String namespacePrefix = qName.substring(6);
                String currentValue
                   = element.getNamespaceURI(namespacePrefix);
                if (!namespaceName.equals(currentValue)) {
                    try {
                        element.addNamespaceDeclaration(
                          namespacePrefix, namespaceName);
                    }
                    catch (NamespaceConflictException ex) {
                        // skip it; see attribset40 test case;
                        // This should only happen if an attribute's
View Full Code Here

                String namespacePrefix = "";
                String currentValue
                  = element.getNamespaceURI(namespacePrefix);
                if (!namespaceName.equals(currentValue)) {
                    try {
                        element.addNamespaceDeclaration(namespacePrefix,
                         namespaceName);
                    }
                    catch (NamespaceConflictException ex) {
                       // work around Bug 27937 in Xalan
                       // http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27937
View Full Code Here

                       // Xalan sometimes use the XML namespace
                       // http://www.w3.org/XML/1998/namespace where it
                       // should use the empty string
                       if ("http://www.w3.org/XML/1998/namespace".equals(namespaceName)
                         && "".equals(namespacePrefix)) {
                            element.addNamespaceDeclaration("", "");                          
                       }
                    }
                }
            }            
        } 
View Full Code Here

        Element body = new Element("SOAP-ENV:Body",
         SOAPNamespace);
        Element calculateFibonacci = new Element("calculateFibonacci",
         "http://namespaces.cafeconleche.org/xmljava/ch3/");
        calculateFibonacci.appendChild(index);
        calculateFibonacci.addNamespaceDeclaration("xsi",
         "http://www.w3.org/2001/XMLSchema-instance");
        Attribute type = new Attribute("type", "xsi:positiveInteger");
        calculateFibonacci.addAttribute(type);
       
        envelope.appendChild(body);
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.