Package nu.xom

Examples of nu.xom.Element.appendChild()


    }

    if (node instanceof Element) {
      Element elem = (Element) node;
      elem.removeChildren();
      elem.appendChild(value);
    } else if (node instanceof Attribute) {
      ((Attribute) node).setValue(value);
    } else if (node instanceof Text) {
      ((Text) node).setValue(value);
    } else if (node instanceof Comment) {
View Full Code Here


//    }
   
    // Append children (recursively)
    iter = node.iterateAxis(Axis.CHILD);
    while ((next = (NodeInfo) iter.next()) != null) {
      elem.appendChild(convertNodeInfo(next));
    }
   
    return elem;
  }
 
View Full Code Here

      "\nexpected='" + expected + "', \nactual  ='" + actual + "'");   
  }
 
  private String normalize(String text) {
    Element wrapper = new Element("dummy");
    wrapper.appendChild(text);
    XOMUtil.Normalizer.COLLAPSE.normalize(wrapper); // ???
    return wrapper.getValue();
  }
 
  private Document buildDocument(File file) throws Exception {
View Full Code Here

      Element items = (Element) TEMPLATES.get(Nodes.class.getName());
      items = new Element(items);
     
      int size = nodes.size();
      for (int i=0; i < size; i++) {
        items.appendChild(wrap(nodes.get(i)));
      }
     
      return new Document(items);
    }
View Full Code Here

        Attribute attr = (Attribute) node;         
        item.addAttribute((Attribute) attr.copy());
      } else if (node instanceof Document) {
        Document doc = (Document) node;         
        for (int j=0; j < doc.getChildCount(); j++) {
          item.appendChild(doc.getChild(j).copy());
        }
//      } else if (node instanceof Namespace) { // xom >= 1.1 only
//        Namespace ns = (Namespace) node;
////        item.addNamespaceDeclaration(ns.getPrefix(), ns.getValue());
//        if (ns.getPrefix().length() > 0) {
View Full Code Here

      } else if (node instanceof DocType) {
        DocType docType = (DocType) node;
        Element e;
       
        e = new Element("rootName");
        e.appendChild(docType.getRootElementName());
        item.appendChild(e);
       
        if (docType.getPublicID() != null) {
          e = new Element("publicID");
          e.appendChild(docType.getPublicID());
View Full Code Here

        e.appendChild(docType.getRootElementName());
        item.appendChild(e);
       
        if (docType.getPublicID() != null) {
          e = new Element("publicID");
          e.appendChild(docType.getPublicID());
          item.appendChild(e);
        }
        if (docType.getSystemID() != null) {
          e = new Element("systemID");
          e.appendChild(docType.getSystemID());
View Full Code Here

          e.appendChild(docType.getPublicID());
          item.appendChild(e);
        }
        if (docType.getSystemID() != null) {
          e = new Element("systemID");
          e.appendChild(docType.getSystemID());
          item.appendChild(e);
        }
        if (docType.getInternalDTDSubset().length() > 0) {
          e = new Element("internalDTDSubset");
          e.appendChild(docType.getInternalDTDSubset());
View Full Code Here

          e.appendChild(docType.getSystemID());
          item.appendChild(e);
        }
        if (docType.getInternalDTDSubset().length() > 0) {
          e = new Element("internalDTDSubset");
          e.appendChild(docType.getInternalDTDSubset());
          item.appendChild(e);
        }
      } else { // Element, Text, Comment, ProcessingInstruction
        item.appendChild(node.copy());
      }
View Full Code Here

    int k = 0;
    for (int i=1; i < runs; i++) {
      Element root = new Element("root");
      int j = k + 10000;
      while (k < j) {
        root.appendChild(new Element("elem" + (k++)));
      }
     
      XQueryUtil.xquery(new Document(root), query);
     
      if (i % 1 == 0) System.out.print(".");
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.