Package nu.xom

Examples of nu.xom.Node.detach()


        }
      }
     
      int size = results.size();
      if (size == 0) { // pure delete?
        node.detach();
        continue; // not really needed; just for clarity
      }
     
      if (size == 1 && node == results.get(0)) {
        continue; // nothing to do (replace X with X)
View Full Code Here


            if (!isRoot) node.detach();
            isInitialized = true;
          }
         
          if (result instanceof Attribute) {
            result.detach();
            ((Element) parent).addAttribute((Attribute)result);
          } else {
            if (isRoot && result instanceof Element) {
              parent.replaceChild(node, result);
            } else {
View Full Code Here

            ((Element) parent).addAttribute((Attribute)result);
          } else {
            if (isRoot && result instanceof Element) {
              parent.replaceChild(node, result);
            } else {
              result.detach();
              parent.insertChild(result, position);
            }
            position++;
          }
        }
View Full Code Here

      Nodes results = transform.transform(elem);

      // prevent potential nu.xom.MultipleParentException by detaching
      for (int i = results.size(); --i >= 0; ) {
        Node node = results.get(i);
        if (node != elem) node.detach();
      }
      return results;
    }
   
    // is at least one child element present?
View Full Code Here

        int p = 0;
        while (true) {
            Node node = input.getChild(0);
            if (node instanceof Element) break;
            else {
                node.detach();
                if (node instanceof Text) continue;
                html.insertChild(node, p++);
            }
        }   
        Node newroot = input.getChild(0);
View Full Code Here

                if (node instanceof Text) continue;
                html.insertChild(node, p++);
            }
        }   
        Node newroot = input.getChild(0);
        newroot.detach();
        html.setRootElement((Element) newroot);
        while (input.getChildCount() > 0) {
            Node node = input.getChild(0);
            node.detach();
            if (node instanceof Text) continue;
View Full Code Here

        Node newroot = input.getChild(0);
        newroot.detach();
        html.setRootElement((Element) newroot);
        while (input.getChildCount() > 0) {
            Node node = input.getChild(0);
            node.detach();
            if (node instanceof Text) continue;
            html.appendChild(node);
        }   
       
        Nodes doc2Queries = root.query("child::query[starts-with(@id, 'A')]");
View Full Code Here

            Element td = new Element("td", XHTML_NAMESPACE);
            td.addAttribute(new Attribute("colspan", "2"));
            tr.appendChild(td);
            while (element.getChildCount() > 0) {
                Node child = element.getChild(0);
                child.detach();
                td.appendChild(child);
                if (child instanceof Element) convert((Element) child);
            }       
            table.appendChild(tr)
           
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.