Package nu.xom

Examples of nu.xom.Node.detach()


    Element thisInsertion = XOMTools.shallowCopy(insertion);
    XOMTools.insertBefore(firstInnerNode, thisInsertion);
    int i = currentParent.indexOf(firstInnerNode);
    while(currentParent.getChild(i) != lastInnerNode) {
      Node n = currentParent.getChild(i);
      n.detach();
      thisInsertion.appendChild(n);
    }
    lastInnerNode.detach();
    thisInsertion.appendChild(lastInnerNode);
   
View Full Code Here


    File outFolder = new File("/home/ptc24/newows/corpora/NewSciXMLPatents2");
    if(!outFolder.exists()) outFolder.mkdir();
   
    for(int i=0;i<paperNodes.size();i++) {     
      Node node = paperNodes.get(i);
      node.detach();
      assert(node instanceof Element);
      Element e = (Element)node;
      Document newDoc = new Document(e);
      Document sciXML = XSLTransform.toDocument(xslt.transform(newDoc));
     
View Full Code Here

      Node contentsFirst = elem.getChild(0);
      Node contentsLast = elem.getChild(elem.getChildCount()-1);
      /* Transfer inner nodes to parent */
      while(elem.getChildCount() > 0) {
        Node nn = elem.getChild(0);
        nn.detach();
        parent.insertChild(nn, index);
        index++;
      }
      /* Perform Text surgery */
      if((previous instanceof Text) && (contentsFirst instanceof Text)) {
View Full Code Here

      unchevronned = unchevronned.replace("&", "sapientAmpersand");
      //System.out.println("unchevronned" + unchevronned);
      //System.out.println("sentenceElement XML: " + sentenceElement.toXML());
      if(annotNodes.size() != 0) {
        Node annotNode = annotNodes.get(0);       
        annotNode.detach();
        sentenceElement.appendChild(unchevronned);
      }
       
      if(sids.contains(sentid)) {
        //System.out.println(sentid);
View Full Code Here

          if(cm.exists()) {
            try {
              Nodes nn = new Builder().build(cm).query(XMLStrings.getInstance().TITLE_XPATH, XMLStrings.getInstance().getXpc());
              if(nn.size() > 0){
                Node n = nn.get(0);
                n.detach();
                a.appendChild(n);
              } else {               
                a.appendChild(children[i].getName());           
              }
            } catch (Exception e) {
View Full Code Here

        newElems.add(e);
      } else {
        Element lastElem = newElems.get(newElems.size()-1);
        Node n = lastElem.getChild(lastElem.getChildCount()-1);
        assert(n instanceof Text);
        n.detach();
        n = e.getChild(0);
        assert(n instanceof Text);
        n.detach();
        lastElem.appendChild(docTxt.substring(Integer.parseInt(lastElem.getAttributeValue("end")),
            Integer.parseInt(e.getAttributeValue("start"))));
View Full Code Here

        Node n = lastElem.getChild(lastElem.getChildCount()-1);
        assert(n instanceof Text);
        n.detach();
        n = e.getChild(0);
        assert(n instanceof Text);
        n.detach();
        lastElem.appendChild(docTxt.substring(Integer.parseInt(lastElem.getAttributeValue("end")),
            Integer.parseInt(e.getAttributeValue("start"))));
        while(e.getChildCount() > 0) {
          n = e.getChild(0);
          n.detach();
View Full Code Here

        n.detach();
        lastElem.appendChild(docTxt.substring(Integer.parseInt(lastElem.getAttributeValue("end")),
            Integer.parseInt(e.getAttributeValue("start"))));
        while(e.getChildCount() > 0) {
          n = e.getChild(0);
          n.detach();
          lastElem.appendChild(n);
        }
        lastElem.addAttribute(new Attribute("end", e.getAttributeValue("end")));
        lastElem.addAttribute(new Attribute("postEnd", e.getAttributeValue("postEnd")));
      }
View Full Code Here

                Node child = fallback.getChild(0);
                if (child instanceof Element) {
                    resolve((Element) child, builder, baseURLs);
                }
                child = fallback.getChild(0);
                child.detach();
                parent.insertChild(child, parent.indexOf(includeElement));
           }
           includeElement.detach();
          
    }
View Full Code Here

            // don't do when detaching
            String noFragment = node.getBaseURI();
            if (noFragment.indexOf('#') >= 0) {
                noFragment = noFragment.substring(0, noFragment.indexOf('#'));
            }
            node.detach();
            if (node instanceof Element) {
                ((Element) node).setBaseURI(noFragment);
            }
        } 
         
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.