Package org.w3c.dom.ls

Examples of org.w3c.dom.ls.LSOutput


            Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
            Element el = diagram.store(doc);
            DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
            DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
           
            LSOutput out = impl.createLSOutput();
            out.setByteStream(os);
            out.setEncoding(ShapeConstants.ENCODING);
           
            LSSerializer writer = impl.createLSSerializer();
            writer.write(el, out);
        }
        catch (Exception e) {
View Full Code Here


            DOMImplementationLS impl =
                    (DOMImplementationLS) registry.getDOMImplementation("LS");

            LSSerializer writer = impl.createLSSerializer();
            LSOutput output = impl.createLSOutput();
            output.setByteStream(byteArrayOutputStrm);
            writer.write(element, output);
            String elementString = byteArrayOutputStrm.toString();

            DocumentBuilderFactoryImpl.setDOOMRequired(true);
View Full Code Here

            DOMImplementationLS impl =
                    (DOMImplementationLS) registry.getDOMImplementation("LS");

            LSSerializer writer = impl.createLSSerializer();
            LSOutput output = impl.createLSOutput();
            output.setByteStream(byteArrayOutputStrm);
            writer.write(element, output);
            String elementString = byteArrayOutputStrm.toString();

            DocumentBuilderFactoryImpl.setDOOMRequired(true);
View Full Code Here

           
            DOMImplementationRegistry domReg = DOMImplementationRegistry.newInstance();
            DOMImplementationLS lsImpl = (DOMImplementationLS) domReg.getDOMImplementation("LS");
            LSSerializer lsSerializer = lsImpl.createLSSerializer();
            lsSerializer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);
            LSOutput output = lsImpl.createLSOutput();
            output.setEncoding("UTF-8");
           
            StringWriter destination = new StringWriter();
            output.setCharacterStream(destination);
            lsSerializer.write(doc, output);
            return destination.toString();
        } catch (Exception e) {
            // format failed, return unformatted xml
            return unformattedXml;
View Full Code Here

        ByteArrayInputStream xmlStream = new ByteArrayInputStream(xml);
        return parse(xmlStream);
    }

    public static void serialize(Node xml, OutputStream out) {
        LSOutput ouput = getOuput();
        ouput.setEncoding("utf-8");
        ouput.setByteStream(out);

        getSerializer().write(xml, ouput);
    }
View Full Code Here

                      if ((document.getFeature("Core", "3.0") != null) && (document.getFeature("LS", "3.0") != null))
                      {
                        DOMiLS = (DOMImplementationLS) (document.getImplementation()).getFeature("LS", "3.0");

                        // get a LSOutput object
                        LSOutput LSO = DOMiLS.createLSOutput();

                        FOS = new FileOutputStream(exportFilename);
                        LSO.setByteStream((OutputStream) FOS);

                        // get a LSSerializer object
                        LSSerializer LSS = DOMiLS.createLSSerializer();

                        // do the serialization
View Full Code Here

      if ((document.getFeature("Core", "3.0") != null) && (document.getFeature("LS", "3.0") != null))
      {
        DOMiLS = (DOMImplementationLS) (document.getImplementation()).getFeature("LS", "3.0");

        // get a LSOutput object
        LSOutput LSO = DOMiLS.createLSOutput();

        FOS = new FileOutputStream(filename);
        LSO.setByteStream((OutputStream) FOS);

        // get a LSSerializer object
        LSSerializer LSS = DOMiLS.createLSSerializer();

        // do the serialization
View Full Code Here

      if ((document.getFeature("Core", "3.0") != null) && (document.getFeature("LS", "3.0") != null))
      {
        DOMiLS = (DOMImplementationLS) (document.getImplementation()).getFeature("LS", "3.0");

        // get a LSOutput object
        LSOutput LSO = DOMiLS.createLSOutput();

        FOS = new FileOutputStream(filename);
        LSO.setByteStream((OutputStream) FOS);

        // get a LSSerializer object
        LSSerializer LSS = DOMiLS.createLSSerializer();

        // do the serialization
View Full Code Here

      FileOutputStream FOS = null;
      if ((data.getFeature("Core", "3.0") != null) && (data.getFeature("LS", "3.0") != null))
      {
        DOMiLS = (DOMImplementationLS) (data.getImplementation()).getFeature("LS", "3.0");

        LSOutput LSO = DOMiLS.createLSOutput();

        FOS = new FileOutputStream(filename+".xml");
        LSO.setByteStream((OutputStream) FOS);

        LSSerializer LSS = DOMiLS.createLSSerializer();

        LSS.write(getData(), LSO);
View Full Code Here

    public void write(OutputStream os)
    {
        DOMImplementation impl = doc.getImplementation();
        DOMImplementationLS implLS = (DOMImplementationLS)impl.getFeature("LS","3.0");
       
        LSOutput lso = implLS.createLSOutput();
        lso.setByteStream(os);
        LSSerializer writer = implLS.createLSSerializer();
       
        writer.write(doc, lso);
    }
View Full Code Here

TOP

Related Classes of org.w3c.dom.ls.LSOutput

Copyright © 2018 www.massapicom. 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.