use of org.simpleframework.xml.core.Persister in project applause by applause.
the class CompanyDescriptionProvider method extractItem.
protected Company extractItem(Reader reader) throws Exception {
Serializer serializer = new Persister();
Data root = serializer.read(Data.class, reader);
return root.getCompany();
}
use of org.simpleframework.xml.core.Persister in project applause by applause.
the class OfficeByIdProvider method extractItem.
protected Office extractItem(Reader reader) throws Exception {
Serializer serializer = new Persister();
Offices root = serializer.read(Offices.class, reader);
return root.getOffice();
}
use of org.simpleframework.xml.core.Persister in project netxms by netxms.
the class ChartConfig method createXml.
/**
* Create XML from configuration.
*
* @return XML document
* @throws Exception if the schema for the object is not valid
*/
public String createXml() throws Exception {
Serializer serializer = new Persister(new AnnotationStrategy());
Writer writer = new StringWriter();
serializer.write(this, writer);
return writer.toString();
}
use of org.simpleframework.xml.core.Persister in project netxms by netxms.
the class ChartConfig method createFromXml.
/**
* Create chart settings object from XML document
*
* @param xml XML document
* @return deserialized object
* @throws Exception if the object cannot be fully deserialized
*/
public static ChartConfig createFromXml(final String xml) throws Exception {
if (xml == null)
return new ChartConfig();
// should be removed in 1.2.1
if (!xml.startsWith("<chart>")) {
ChartConfig config = new ChartConfig();
config.parseLegacyConfig(xml);
return config;
}
Serializer serializer = new Persister(new AnnotationStrategy());
return serializer.read(ChartConfig.class, xml);
}
use of org.simpleframework.xml.core.Persister in project netxms by netxms.
the class ChartConfig method createXml.
/**
* Create XML from configuration.
*
* @return XML document
* @throws Exception if the schema for the object is not valid
*/
public String createXml() throws Exception {
Serializer serializer = new Persister(new AnnotationStrategy());
Writer writer = new StringWriter();
serializer.write(this, writer);
return writer.toString();
}
Aggregations