Package nu.xom

Examples of nu.xom.Element.appendChild()


              Document doc;
              if (xmlDoc == null) {
                Element root = new Element("root");
                Element child = new Element("child");
                root.appendChild(child);
                for (int j=0; j < 10000; j++) child.appendChild("xxxxxxxxxxxxxxxxxx" + j);
                doc = new Document(root);
              }
              else {
                doc = xmlDoc;
                if (config.getCompressionLevel() == -1) doc = new Document(doc);
View Full Code Here


      cols = rows.get(0).getChildElements(columnName);
    }
   
    Element col = cols.get(0);
    col.removeChildren();
    col.appendChild(value);
  }
 
  public String get(String rowName, String columnName) {
    Elements rows = doc.getRootElement().getChildElements(rowName);
    if (rows.size() > 0) {
View Full Code Here

        Element parent = new Element("parent");
        Text empty = new Text("");
        Text nonempty = new Text("value");
        Text nonempty2 = new Text("value2");
        parent.appendChild(empty);
        parent.appendChild(nonempty);
        parent.appendChild(nonempty2);
       
        Nodes result = parent.query("node()");
        assertEquals(3, result.size());
View Full Code Here

        Text empty = new Text("");
        Text nonempty = new Text("value");
        Text nonempty2 = new Text("value2");
        parent.appendChild(empty);
        parent.appendChild(nonempty);
        parent.appendChild(nonempty2);
       
        Nodes result = parent.query("node()");
        assertEquals(3, result.size());

        Nodes result2 = parent.query("/*[count(node())=1]");
 
View Full Code Here

   
     public void testRootNodeValueIsNonEmpty() {
     
         Element root = new Element("html");
         Document doc = new Document(root);
         root.appendChild("test");
        
         Nodes result = doc.query("/*[string(/) != '']");
         assertEquals(1, result.size());
         assertEquals(root, result.get(0));
        
View Full Code Here

   
    public void testDoubleSlashIsIncorrect() {
       
        Element root = new Element("root", "http://www.example.org");
        Document doc = new Document(root);
        root.appendChild(new Element("child"));
        root.appendChild("test");
        root.addAttribute(new Attribute("test", "test"));
       
        try {
            doc.query("//");
View Full Code Here

    public void testDoubleSlashIsIncorrect() {
       
        Element root = new Element("root", "http://www.example.org");
        Document doc = new Document(root);
        root.appendChild(new Element("child"));
        root.appendChild("test");
        root.addAttribute(new Attribute("test", "test"));
       
        try {
            doc.query("//");
            fail("Queried //");
View Full Code Here

    public void testDoubleSlashIsIncorrect2() {
       
        Element root = new Element("root", "http://www.example.org");
        Document doc = new Document(root);
        root.appendChild(new Element("child"));
        root.appendChild("test");
        root.addAttribute(new Attribute("test", "test"));
       
        try {
            doc.query("// ");
View Full Code Here

    public void testDoubleSlashIsIncorrect2() {
       
        Element root = new Element("root", "http://www.example.org");
        Document doc = new Document(root);
        root.appendChild(new Element("child"));
        root.appendChild("test");
        root.addAttribute(new Attribute("test", "test"));
       
        try {
            doc.query("// ");
            fail("Queried // ");
View Full Code Here

    public void testWhiteSpaceIsAllowedBetweenTokens() {
       
        Element root = new Element("root", "http://www.example.org");
        Document doc = new Document(root);
        root.appendChild(new Element("child"));
        root.appendChild("test");
        root.addAttribute(new Attribute("test", "test"));
       
        Nodes nodes = doc.query("// a");
        assertEquals(0, nodes.size());
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.