Examples of adoptNode()


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

                                                    String referenceId,
                                                    String sigAlgo) throws Exception {
        Element docEl = doc.getDocumentElement();
        Document newDoc = DOMUtils.createDocument();
        doc.removeChild(docEl);
        newDoc.adoptNode(docEl);
        Element object = newDoc.createElementNS(Constants.SignatureSpecNS, "ds:Object");
        object.appendChild(docEl);
        object.setAttribute("ID", id);
       
        XMLSignature sig = new XMLSignature(newDoc, "", sigAlgo);
View Full Code Here

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

            String referenceId,
            String sigAlgo) throws Exception {
        Element docEl = doc.getDocumentElement();
        Document newDoc = DOMUtils.createDocument();
        doc.removeChild(docEl);
        newDoc.adoptNode(docEl);
        docEl.setAttribute("ID", id);
       
        Element root = newDoc.createElementNS(envelopeQName.getNamespaceURI(),
                envelopeQName.getPrefix() + ":" + envelopeQName.getLocalPart());
        root.appendChild(docEl);
View Full Code Here

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

    xmpMeta.setAttributeNS(XMPSchema.NS_NAMESPACE, "xmlns:x",
        "adobe:ns:meta/");

    newdoc.appendChild(xmpMeta);
    Element elem = (Element) metadata.getContainerElement().cloneNode(true);
    newdoc.adoptNode(elem);
    xmpMeta.appendChild(elem);

    if (intoXPacket) {
      ProcessingInstruction endXPacket = newdoc
          .createProcessingInstruction("xpacket", metadata
View Full Code Here

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

    try {
      Document doc = XMLUtil.newDocument();
      Element rdf = doc.createElementNS(
          "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf:RDF");
      Node schemContent = schema.getElement().cloneNode(true);
      doc.adoptNode(schemContent);
      rdf.appendChild(schemContent);
      XMLUtil.save(rdf, os, "UTF-8");
    } catch (TransformerException e) {
      throw new TransformException("Failed to parse defined XMP",e);
    } catch (IOException e) {
View Full Code Here

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

      Node node = getOriginalNode( signedDocument );

      DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
      documentBuilderFactory.setNamespaceAware( true );
      Document originalDoc = documentBuilderFactory.newDocumentBuilder().newDocument();
      originalDoc.appendChild( originalDoc.adoptNode( node ) );
      return originalDoc;
    } catch ( ParserConfigurationException e ) {
      throw new RuntimeException( e );
    }
  }
View Full Code Here

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

      newTimemlNode.appendChild(annotatedDoc.importNode(titleNode, true));
    }
    if (extraInfoNode != null) {
      newTimemlNode.appendChild(annotatedDoc.importNode(extraInfoNode, true));
    }
    newTimemlNode.appendChild(annotatedDoc.adoptNode(annotatedTextElem));
    annotatedDoc.appendChild(newTimemlNode);

    PrintWriter pw = (out != null)? IOUtils.getPrintWriter(out):new PrintWriter(System.out);
    String string = XMLUtils.documentToString(annotatedDoc);
    pw.println(string);
View Full Code Here

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

            attrName.append(elName.getPrefix());
            el.setAttribute(attrName.toString(), elName.getNamespaceURI());
        }

        for (Element part : childEl) {
            Node adoptedNode = doc.adoptNode(part);
            el.appendChild(adoptedNode);
        }

        return el;
    }   
View Full Code Here

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

                        newDoc = parserPool.newDocument();
                    } catch (XMLParserException e) {
                        log.error("There was an error creating a new DOM Document", e);
                        throw new DecryptionException("Error creating new DOM Document", e);
                    }
                    newDoc.adoptNode(element);
                    newDoc.appendChild(element);
                }
            }

            try {
View Full Code Here

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

      Node node = getOriginalNode( signedDocument );

      DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
      documentBuilderFactory.setNamespaceAware( true );
      Document originalDoc = documentBuilderFactory.newDocumentBuilder().newDocument();
      originalDoc.appendChild( originalDoc.adoptNode( node ) );
      return originalDoc;
    } catch ( ParserConfigurationException e ) {
      throw new RuntimeException( e );
    }
  }
View Full Code Here

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

      childElement.detachNode();

      // child element's owner document might be shared with other elements;
      // we have to create a separate document for returning to our caller
      Document newDocument = DOMUtils.getDocumentBuilder().newDocument();
      Node adoptedElement = newDocument.adoptNode(childElement.domNode);
      newDocument.appendChild(adoptedElement);

      return newDocument;
   }
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.