Package org.w3c.dom.ls

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


     * @param doc
     * @return string
     */
    public String getStringFromDoc(org.w3c.dom.Document doc) {
        DOMImplementationLS domImplementation = (DOMImplementationLS) doc.getImplementation();
        LSSerializer lsSerializer = domImplementation.createLSSerializer();
        lsSerializer.getDomConfig().setParameter("xml-declaration", false);
        //lsSerializer.getDomConfig().setParameter("xml-declaration", false);

        return lsSerializer.writeToString(doc);
    }
View Full Code Here


    if (domImplementation.hasFeature("LS", "3.0")
        && domImplementation.hasFeature("Core", "2.0")) {
      DOMImplementationLS domImplementationLS = (DOMImplementationLS) domImplementation
          .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");
View Full Code Here

        LSInput input = domLS.createLSInput();
        input.setStringData(xml);
        Document document = lsParser.parse(input);

        LSSerializer lsSerializer = domLS.createLSSerializer();
        lsSerializer.getDomConfig().setParameter("comments", Boolean.FALSE);
        lsSerializer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);
        return lsSerializer.writeToString(document);
    }
View Full Code Here

            throw new LDPathException(msg, e);
        }

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DOMImplementationLS lsImpl = (DOMImplementationLS) registry.getDOMImplementation("LS");
        LSSerializer lsSerializer = lsImpl.createLSSerializer();
        LSOutput lsOutput = lsImpl.createLSOutput();
        lsOutput.setEncoding("UTF-8");
        lsOutput.setByteStream(baos);
        lsSerializer.write(document, lsOutput);
        String schemaStr = new String(baos.toByteArray());
View Full Code Here

        .getImplementation();

    LSOutput output = impl.createLSOutput();
    output.setByteStream(byteStream);

    LSSerializer serializer = impl.createLSSerializer();
    serializer.getDomConfig().setParameter("format-pretty-print", true);
    serializer.write(document, output);
  }

}
View Full Code Here

            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

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

    public static DOMSource fromString(String xml) {
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);
   }

   public static Element createElement(String namespaceURI, String name)
   {
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.