Package com.thoughtworks.xstream.io.xml

Examples of com.thoughtworks.xstream.io.xml.PrettyPrintWriter


      throw new StreamException(e);
    }
  }

  public HierarchicalStreamWriter createWriter(Writer out) {
    return new PrettyPrintWriter(out);
  }
View Full Code Here


   */
  private void saveToFile(VFSLeaf glossaryFile, ArrayList<GlossaryItem> glossaryItemArr) {
    // cdata-tags should be used instead of strings, overwrite writer.
    XStream xstream = new XStream(new XppDriver() {
      public HierarchicalStreamWriter createWriter(Writer out) {
        return new PrettyPrintWriter(out) {
          protected void writeText(QuickWriter writer, String text) {
            if (text.contains("<")||text.contains(">")||text.contains("&")){
              writer.write("<![CDATA[");
              writer.write(text);
              writer.write("]]>");
View Full Code Here

    /**
     * Override createWriter to wrap fields listed in CDATA_FIELDS with CDATA block
     */
    @Override
    public HierarchicalStreamWriter createWriter(Writer out) {
        return new PrettyPrintWriter(out) {
            boolean cdata = false;

            public void startNode(String name) {
                super.startNode(name);
                cdata = CDATA_FIELDS.contains(name);
View Full Code Here

        StringWriter buffer = new StringWriter();
        HierarchicalStreamWriter out;
        if (transformation.toLowerCase().endsWith("json")) {
            out = new JettisonMappedXmlDriver(new Configuration(), false).createWriter(buffer);
        } else {
            out = new PrettyPrintWriter(buffer);
        }
        getXStream().marshal(object, out);
        return buffer.toString();
    }
View Full Code Here

        StringWriter buffer = new StringWriter();
        HierarchicalStreamWriter out;
        if (transformation.toLowerCase().endsWith("json")) {
            out = new JettisonMappedXmlDriver().createWriter(buffer);
        } else {
            out = new PrettyPrintWriter(buffer);
        }

        XStream xstream = getXStream();
        xstream.setMode(XStream.NO_REFERENCES);
        xstream.aliasPackage("", "org.apache.activemq.command");
View Full Code Here

        StringWriter buffer = new StringWriter();
        HierarchicalStreamWriter out;
        if (streamDriver != null) {
          out = streamDriver.createWriter(buffer);
        } else {
          out = new PrettyPrintWriter(buffer);
        }
        getXStream().marshal(object, out);
        return buffer.toString();
    }
View Full Code Here

    StringWriter buffer = new StringWriter();
    HierarchicalStreamWriter out;
    if (transformation.toLowerCase().endsWith("json")) {
      out = new JettisonMappedXmlDriver(new Configuration(), false).createWriter(buffer);
    } else {
      out = new PrettyPrintWriter(buffer);
    }
    getXStream().marshal(object, out);
    return buffer.toString();
  }
View Full Code Here

    StringWriter buffer = new StringWriter();
    HierarchicalStreamWriter out;
    if (transformation.toLowerCase().endsWith("json")) {
      out = new JettisonMappedXmlDriver().createWriter(buffer);
    } else {
      out = new PrettyPrintWriter(buffer);
    }

    XStream xstream = getXStream();
        xstream.setMode(XStream.NO_REFERENCES);
        xstream.aliasPackage("", "org.apache.activemq.command");
View Full Code Here

        StringWriter buffer = new StringWriter();
        HierarchicalStreamWriter out;
        if (streamDriver != null) {
          out = streamDriver.createWriter(buffer);
        } else {
          out = new PrettyPrintWriter(buffer);
        }
        getXStream().marshal(object, out);
        return buffer.toString();
    }
View Full Code Here

            HierarchicalStreamDriver driver = new JettisonMappedXmlDriver();
            HierarchicalStreamReader hsr = driver.createReader(is);
            // See http://jira.codehaus.org/browse/JETTISON-48
            StringWriter writer = new StringWriter();
            new HierarchicalStreamCopier().copy(
                    hsr, new PrettyPrintWriter(writer));
            writer.close();
            newLayer = (WMSLayer) xs.fromXML(writer.toString());
        } else {
            throw new RestletException("Unknown or missing format extension: "
                    + formatExtension, Status.CLIENT_ERROR_BAD_REQUEST);
View Full Code Here

TOP

Related Classes of com.thoughtworks.xstream.io.xml.PrettyPrintWriter

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.