×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Bill,
I did see several posts for XStream. I should look at it too. I haven't
tried JAXB on the System i yet. We have a couple V5R4 and one V6R1, which
Java 5 is the default (finally!).
Just to share the code real quick.
@XmlRootElement
public class Customer implements Serializable {
...
/**
* This method will return a XML version of the customer.
* <p>
* Uses the JAXB <code>Marshaller</code> to create the XML string.
*
* @return a XML version of the customer
*/
public String toXML() {
String xml = "";
//
try {
JAXBContext context = JAXBContext.newInstance(this.getClass());
Marshaller m = context.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
ByteArrayOutputStream out = new ByteArrayOutputStream();
m.marshal(this, out);
xml = out.toString();
try {
out.close();
} catch (IOException e) {
// Nothing to do
}
} catch (JAXBException e) {
e.printStackTrace();
xml = null;
}
return xml;
}
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.