Package org.w3c.dom

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


            }

            Element[] elementDeclarations = (Element[]) elementElementsList
                    .toArray(new Element[elementElementsList.size()]);
            for (int i = 0; i < elementDeclarations.length; i++) {
                schemaElement.appendChild(ownerDocument.importNode(
                        elementDeclarations[i], true));
            }

            // don't return anything!!
            return null;
View Full Code Here


            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

            if (messages[i] != null) {
                Element elem = st.toDOMElement(messages[i]);
                if (messageElementName != null) {
                    Element msg = createChildElement(messageElementName, root);
                    msg.setAttribute(indexAttribute, Integer.toString(i));
                    msg.appendChild(doc.importNode(elem, true));
                } else {
                    root.appendChild(doc.importNode(elem, true));
                }
            }
        }
View Full Code Here

                if (messageElementName != null) {
                    Element msg = createChildElement(messageElementName, root);
                    msg.setAttribute(indexAttribute, Integer.toString(i));
                    msg.appendChild(doc.importNode(elem, true));
                } else {
                    root.appendChild(doc.importNode(elem, true));
                }
            }
        }
        message.setContent(new DOMSource(doc));
        message.setProperty(AbstractSplitter.SPLITTER_CORRID, correlationId);
View Full Code Here

    private void handleJBIFault(SoapMessage message, Element soapFault) {
        Document doc = DomUtil.createDocument();
       
        Element jbiFault = DomUtil.createElement(doc, new QName(JBIConstants.NS_JBI_BINDING, JBIFault.JBI_FAULT_ROOT));
        Node jbiFaultDetail = doc.importNode(soapFault.getElementsByTagName(JBIFault.JBI_FAULT_DETAIL).item(0).getFirstChild(), true);
        jbiFault.appendChild(jbiFaultDetail);
        message.setContent(Source.class, new DOMSource(doc));
        message.put("jbiFault", true);
    }
View Full Code Here

        Document document = new SourceTransformer().createDocument();
        Element enricherElement = createChildElement(enricherElementName, document);
        Element requestElement = createChildElement(requestElementName, document);

        Node node = document.importNode(originalDocumentNode, true);
        requestElement.appendChild(node);
        enricherElement.appendChild(requestElement);
        document.appendChild(enricherElement);

        Element resultElement = createChildElement(resultElementName, document);
View Full Code Here

        enricherElement.appendChild(requestElement);
        document.appendChild(enricherElement);

        Element resultElement = createChildElement(resultElementName, document);

        Node node2 = document.importNode(targetResultNode, true);

        resultElement.appendChild(node2);
        enricherElement.appendChild(resultElement);
        return document;
View Full Code Here

                        throw new Fault("Body part '" + part.getName() + "' contains no element; expected a single element.");
                    }
                    if (!wsdlMessage.getElementName().equals(DomUtil.getQName(e))) {
                        throw new Fault("Body part '" + part.getName() + "' element '" + DomUtil.getQName(e) + " doesn't match expected element '" + QNameUtil.toString(wsdlMessage.getElementName()) + "'");
                    }
                    body = document.importNode(e, true);
                    document.appendChild(body);
                } else /* rpc-style */ {
                    for (int j = 0; j < nodes.getLength(); j++) {
                        /* note: we don't do any validation on RPC-style part value types */
                        Element e = document.createElementNS(wsdlMessage.getElementName().getNamespaceURI(), part.getName());
View Full Code Here

                } else /* rpc-style */ {
                    for (int j = 0; j < nodes.getLength(); j++) {
                        /* note: we don't do any validation on RPC-style part value types */
                        Element e = document.createElementNS(wsdlMessage.getElementName().getNamespaceURI(), part.getName());
                        body.appendChild(e);
                        e.appendChild(document.importNode(nodes.item(j), true));
                    }
                }
            } else {
                DocumentFragment frag = document.createDocumentFragment();
                Element e = null;
View Full Code Here

                QName headerName = part.getElement();
                if (!headerName.equals(DomUtil.getQName(e))) {
                    throw new Fault("Header part '" + part.getName() + "' element '" + DomUtil.getQName(e) + " doesn't match expected element '" + QNameUtil.toString(headerName) + "'");
                }
                for (int j=0; j<nodes.getLength(); j++) {
                    frag.appendChild(document.importNode(nodes.item(j), true));
                }
                message.getSoapHeaders().put(headerName, frag);
            }
        }
        message.setContent(Source.class, new DOMSource(document));
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.