Package org.w3c.dom.ls

Examples of org.w3c.dom.ls.LSSerializer


            impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
        }
        LSOutput output = impl.createLSOutput();
        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        output.setByteStream(bout);
        LSSerializer writer = impl.createLSSerializer();
        writer.write(node, output);

        return bout.toByteArray();
    }
View Full Code Here


            impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
        }
        LSOutput output = impl.createLSOutput();
        RawByteArrayOutputStream bout = new RawByteArrayOutputStream();
        output.setByteStream(bout);
        LSSerializer writer = impl.createLSSerializer();
        writer.write(node, output);

        return new ByteArrayInputStream(bout.getBytes(), 0, bout.size());
    }
View Full Code Here

    @Override
    public void serialize(Node value, JsonGenerator jgen, SerializerProvider provider)
        throws IOException, JsonGenerationException
    {
        if (_domImpl == null) throw new IllegalStateException("Could not find DOM LS");     
        LSSerializer writer = _domImpl.createLSSerializer();
        jgen.writeString(writer.writeToString(value));
    }
View Full Code Here

           
            LSOutput out = impl.createLSOutput();
            out.setByteStream(os);
            out.setEncoding(ShapeConstants.ENCODING);
           
            LSSerializer writer = impl.createLSSerializer();
            writer.write(el, out);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

    }

    public static String toString(DOMSource source) {
        DOMImplementationLS ls = (DOMImplementationLS) source.getNode().getOwnerDocument().getImplementation();

        LSSerializer serializer = ls.createLSSerializer();
        serializer.getDomConfig().setParameter("xml-declaration", false);
        return serializer.writeToString(source.getNode());
    }
View Full Code Here

   public static String outputToXML(Element node)
   {
      Document document = node.getOwnerDocument();
      DOMImplementationLS domImplLS = (DOMImplementationLS)document.getImplementation();
      LSSerializer serializer = domImplLS.createLSSerializer();
      return serializer.writeToString(node);
   }
View Full Code Here

            DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();

            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);

            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
View Full Code Here

            DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();

            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);

            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
View Full Code Here

            InputSource is = new InputSource(new StringReader(unformattedXml));
            Document doc = db.parse(is);
           
            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

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

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

                        // do the serialization
                        LSS.write(document, LSO);

                        FOS.close();
                      }

                      // ===============================
View Full Code Here

TOP

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

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.