Package org.w3c.dom

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


            if (elem.getOwnerDocument().getDocumentElement() == elem) {
                return elem.getOwnerDocument();
                // else, create a new doc and copy the element inside it
            } else {
                Document doc = createDocument();
                doc.appendChild(doc.importNode(node, true));
                return doc;
            }
            // other element types are not handled
        } else {
            throw new TransformerException("Unable to convert DOM node to a Document");
View Full Code Here


                throw new SoapFault(e);
            }
            Element parentNode = document.createElement(SoapMarshaler.MULTIPLE_DETAILS_NODE_WRAPPER);
            NodeList nodes = parent.getChildNodes();
            for (int i = 0; i < nodes.getLength(); i++) {
                parentNode.appendChild(document.importNode(nodes.item(i), true));
            }
            document.appendChild(parentNode);
            details = new DOMSource(document);
        }
        return details;
View Full Code Here

        }
    }

    private Document promote(Element element) {
        Document doc = (Document)element.getOwnerDocument().cloneNode(false);
        Element schema = (Element)doc.importNode(element, true);
        doc.appendChild(schema);
        Node parent = element.getParentNode();
        while (parent instanceof Element) {
            Element root = (Element)parent;
            NamedNodeMap nodeMap = root.getAttributes();
View Full Code Here

                for (int i = 0; i < nodeMap.getLength(); i++) {
                    Attr attr = (Attr)nodeMap.item(i);
                    String name = attr.getName();
                    if ("xmlns".equals(name) || name.startsWith("xmlns:")) {
                        if (schema.getAttributeNode(name) == null) {
                            schema.setAttributeNodeNS((Attr)doc.importNode(attr, true));
                        }
                    }
                }
            }   
            parent = parent.getParentNode();
View Full Code Here

                // Copy the property values under the new <property/> element
                for( int i = 0 ; i < values.getLength() ; i++ ) {
                  Node valueNode = values.item(i);
                  // Only <value/> elements or global elements are valid values...
                  if( valueNode.getNodeType() == Node.ELEMENT_NODE ) {
                    newProperty.appendChild(newdoc.importNode(values.item(i), true));
                    count++;
                  } // end if
                } // end for
               
                if( count == 0 ) {
View Full Code Here

            Document document = documentBuilderFactory.newDocumentBuilder().newDocument();
            Element newProperty = document.createElementNS(SCA11_NS, "property");

            if (result.getNodeType() == Node.ELEMENT_NODE) {
                // If the result is a <value/> element, use it directly in the result
                newProperty.appendChild(document.importNode(result, true));
            } else {
                // If the result is not a <value/> element, create a <value/> element to contain the result
                Element newValue = document.createElementNS(SCA11_NS, "value");
                newValue.appendChild(document.importNode(result, true));
                newProperty.appendChild(newValue);
View Full Code Here

                // If the result is a <value/> element, use it directly in the result
                newProperty.appendChild(document.importNode(result, true));
            } else {
                // If the result is not a <value/> element, create a <value/> element to contain the result
                Element newValue = document.createElementNS(SCA11_NS, "value");
                newValue.appendChild(document.importNode(result, true));
                newProperty.appendChild(newValue);
            } // end if
            document.appendChild(newProperty);

            return document;
View Full Code Here

            Element newProperty = document.createElementNS(SCA11_NS, "property");
           
            for( int i = 0 ; i < result.getLength() ; i++ ) {
            if (result.item(i).getNodeType() == Node.ELEMENT_NODE) {
                // If the result is an element, use it directly in the result
                newProperty.appendChild(document.importNode(result.item(i), true));
            } else {
                // If the result is not an element, create a <value/> element to contain the result
                Element newValue = document.createElementNS(SCA11_NS, "value");
                newValue.appendChild(document.importNode(result.item(i), true));
                newProperty.appendChild(newValue);
View Full Code Here

                // If the result is an element, use it directly in the result
                newProperty.appendChild(document.importNode(result.item(i), true));
            } else {
                // If the result is not an element, create a <value/> element to contain the result
                Element newValue = document.createElementNS(SCA11_NS, "value");
                newValue.appendChild(document.importNode(result.item(i), true));
                newProperty.appendChild(newValue);
            } // end if
            } // end for
           
            document.appendChild(newProperty);
View Full Code Here

            Element resource = doc.createElementNS(RESOURCE_SET_NS,
                                                   "xapi:resource");
            resource.setAttributeNS(RESOURCE_SET_NS, "xapi:documentID",
                                    res.getDocumentId());

            resource.appendChild(doc.importNode(
                    ((Document) res.getContentAsDOM()).getDocumentElement(), true));

            set.appendChild(resource);

            i++;
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.