Package org.w3c.dom.ls

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


        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


        DOMImplementationLS domImpl = (DOMImplementationLS) dom.getImplementation();// safe cast as
                                                                                    // long as we're
                                                                                    // on Java6

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        LSOutput destination = domImpl.createLSOutput();
        destination.setByteStream(out);
        LSSerializer serializer = domImpl.createLSSerializer();
        DOMConfiguration domConfig = serializer.getDomConfig();
        if (domConfig.canSetParameter("format-pretty-print", Boolean.TRUE)) {
            domConfig.setParameter("format-pretty-print", Boolean.TRUE);
View Full Code Here

          pas.document.removeChild(pas.documentType);
        }
        DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
        DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
        LSSerializer writer = impl.createLSSerializer();
        LSOutput output = impl.createLSOutput();
        ByteArrayOutputStream bArray = new ByteArrayOutputStream();
        output.setByteStream(bArray);
        writer.write(pas.document, output);
        if(pas.documentType!=null)
        {
View Full Code Here

      pas.document.removeChild(pas.documentType);
      DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
      DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
      LSSerializer writer = impl.createLSSerializer();
      LSOutput output = impl.createLSOutput();
      ByteArrayOutputStream bArray = new ByteArrayOutputStream();
      output.setByteStream(bArray);
      writer.write(pas.document, output);
      pas.document.appendChild(pas.documentType);
      byte [] ba = bArray.toByteArray();
View Full Code Here

      pas.document.removeChild(pas.documentType);
      DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
      DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
      LSSerializer writer = impl.createLSSerializer();
      LSOutput output = impl.createLSOutput();
      ByteArrayOutputStream bArray = new ByteArrayOutputStream();
      output.setByteStream(bArray);
      writer.write(pas.document, output);
      pas.document.appendChild(pas.documentType);
      byte [] ba = bArray.toByteArray();
View Full Code Here

    DOMImplementationLS domImplLS = (DOMImplementationLS) domImpl.getFeature(LSXmlWriter.FEATURE_NAME, LSXmlWriter.FEATURE_VERSION);

    LSSerializer serializer = domImplLS.createLSSerializer();
    serializer.getDomConfig().setParameter(LSXmlWriter.PRETTY_PRINT_OPTION, LSXmlWriter.PRETTY_PRINT_VALUE);

    LSOutput output = domImplLS.createLSOutput();
    output.setCharacterStream(writer);
    output.setEncoding(encoding.name());

    serializer.write(node, output);
  }
View Full Code Here

          .getFeature("LS", "3.0");
      LSSerializer lsSerializer = domImplementationLS.createLSSerializer();
      DOMConfiguration domConfiguration = lsSerializer.getDomConfig();
      if (domConfiguration.canSetParameter("format-pretty-print", Boolean.TRUE)) {
        lsSerializer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);
        LSOutput lsOutput = domImplementationLS.createLSOutput();
        lsOutput.setEncoding("UTF-8");
        StringWriter stringWriter = new StringWriter();
        lsOutput.setCharacterStream(stringWriter);
        lsSerializer.write(doc, lsOutput);
        return stringWriter.toString();
View Full Code Here

    DOMImplementationLS domImplLS = (DOMImplementationLS) domImpl.getFeature(LSXmlWriter.FEATURE_NAME, LSXmlWriter.FEATURE_VERSION);

    LSSerializer serializer = domImplLS.createLSSerializer();
    serializer.getDomConfig().setParameter(LSXmlWriter.PRETTY_PRINT_OPTION, LSXmlWriter.PRETTY_PRINT_VALUE);

    LSOutput output = domImplLS.createLSOutput();
    output.setCharacterStream(writer);
    output.setEncoding(encoding.name());

    serializer.write(node, output);
  }
View Full Code Here

        LSSerializer serializer = impl.createLSSerializer();
        // document.normalizeDocument();
        DOMConfiguration config = serializer.getDomConfig();
        config.setParameter("xml-declaration", true);
        config.setParameter("format-pretty-print", 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

      dom.getDocumentElement().appendChild(colleagueElem);
    }

    DOMImplementationLS ls = (DOMImplementationLS) domImpl;
    LSSerializer lss = ls.createLSSerializer();
    LSOutput lso = ls.createLSOutput();
    StringWriter writer = new StringWriter();
    lso.setCharacterStream(writer);
    lss.write(dom, lso);

    String result = writer.toString();
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.