Examples of cloneNode()


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

        path = this.createPath(path);

        try {
            result = XMLUtil.getSingleNode(data, path);
            if (result != null) result = result.cloneNode(true);
        } catch (javax.xml.transform.TransformerException localException) {
            throw new ProcessingException("TransformerException: " + localException, localException);
        }

        return result;
View Full Code Here

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

                    element = doc.createElementNS(SunShineConstants.SUNSHINE_NAMESPACE_URI, "sunshine:name");
                    parameter.appendChild(element);
                    element.appendChild(doc.createTextNode(parameterName));
                    element = doc.createElementNS(SunShineConstants.SUNSHINE_NAMESPACE_URI, "sunshine:value");
                    parameter.appendChild(element);
                    element.appendChild(valueNode.cloneNode(true));
                } catch (Exception local) {
                    // the exception is ignored and only this parameters is ignored
                }
            }
        }
View Full Code Here

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

    public void testUserDataHandler() throws Exception {
        Node node1 = root.getFirstChild().getNextSibling();
        TestDataHandler handler = new TestDataHandler();
        ((NodeImpl) node1).setUserData("key", "data", handler);
        node1.cloneNode(true);
        assertEquals(getExpectedResult(UserDataHandler.NODE_CLONED, "key", "data", node1), handler.getResult());

        ((DocumentImpl) node1.getOwnerDocument()).renameNode(node1, "http://newURI", "test:bar");
        assertEquals(getExpectedResult(UserDataHandler.NODE_RENAMED, "key", "data", node1), handler.getResult());
    }
View Full Code Here

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

            Node d;
            if (defaults != null &&
                (d = defaults.getNamedItem(name)) != null &&
                findNamePoint(name, index+1) < 0) {
                    NodeImpl clone = (NodeImpl)d.cloneNode(true);
                    if (d.getLocalName() !=null){
                            // we must rely on the name to find a default attribute
                            // ("test:attr"), but while copying it from the DOCTYPE
                            // we should not loose namespace URI that was assigned
                            // to the attribute in the instance document.
View Full Code Here

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

            if (defaults != null
                && (d = defaults.getNamedItem(nodeName)) != null)
                {
                    int j = findNamePoint(nodeName,0);
                    if (j>=0 && findNamePoint(nodeName, j+1) < 0) {
                        NodeImpl clone = (NodeImpl)d.cloneNode(true);
                        clone.ownerNode = ownerNode;
                        if (d.getLocalName() != null) {
                            // we must rely on the name to find a default attribute
                            // ("test:attr"), but while copying it from the DOCTYPE
                            // we should not loose namespace URI that was assigned
View Full Code Here

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

                ((ElementImpl) ownerNode).getDefaultAttributes();
            Node d;
            if (defaults != null && (d = defaults.getNamedItem(name)) != null
                && findNamePoint(name, i+1) < 0) {

                NodeImpl clone = (NodeImpl)d.cloneNode(true);
                clone.ownerNode = ownerNode;
                clone.isOwned(true);
                clone.isSpecified(false);
                nodes.setElementAt(clone, i);
            } else {
View Full Code Here

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

            if (defaults != null
                && (d = defaults.getNamedItem(nodeName)) != null)
                {
                    int j = findNamePoint(nodeName,0);
                    if (j>=0 && findNamePoint(nodeName, j+1) < 0) {
                        NodeImpl clone = (NodeImpl)d.cloneNode(true);
                        clone.ownerNode = ownerNode;
                        clone.isOwned(true);
                        clone.isSpecified(false);
                        nodes.setElementAt(clone, i);
                    } else {
View Full Code Here

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

                    // clone entity at this reference
                    boolean ro = isReadOnly();
                    isReadOnly(false);
                    Node child = entity.getFirstChild();
                    while (child != null) {
                        appendChild(child.cloneNode(true));
                        child = child.getNextSibling();
                    }
                    // set it back to readonly if what it was
                    if (ro) {
                        setReadOnly(true, true);
View Full Code Here

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

        // header case test 32
        if ("TD".equals(node.getNodeName()) && (null != attributes.getNamedItem("headers"))) {
            String id = attributes.getNamedItem("headers").getNodeValue();
            Node header = document.findNodeById(id);
            if (null != header) {
                node.appendChild(header.cloneNode(true));
                attributes.removeNamedItem("headers");
            }
        }

        // include pattern, test 31
View Full Code Here

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

                        "Current node tries to include an ancestor node.",
                        nodeLocation[0], nodeLocation[1]
                );
                continue;
            }
            current.appendChild(included.cloneNode(true));
        }
    }

    @Override
    protected boolean extractEntity(Node node, ExtractionResult out) throws ExtractionException {
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.