Examples of importNode()


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

      source = ((Document) sourceNode).getDocumentElement();
    } else {
      source = sourceNode;
    }

    Node node = doc.importNode(source, true);
    doc.appendChild(node);
   
    return doc;
  }
 
View Full Code Here

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

      source = ((Document) sourceNode).getDocumentElement();
    } else {
      source = sourceNode;
    }

    Node node = doc.importNode(source, true);
    doc.appendChild(node);
   
    return doc;
  }
 
View Full Code Here

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

         }
         else if (value instanceof org.w3c.dom.Element) {
            // (b) XML Element - mark the type and append a copy of it
            element.setAttribute(AL_TYPE_ATTRIBUTE, "org.w3c.dom.Element");
           
            Node copy = doc.importNode((org.w3c.dom.Element)value, true);
            element.appendChild(copy);
           
            // append the attribute to the attribute-list
            root.appendChild(element);
         }
View Full Code Here

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

  private void updateJob(Element updatedJob) throws Exception {
    Document jobDocument;
    try{
      jobDocument = converter.getDocBuilder().newDocument();
      jobDocument.appendChild(jobDocument.importNode(updatedJob, true));
    } catch (Exception e){
      throw new Exception("Error creating DOM Document for job: "+e,e);
    }
    if (useDynamicConfiguration){
      updateJobFile(jobDocument);
View Full Code Here

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

      if (usedNewRunTime && oldRunTime){
        // workaround while <month> Element is not available
        // can later be deleted (keep only else branch)
        usedNewRunTime = false;
        Document runTimeDocument = docBuilder.newDocument();
        runTimeDocument.appendChild(runTimeDocument.importNode(runTimeElement, true));
        StringWriter out = new StringWriter();
        OutputFormat format = new OutputFormat(runTimeDocument);   
        format.setIndenting(true);
        format.setIndent(2);
        format.setOmitXMLDeclaration(true);
View Full Code Here

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

            DocumentBuilder docBuilder = docFactory.newDocumentBuilder();               
            Document xDoc = docBuilder.newDocument();
            // xDoc.importNode(xNode, true);
            // Element xElem = xDoc.createElement("test");
            // xElem.appendChild(xDoc.importNode(xNode, true));
            xDoc.appendChild(xDoc.importNode(xNode, true));
           
            StringWriter out = new StringWriter();
            XMLSerializer serializer = new XMLSerializer(out, new OutputFormat(xDoc));
            serializer.serialize(xDoc);
            String result = out.toString();
View Full Code Here

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

        if (node == null) return "";

        DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();               
        DocumentBuilder docBuilder = docFactory.newDocumentBuilder();               
        Document document = docBuilder.newDocument();
        document.appendChild(document.importNode(node, true));
       
        StringWriter out = new StringWriter();
        XMLSerializer serializer = new XMLSerializer(out, new OutputFormat(document));
        serializer.serialize(document);
        return out.toString();
View Full Code Here

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

        } catch (ParserConfigurationException pcerr) {
            System.out.println ("Could not create document :"  + pcerr);           
            // Have to exit ---
        }             
       
        Element newModel = (Element) doc.importNode(model, true);
        doc.appendChild(newModel);
        Collection modelElements = new Vector ();           
        Element docElem = doc.getDocumentElement();
        modelElements.add(docElem);
        treeview.addModelElements(modelElements);
View Full Code Here

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

  public String xmlNodeToString(Node node) throws Exception {
    try {
      DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
      DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
      Document document = docBuilder.newDocument();
      document.appendChild(document.importNode(node, true));
      StringWriter out = new StringWriter();
      XMLSerializer serializer = new XMLSerializer(out, new OutputFormat(document));
      serializer.serialize(document);
      return out.toString();
    }
View Full Code Here

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

        Element parent = doc.createElement(event.getEventName());

        doc.appendChild(parent);

        for (Element elem : event.getResponses()) {
          parent.appendChild(doc.importNode(elem, true));
        }

        resultList.add(parent);
      }
    }
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.