Examples of XppReader


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

*
*/
public class PrettyPrintDriver implements HierarchicalStreamDriver {

  public HierarchicalStreamReader createReader(Reader in) {
    return new XppReader(in);
  }
View Full Code Here

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

            try {
                String text = new String(command.getContent(), "UTF-8");
                switch (Stomp.Transformations.getValue(transformation)) {
                case JMS_OBJECT_XML:
                    in = new XppReader(new StringReader(text), XppFactory.createDefaultParser());
                    msg = createObjectMessage(in);
                    break;
                case JMS_OBJECT_JSON:
                    in = new JettisonMappedXmlDriver().createReader(new StringReader(text));
                    msg = createObjectMessage(in);
                    break;
                case JMS_MAP_XML:
                    in = new XppReader(new StringReader(text), XppFactory.createDefaultParser());
                    msg = createMapMessage(in);
                    break;
                case JMS_MAP_JSON:
                    in = new JettisonMappedXmlDriver().createReader(new StringReader(text));
                    msg = createMapMessage(in);
View Full Code Here

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

    protected Object unmarshall(Session session, TextMessage textMessage) throws JMSException {
        HierarchicalStreamReader in;
        if (streamDriver != null) {
          in = streamDriver.createReader(new StringReader(textMessage.getText()));
        } else {
          in = new XppReader(new StringReader(textMessage.getText()));
        }
        return getXStream().unmarshal(in);
    }
View Full Code Here

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

      try {
        String text = new String(command.getContent(), "UTF-8");
        switch (Stomp.Transformations.getValue(transformation)) {
        case JMS_OBJECT_XML:
          in = new XppReader(new StringReader(text));
          msg = createObjectMessage(in);
          break;
        case JMS_OBJECT_JSON:
          in = new JettisonMappedXmlDriver().createReader(new StringReader(text));
          msg = createObjectMessage(in);
          break;
        case JMS_MAP_XML:
          in = new XppReader(new StringReader(text));
          msg = createMapMessage(in);
          break;
        case JMS_MAP_JSON:
          in = new JettisonMappedXmlDriver().createReader(new StringReader(text));
          msg = createMapMessage(in);
View Full Code Here

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

    protected Object unmarshall(Session session, TextMessage textMessage) throws JMSException {
        HierarchicalStreamReader in;
        if (streamDriver != null) {
          in = streamDriver.createReader(new StringReader(textMessage.getText()));
        } else {
          in = new XppReader(new StringReader(textMessage.getText()));
        }
        return getXStream().unmarshal(in);
    }
View Full Code Here

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

  protected Object unmarshalReader(Reader reader) throws XmlMappingException, IOException {
    if (streamDriver != null) {
      return unmarshal(streamDriver.createReader(reader));
    }
    else {
      return unmarshal(new XppReader(reader));
    }
  }
View Full Code Here

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

    }

    // factory method
    protected HierarchicalStreamReader createReader(String xml) throws Exception {
        // Transmogrify XML input into binary format.
        HierarchicalStreamReader xmlReader = new XppReader(new StringReader(xml));

        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        HierarchicalStreamWriter binaryWriter = new BinaryStreamWriter(buffer);
        copier.copy(xmlReader, binaryWriter);
View Full Code Here

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

    // This test leverages the existing (comprehensive) tests for the XML readers
    // and adds an additional stage of copying in.

    // factory method - overriding base class.
    protected HierarchicalStreamReader createReader(String xml) throws Exception {
        HierarchicalStreamReader sourceReader = new XppReader(new StringReader(xml));

        StringWriter buffer = new StringWriter();
        HierarchicalStreamWriter destinationWriter = new CompactWriter(buffer);

        copier.copy(sourceReader, destinationWriter);

        return new XppReader(new StringReader(buffer.toString()));
    }
View Full Code Here

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

    }

    public void testSkipsValueIfEmpty() {
        String input = "<root><empty1/><empty2></empty2><not-empty>blah</not-empty></root>";
        String expected = "<root><empty1/><empty2/><not-empty>blah</not-empty></root>";
        HierarchicalStreamReader sourceReader = new XppReader(new StringReader(input));

        StringWriter buffer = new StringWriter();
        HierarchicalStreamWriter destinationWriter = new CompactWriter(buffer);

        copier.copy(sourceReader, destinationWriter);
View Full Code Here

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

                "<a>" +
                "  <b><c/></b>" +
                "  <b/>" +
                "  <d/>" +
                "</a>");
        HierarchicalStreamReader reader = new XppReader(input, new MXParser());
        PathTracker pathTracker = new PathTracker();

        reader = new PathTrackingReader(reader, pathTracker);
        assertEquals(new Path("/a"), pathTracker.getPath());

        reader.moveDown();
        assertEquals(new Path("/a/b"), pathTracker.getPath());

        reader.moveDown();
        assertEquals(new Path("/a/b/c"), pathTracker.getPath());

        reader.moveUp();
        assertEquals(new Path("/a/b"), pathTracker.getPath());

        reader.moveUp();
        reader.moveDown();
        assertEquals(new Path("/a/b[2]"), pathTracker.getPath());

        reader.moveUp();
        reader.moveDown();
        assertEquals(new Path("/a/d"), pathTracker.getPath());

        reader.moveUp();
        assertEquals(new Path("/a"), pathTracker.getPath());
    }
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.