Package org.w3c.dom

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


        secHeader.insertSecurityHeader(doc);
        Document signedDoc = builder.build(doc, crypto, secHeader);
       
        // Add a comment node as the first node element
        org.w3c.dom.Node firstChild = signedDoc.getFirstChild();
        org.w3c.dom.Node newNode = signedDoc.removeChild(firstChild);
        org.w3c.dom.Node commentNode = signedDoc.createComment("This is a comment");
        signedDoc.appendChild(commentNode);
        signedDoc.appendChild(newNode);

        if (LOG.isDebugEnabled()) {
View Full Code Here


        //Don't inject DOCTYPE if QName is null
        if(doctype_qname != null){
          DocumentType docTypeNode = document.getImplementation()
              .createDocumentType(doctype_qname, doctype_pubid, doctype_sysid);
          if(document.getDoctype() != null){
            document.removeChild(document.getDoctype());
          }
          document.insertBefore(docTypeNode, document.getFirstChild());
        }
      }
View Full Code Here

        //Don't inject DOCTYPE if QName is null
        if(doctype_qname != null){
          DocumentType docTypeNode = document.getImplementation()
              .createDocumentType(doctype_qname, doctype_pubid, doctype_sysid);
          if(document.getDoctype() != null){
            document.removeChild(document.getDoctype());
          }
          document.insertBefore(docTypeNode, document.getFirstChild());
        }
      }
View Full Code Here

    public static Document toDocumentWithoutDTD(InputStream in) throws Exception {
        Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in);
        DocumentType docType = doc.getDoctype();
        if (docType != null) {
            doc.removeChild(docType);
        }
        return doc;
    }
}
View Full Code Here

            //temporary marker to make sure recursive imports don't blow up
            schemaMap.put(file, null);

            Document doc = XMLUtils.parse(ins);
            Element elem = doc.getDocumentElement();
            doc.removeChild(elem);
           
            if ("schema".equals(elem.getLocalName())
                && "http://www.w3.org/2001/XMLSchema".equals(elem.getNamespaceURI())) {
                return addSchemaElement(sts, doc, elem, file);
            }
View Full Code Here

            //temporary marker to make sure recursive imports don't blow up
            schemaMap.put(file, null);

            Document doc = XMLUtils.parse(ins);
            Element elem = doc.getDocumentElement();
            doc.removeChild(elem);
           
            if ("schema".equals(elem.getLocalName())
                && "http://www.w3.org/2001/XMLSchema".equals(elem.getNamespaceURI())) {
                return addSchemaElement(sts, doc, elem, file);
            }
View Full Code Here

                } catch (TransformerConfigurationException e) {
                    throw new SAXException("Error creating a new TransformerHandler", e);
                }
                Document doc = domImplementation.createDocument(uri, qName, null);
                //It's easier to work with an empty document, so remove the root element
                doc.removeChild(doc.getDocumentElement());
                handler.setResult(new DOMResult(doc));
                Area parent = (Area)areaStack.peek();
                ((ForeignObject)parent).setDocument(doc);
               
                //activate delegate for nested foreign document
View Full Code Here

            //temporary marker to make sure recursive imports don't blow up
            schemaMap.put(file, null);

            Document doc = XMLUtils.parse(ins);
            Element elem = doc.getDocumentElement();
            doc.removeChild(elem);
           
            if ("schema".equals(elem.getLocalName())
                && "http://www.w3.org/2001/XMLSchema".equals(elem.getNamespaceURI())) {
                return addSchemaElement(sts, doc, elem, file);
            }
View Full Code Here

                       
                        // remove all the child nodes as they will be replaced by
                        // the "value" node
                        NodeList children = document.getChildNodes();
                        for (int i=0; i < children.getLength(); i++){
                            document.removeChild(children.item(i));
                        }
                       
                        // add the value node back in
                        document.appendChild(root);
                    }
View Full Code Here

        secHeader.insertSecurityHeader(doc);
        Document signedDoc = builder.build(doc, crypto, secHeader);
       
        // Add a comment node as the first node element
        org.w3c.dom.Node firstChild = signedDoc.getFirstChild();
        org.w3c.dom.Node newNode = signedDoc.removeChild(firstChild);
        org.w3c.dom.Node commentNode = signedDoc.createComment("This is a comment");
        signedDoc.appendChild(commentNode);
        signedDoc.appendChild(newNode);

        if (LOG.isDebugEnabled()) {
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.