Package org.w3c.dom

Examples of org.w3c.dom.Node.replaceChild()


             * have to remove the fake element. See string buffer operation
             * below.
             */
            Element tmpEl1 = doc.createElement("temp");
            tmpEl1.setAttributeNS(WSConstants.XMLNS_NS, "xmlns", "urn:X");
            parent.replaceChild(tmpEl1, tmpEl); // replace STR with new node

            tmpEl1.appendChild(str);
            // End of HACK 1

            // XMLUtils.circumventBug2650(doc); // No longer needed???
View Full Code Here


        encryptData(contextDocument, element, false);

        Element encryptedElement = factory.toElement(ed);

        Node sourceParent = element.getParentNode();
        sourceParent.replaceChild(encryptedElement, element);

        return contextDocument;
    }

    /**
 
View Full Code Here

    assertOpen();

    final Node node = getNodeByXPath(expression);
    if (node != null) {
      final Node parent = node.getParentNode();
      parent.replaceChild(replacement, node);
     
      return (modified = true);
    }
   
    return false;
View Full Code Here

                                boolean keepSrcElement) {
        Document doc = ptr.getOwnerDocument();
        Node parent = ptr.getParentNode();
        if (keepSrcElement) {
            Element replacement = (Element)doc.importNode(src, true);
            parent.replaceChild(replacement, ptr);
            return (lval == ptr) ? replacement :  lval;
        }

        Element replacement = doc.createElementNS(ptr.getNamespaceURI(), ptr.getTagName());
        NodeList nl = src.getChildNodes();
View Full Code Here

        NodeList nl = src.getChildNodes();
        for (int i = 0; i < nl.getLength(); ++i)
            replacement.appendChild(doc.importNode(nl.item(i), true));
        copyAttributes(doc, ptr, replacement);
        copyAttributes(doc, src, replacement);
        parent.replaceChild(replacement, ptr);
        DOMUtils.copyNSContext(ptr, replacement);

        return (lval == ptr) ? replacement :  lval;
    }
View Full Code Here

        if (parent.getLocalName().equals(WSConstants.ENCRYPTED_HEADER)
            && parent.getNamespaceURI().equals(WSConstants.WSSE11_NS)) {
               
            Node decryptedHeader = parent.getFirstChild();
            Node soapHeader = parent.getParentNode();
            soapHeader.replaceChild(decryptedHeader, parent);

            dataRef.setProtectedElement((Element)decryptedHeader);
            dataRef.setXpath(getXPath(decryptedHeader));
        } else if (content) {
            dataRef.setProtectedElement(encData);
View Full Code Here

                    Node parent = oldNode.getParentNode();
                    String key = oldNode.getNodeValue().substring(I18N_PREFIX.length());
                    Element newNode = dom.createElementNS(I18N_NAMESPACE, "text");
                    newNode.setAttribute("key", key);
                    newNode.setAttribute("catalogue", "default");
                    parent.replaceChild(newNode,oldNode);
                }
            }
        }
    }
}
View Full Code Here

                                boolean keepSrcElement) {
        Document doc = ptr.getOwnerDocument();
        Node parent = ptr.getParentNode();
        if (keepSrcElement) {
            Element replacement = (Element)doc.importNode(src, true);
            parent.replaceChild(replacement, ptr);
            return (lval == ptr) ? replacement :  lval;
        }

        Element replacement = doc.createElementNS(ptr.getNamespaceURI(), ptr.getTagName());
        NodeList nl = src.getChildNodes();
View Full Code Here

                    if (attrValNs != null)
                       replacement.setAttributeNS(DOMUtils.NS_URI_XMLNS, "xmlns:"+ prefix, attrValNs);
                }
            }
        }
        parent.replaceChild(replacement, ptr);
        DOMUtils.copyNSContext(ptr, replacement);
       
        return (lval == ptr) ? replacement :  lval;
    }
View Full Code Here

                                boolean keepSrcElement) {
        Document doc = ptr.getOwnerDocument();
        Node parent = ptr.getParentNode();
        if (keepSrcElement) {
            Element replacement = (Element)doc.importNode(src, true);
            parent.replaceChild(replacement, ptr);
            return (lval == ptr) ? replacement :  lval;
        }

        Element replacement = doc.createElementNS(ptr.getNamespaceURI(), ptr.getTagName());
        NodeList nl = src.getChildNodes();
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.