Package org.w3c.dom

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


            // and when the namespace URI is null.
            // We overcome this by creating a dummy root element that is then removed.
            if(doctype!=null) {
                if(namespaceURI==null && qualifiedName==null) {
                    Document doc = getDOMImplementation().createDocument(null,"ns",doctype); // $NON-NLS-1$
                    doc.removeChild(doc.getDocumentElement());
                    return doc;
                }
            }
            // Some parsers do *not* support creating a document with both being null
            // We delegate to JAXP in this case
View Full Code Here



    public void processElement(Element element, BeanDefinitionReader beanDefinitionReader) {
        Document document = element.getOwnerDocument();
        Element beans = document.createElement("beans");
        document.removeChild(element);
        document.appendChild(beans);

        Element bean = addBeanElement(beans, Descriptor.class.getName());
        DOMUtil.copyAttributes(element, beans);
        DOMUtil.moveContent(element, bean);
View Full Code Here

    protected void addPartValue(Element element, String name, Object value) {
        if (value instanceof Document) {
            Document doc = (Document) value;
            Element root = doc.getDocumentElement();
            doc.removeChild(root);
            element.appendChild(root);
        }
        else if (value != null) {
            String text = value.toString();
            element.appendChild(element.getOwnerDocument().createTextNode(text));
View Full Code Here

      return null;

    final Element newElement = document.createElement(containerName);
    final Element documentElement = document.getDocumentElement();

    document.removeChild(documentElement);
    document.appendChild(newElement);
    newElement.appendChild(documentElement);

    return XMLUtilities.convertDocumentToString(document);
  }
View Full Code Here

        Node child = doc.getFirstChild();
        Node next = null;
        while (child != null) {
            next = child.getNextSibling();
            if (child.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
                doc.removeChild(child);
            }
            child = next;
        }

        //
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


    public void processElement(Element element, BeanDefinitionReader beanDefinitionReader) {
        Document document = element.getOwnerDocument();
        Element beans = document.createElement("beans");
        document.removeChild(element);
        document.appendChild(beans);

        Element bean = addBeanElement(beans, Descriptor.class.getName());
        DOMUtil.copyAttributes(element, beans);
        DOMUtil.moveContent(element, bean);
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

    Document result = null;
    try {
      result = getDomImplementation().createDocument("http://www.w3.org/XML/1998/namespace", getRootElementName(), null); //$NON-NLS-1$
      NodeList children = result.getChildNodes();
      for (int i = 0; i < children.getLength(); i++) {
        result.removeChild(children.item(i));
      }
      // we're going through this effort to avoid a NS element
      Element settings = result.createElementNS("http://www.w3.org/XML/1998/namespace", getRootElementName()); //$NON-NLS-1$
      result.appendChild(settings);
      return result;
View Full Code Here

    Document result = null;
    try {
      result = getDomImplementation().createDocument("http://www.w3.org/XML/1998/namespace", getRootElementName(), null); //$NON-NLS-1$
      NodeList children = result.getChildNodes();
      for (int i = 0; i < children.getLength(); i++) {
        result.removeChild(children.item(i));
      }
      // we're going through this effort to avoid a NS element
      Element settings = result.createElementNS("http://www.w3.org/XML/1998/namespace", getRootElementName()); //$NON-NLS-1$
      result.appendChild(settings);
      return result;
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.