This sample shows how the struct class used in the previous sample could be written to an XMLPrintStream object to print the data. It is assumed that a template instance key is supplied to the function and that the default configuration values will be used.
import curam.util.xml.impl.XMLDocument;
import curam.util.xml.impl.XMLEncodingConstants;
import curam.util.xml.impl.XMLPrintStream;
import
curam.util.administration.struct.XSLTemplateInstanceKey;
public class XMLSample {
void printDoc1(XSLTemplateInstanceKey tempKey,
MyStruct myStruct) {
XMLPrintStream myPrintStream = new XMLPrintStream();
myPrintStream.open(tempKey, MyPC, 1234);
myPrintStream.setEncoding(
XMLEncodingConstants.kEncodeISOLATIN1);
XMLDocument myDoc =
new XMLDocument(myPrintStream.getStream(),
XMLEncodingConstants.kEncodeISOLATIN1);
myDoc.open("A User", "31-Dec-1999", "1.0", "Sample 1");
myDoc.add(myStruct);
myDoc.close();
myPrintStream.close();
}
}