Package org.w3c.dom

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


    }

    protected void runTest() throws Throwable {
        Document document = dbf.newDocumentBuilder().newDocument();
       
        DocumentFragment fragment = document.createDocumentFragment();
        Element x = document.createElementNS(null, "x");
        Element y = document.createElementNS(null, "y");
        fragment.appendChild(x);
        fragment.appendChild(y);
       
View Full Code Here


    }

    protected void runTest() throws Throwable {
        Document document = dbf.newDocumentBuilder().newDocument();
       
        DocumentFragment fragment = document.createDocumentFragment();
        Element x = document.createElementNS(null, "x");
        Element y = document.createElementNS(null, "y");
        fragment.appendChild(x);
        fragment.appendChild(y);
       
View Full Code Here

      dbf.setNamespaceAware(true);

      DocumentBuilder db = dbf.newDocumentBuilder();
      Document doc = db.newDocument();
      Node df = doc.createDocumentFragment();

      return getDTM(new DOMSource(df), true, null, false, false);
    }
    catch (Exception e)
    {
View Full Code Here

        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document myDoc = db.newDocument();
       
        Text textNode = myDoc.createTextNode(textNodeValue);
        DocumentFragment docFrag = myDoc.createDocumentFragment();
 
        docFrag.appendChild(textNode);
 
        return new NodeSet(docFrag);
      }
View Full Code Here

  protected DocumentFragment parseFragmentImpl(String source) throws GadgetException {
    try {
      Document htmlDoc = documentProvider.createDocument(null, null, null);
      // Workaround for error check failure adding text node to entity ref as a child
      htmlDoc.setStrictErrorChecking(false);
      DocumentFragment fragment = htmlDoc.createDocumentFragment();
      InputSource input = new InputSource(new StringReader(source));
      DOMFragmentParser parser = new DOMFragmentParser();
      parser.setProperty("http://cyberneko.org/html/properties/names/elems", "default");
      parser.setFeature("http://cyberneko.org/html/features/document-fragment", true);
      parser.setProperty("http://cyberneko.org/html/properties/names/attrs", "no-change");
View Full Code Here

      dbf.setNamespaceAware(true);

      DocumentBuilder db = dbf.newDocumentBuilder();
      Document doc = db.newDocument();
      Node df = doc.createDocumentFragment();

      return getDTM(new DOMSource(df), true, null, false, false);
    }
    catch (Exception e)
    {
View Full Code Here

                docBuilder.setEntityResolver(entityResolver);

              Node xmlDoc = docBuilder.parse(new InputSource(inFileName));
              Document doc = docBuilder.newDocument();
              org.w3c.dom.DocumentFragment outNode =
                doc.createDocumentFragment();

              transformer.transform(new DOMSource(xmlDoc, inFileName),
                                    new DOMResult(outNode));

              // Now serialize output to disk with identity transformer
View Full Code Here

       
        Document doc = builder.newDocument();
       
        // Create a DocumentFragment that will hold the results of toDOM()
        // (which can create several top-level elements)
        Node df = doc.createDocumentFragment();
       
        // Build the DOM representation of this object
        try {
            toDOM(df);
        }
View Full Code Here

            } else {
                document = XMLUtils.newDocument();
                message.setContent(Node.class, document);
            }
           
            W3CDOMStreamWriter writer = new W3CDOMStreamWriter(document.createDocumentFragment());
       
            // Replace stax writer with DomStreamWriter
            message.setContent(XMLStreamWriter.class, writer);       
            message.put(ORIGINAL_WRITER, origWriter);
           
View Full Code Here

                        body.appendChild(e);
                        e.appendChild(document.importNode(nodes.item(j), true));
                    }
                }
            } else {
                DocumentFragment frag = document.createDocumentFragment();
                Element e = null;
                for (int i = 0; i < nodes.getLength(); i++) {
                    Node n = nodes.item(i);
                    if (n instanceof Element) {
                        if (e != null) {
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.