Package org.w3c.dom.ls

Examples of org.w3c.dom.ls.DOMImplementationLS.createLSOutput()


                                   "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
                registry = DOMImplementationRegistry.newInstance();
                impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
            }
        }
        LSOutput output = impl.createLSOutput();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        output.setByteStream(byteArrayOutputStream);
        LSSerializer writer = impl.createLSSerializer();
        writer.write(doc, output);
        byte[] buf = byteArrayOutputStream.toByteArray();
View Full Code Here


        DOMConfiguration domConfiguration = lsSerializer.getDomConfig();
        if (domConfiguration.canSetParameter("format-pretty-print",
                                             Boolean.TRUE)) {
            lsSerializer.getDomConfig().setParameter("format-pretty-print",
                                                     Boolean.TRUE);
            LSOutput lsOutput = domImpl.createLSOutput();
            lsOutput.setEncoding("UTF-8");
            lsOutput.setByteStream(out);
            lsSerializer.write(document, lsOutput);
        } else {
            throw new RuntimeException("DOMConfiguration 'format-pretty-print' parameter isn't settable.");
View Full Code Here

        DOMConfiguration config = serializer.getDomConfig();
        if (prettyPrint && config.canSetParameter("format-pretty-print", Boolean.TRUE)) {
            config.setParameter("format-pretty-print", true);
        }
        config.setParameter("xml-declaration", true);       
        LSOutput output = impl.createLSOutput();
        output.setEncoding("UTF-8");
        Writer writer = new StringWriter();
        output.setCharacterStream(writer);
        serializer.write(document, output);
        return writer.toString();
View Full Code Here

                                   "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
                registry = DOMImplementationRegistry.newInstance();
                impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
            }
        }
        LSOutput output = impl.createLSOutput();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        output.setByteStream(byteArrayOutputStream);
        LSSerializer writer = impl.createLSSerializer();
        writer.write(doc, output);
        byte[] buf = byteArrayOutputStream.toByteArray();
View Full Code Here

    // serialize the document
    try {
      DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
      DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
      LSSerializer writer = impl.createLSSerializer();
      LSOutput output = impl.createLSOutput();
     
      output.setByteStream(outStream);
      writer.write(network.getXmlDoc(), output);
    } catch (ClassCastException e) {
      throw new TranslationException(this, "Unable to generate XML for queue network.", e);
View Full Code Here

            throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        if (lsSerializer == null) {
            final DOMImplementation domImpl = DOMImplementationRegistry.newInstance().
                    getDOMImplementation("");
            final DOMImplementationLS domLS = (DOMImplementationLS) domImpl.getFeature("LS", "3.0");
            lsOutput = domLS.createLSOutput();
            lsOutput.setEncoding("UTF-8");
            lsSerializer = domLS.createLSSerializer();
        }
        lsOutput.setCharacterStream(writer);
        lsSerializer.write(node, lsOutput);
View Full Code Here

        try {
            if (lsSerializer == null) {
                final DOMImplementation domImpl = DOMImplementationRegistry.newInstance().
                        getDOMImplementation("");
                final DOMImplementationLS domLS = (DOMImplementationLS) domImpl.getFeature("LS", "3.0");
                lsOutput = domLS.createLSOutput();
                lsOutput.setEncoding("UTF-8");
                lsSerializer = domLS.createLSSerializer();
            }
            lsOutput.setCharacterStream(writer);
            lsSerializer.write(node, lsOutput);
View Full Code Here

            config.setParameter("xml-declaration", Boolean.FALSE);
            //config.setParameter("validate",errorHandler);

            // serialize document to standard output
            //domWriter.writeNode(System.out, doc);
            LSOutput dOut = impl.createLSOutput();
            dOut.setByteStream(System.out);
            domWriter.write(doc,dOut);

        } catch ( Exception ex ) {
            ex.printStackTrace();
View Full Code Here

                                                        entry.getValue()));
            root.appendChild(entryElement);
          }
        DOMImplementationLS loadAndSave = (DOMImplementationLS) domImpl;
        LSSerializer serializer = loadAndSave.createLSSerializer();
        LSOutput output = loadAndSave.createLSOutput();
        output.setByteStream(os);
        output.setEncoding(encoding);
        serializer.write(doc, output);
      }
    catch (ClassNotFoundException e)
View Full Code Here

              entry.getValue()));
      root.appendChild(entryElement);
    }
  DOMImplementationLS loadAndSave = (DOMImplementationLS) domImpl;
  LSSerializer serializer = loadAndSave.createLSSerializer();
  LSOutput output = loadAndSave.createLSOutput();
  output.setByteStream(os);
  output.setEncoding(encoding);
  serializer.write(doc, output);
      }
    catch (ClassNotFoundException e)
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.