Class XStreamParser

java.lang.Object
esendex.sdk.java.parser.xstream.XStreamParser
All Implemented Interfaces:
XmlParser

public class XStreamParser extends Object implements XmlParser
XmlParser that uses the XStream library to convert between XML and Dto Objects.
Author:
Mike Whittaker
  • Constructor Details

    • XStreamParser

      public XStreamParser()
      Instantiate the parser by configuration of the underlying XStream instance. Developers are directed to XStream documentation for details on how to modify this configuration.
  • Method Details

    • fromXml

      public Object fromXml(String xml) throws EsendexException
      Converts if possible, a String, that must be in XML format, to a Dto.
      Specified by:
      fromXml in interface XmlParser
      Parameters:
      xml - the character data to be converted
      Returns:
      a Dto object representing the argument
      Throws:
      EsendexException - if there is any problem reading or parseing the XML.
    • toXml

      public String toXml(Dto dto)
      Converts a Dto Object to XML character data.
      Specified by:
      toXml in interface XmlParser
      Parameters:
      dto - the Dto Object to be converted.
      Returns:
      A String representation of the Dto argument.