Package org.w3c.dom

Examples of org.w3c.dom.DocumentFragment.appendChild()


            --cnt;
        }

        n = traverseRightBoundary( endAncestor, how );
        if ( frag!=null )
            frag.appendChild( n );

        if ( how != CLONE_CONTENTS )
        {
            setStartAfter( startAncestor );
            collapse( true );
View Full Code Here


        Document myDoc = db.newDocument();
       
        Text textNode = myDoc.createTextNode(textNodeValue);
        DocumentFragment docFrag = myDoc.createDocumentFragment();
 
        docFrag.appendChild(textNode);
 
        return new NodeSet(docFrag);
      }
      catch(ParserConfigurationException pce)
      {
View Full Code Here

      lastChild = getLastChild();
    Node nextChild = null;
    for (Node child = firstChild; child != null; child = nextChild) {
      nextChild = child.getNextSibling();
      removeChild(child);
      fragment.appendChild(child);
      if (child == lastChild)
        break;
    }

    return fragment;
View Full Code Here

            try {
                Node body = soapMessage.getSOAPBody();
                Node nd = body.getFirstChild();
                while (nd != null) {
                    body.removeChild(nd);
                    frag.appendChild(nd);
                    nd = soapMessage.getSOAPBody().getFirstChild();
                }
                list.set(0, frag);
                //No need to buffer this as we're already a DOM,
                //but only do so if someone hasn't actually configured this
View Full Code Here

                if (doc.getDocumentElement() != null) {
                    ns = doc.getDocumentElement().getNamespaceURI();
                    nm = doc.getDocumentElement().getLocalName();
                }
                while (doc.getFirstChild() != null) {
                    frag.appendChild(doc.removeChild(doc.getFirstChild()));
                }
                if (nm != null) {
                    doc.appendChild(doc.createElementNS(ns, nm));
                }
            }
View Full Code Here

                getURLObject().toString();
            DocumentFragment result = null;
            try {
                Document d = df.createDocument(uri, new StringReader(text));
                result = doc.createDocumentFragment();
                result.appendChild(doc.importNode(d.getDocumentElement(),
                                                  true));
            } catch (Exception ex) {
                StringBuffer sb = new StringBuffer(text.length() +
                                                   FRAGMENT_PREFIX.length() +
                                                   "</svg>".length());
View Full Code Here

                         n != null;
                         n = n.getNextSibling()) {
                        if (n.getNodeType() == n.ELEMENT_NODE) {
                            n = doc.importNode(n, true);
                            result = doc.createDocumentFragment();
                            result.appendChild(n);
                            break;
                        }
                    }
                } catch (Exception exc) {
                    SAXDocumentFactory sdf = new SAXDocumentFactory
View Full Code Here

                         XMLResourceDescriptor.getXMLParserClassName());
                    try {
                        Document d = sdf.createDocument
                            (uri, new StringReader(text));
                        result = doc.createDocumentFragment();
                        result.appendChild(doc.importNode(d.getDocumentElement(), true));
                    } catch (Exception ext) {
                        if (userAgent != null)
                            userAgent.displayError(ext);
                    }
                }
View Full Code Here

            for(int i = 0; i < list.getLength(); i++) {

                // the found node is either an attribute or an element
                if (list.item(i).getNodeType() == Node.ATTRIBUTE_NODE) {
                    // if it is an attribute simple create a new text node with the value of the attribute
                    result.appendChild(doc.createTextNode(list.item(i).getNodeValue()));
                } else {
                    // now we have an element
                    // copy all children of this element in the resulting tree
                    NodeList childs = list.item(i).getChildNodes();
                    if (childs != null) {
View Full Code Here

                    // 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

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.