Package org.w3c.dom

Examples of org.w3c.dom.Document.importNode()


        {

          Element e                 = (Element) errors.item(i);

          Document resultDocument   = new DocumentImpl();
          Node node                 = resultDocument.importNode(e, true);

          resultDocument.appendChild(node);

          DOMImplementation domImpl = DOMImplementationImpl.getDOMImplementation();
          DOMImplementationLS implLS = (DOMImplementationLS) domImpl;
View Full Code Here


          return null;
      }

      Element e                 = (Element) nl.item(0);
      Document resultDocument   = new DocumentImpl();
      Node node                 = resultDocument.importNode(e, true);

      resultDocument.appendChild(node);

      DOMImplementation domImpl = DOMImplementationImpl.getDOMImplementation();
      DOMImplementationLS implLS = (DOMImplementationLS) domImpl;
View Full Code Here

  protected final DocumentFragment getImportedComponentFragment(Node targetNode)
  {
    Document targetDocument = targetNode.getOwnerDocument();
   
    // return a deep import
    return (DocumentFragment)targetDocument.importNode(_fragment, true);
  }
 
  private final DocumentFragment _fragment;
}
View Full Code Here

            } else {
                Document doc = createDocument();
                // import node must not occur concurrent on the same node (must be its owner)
                // so we need to synchronize on it
                synchronized (node.getOwnerDocument()) {
                    doc.appendChild(doc.importNode(node, true));
                }
                return doc;
            }
            // other element types are not handled
        } else {
View Full Code Here

        DocumentFragment fragment = (DocumentFragment)result;

        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document doc = builder.newDocument();
        Node importedFragment = doc.importNode(fragment, true);
        doc.appendChild(doc.createElement("root"));
        doc.getFirstChild().appendChild(importedFragment);

    }
View Full Code Here

            target = source.getURI();
            if ( exists == true && this.state == STATE_INSERT ) {
                                message = "content inserted at: " + path;
                resource = SourceUtil.toDOM( source );
                // import the fragment
                Node importNode = resource.importNode(fragment, true);
                // get the node
                Node parent = DOMUtil.selectSingleNode(resource, path);

                // replace?
                if (replacePath != null) {
View Full Code Here

                                        resource = parser.createDocument();
                                    } finally {
                                        this.manager.release( (Component)parser );
                                    }

                                    resource.appendChild(resource.importNode(importNode, true));
                                    parent = resource;
                                    replaceNode = resource.importNode(replaceNode, true);
                                } else {
                                    parent.replaceChild(importNode, replaceNode);
                                }
View Full Code Here

                                        this.manager.release( (Component)parser );
                                    }

                                    resource.appendChild(resource.importNode(importNode, true));
                                    parent = resource;
                                    replaceNode = resource.importNode(replaceNode, true);
                                } else {
                                    parent.replaceChild(importNode, replaceNode);
                                }
                                message += ", replacing: " + replacePath;
                                if (reinsertPath != null) {
View Full Code Here

                    resource = parser.createDocument();
                } finally {
                    this.manager.release( (Component)parser );
                }
                // import the fragment
                Node importNode = resource.importNode(fragment, true);
                if ( path.equals("") ) {  // this is allowed in write
                    resource.appendChild(importNode);
                    message = "entire source overwritten";

                } else {
View Full Code Here

        if (path == null || path.equals("") == true) {
            Document doc = DOMUtil.createDocument();
            result = doc.createDocumentFragment();
            this.getLayoutDOM();
            if (this.layoutDOM != null) {
                result.appendChild(doc.importNode(this.layoutDOM.getDocumentElement(), true));
            }
            if (this.configurationDOM != null) {
                result.appendChild(doc.importNode(this.configurationDOM.getDocumentElement(), true));
            }
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.