Package org.w3c.dom

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


                    // now we have an element
                    // copy all children of this element in the resulting tree
                    NodeList childs = list.item(i).getChildNodes();
                    if (childs != null) {
                        for(int m = 0; m < childs.getLength(); m++) {
                            result.appendChild(doc.importNode(childs.item(m), true));
                        }
                    }
                }
            }
        }
View Full Code Here


                // this is a fast test, if the parameter value contains xml!
                parValue = values[i].trim();
                if (parValue.length() > 0 && parValue.charAt(0) == '<') {
                    try {
                        valueNode = DOMUtil.getDocumentFragment(parser, new StringReader(parValue));
                        valueNode = doc.importNode(valueNode, true);
                    } catch (Exception noXMLException) {
                        valueNode = doc.createTextNode(parValue);
                    }
                } else {
                    valueNode = doc.createTextNode(parValue);
View Full Code Here

                element = doc.createElementNS(null, "data");
                authenticationFragment.appendChild(element);
                Text text = doc.createTextNode("No information");
                element.appendChild(text);
            } else {
                authenticationFragment.appendChild(doc.importNode(data, true));
            }
           
            // now set this information in the temporary context
            SessionManager sessionManager = null;
            try {
View Full Code Here

                    element = doc.createElementNS(null, "data");
                    authenticationFragment.appendChild(element);
                    Text text = doc.createTextNode("No information");
                    element.appendChild(text);
                } else {
                    authenticationFragment.appendChild(doc.importNode(data, true));
                }

            }
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("end authentication");
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

        copyInto(n);
        if (deep) {
            for (Node c = getFirstChild();
                 c != null;
                 c = c.getNextSibling()) {
                n.appendChild(n.importNode(c, deep));
            }
        }
        return n;
    }
View Full Code Here

        return wsdlContract;
    }

    private static 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

        {

          Element e                 = (Element) errors.item(i);

          Document resultDocument   = new DocumentImpl();
          Node node                 = resultDocument.importNode(e, true);

          resultDocument.appendChild(node);

          DOMImplementation domImpl = DOMImplementationImpl.getDOMImplementation();
          DOMImplementationLS implLS = (DOMImplementationLS) domImpl;
View Full Code Here

          return null;
      }

      Element e                 = (Element) nl.item(0);
      Document resultDocument   = new DocumentImpl();
      Node node                 = resultDocument.importNode(e, true);

      resultDocument.appendChild(node);

      DOMImplementation domImpl = DOMImplementationImpl.getDOMImplementation();
      DOMImplementationLS implLS = (DOMImplementationLS) domImpl;
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.