import org.xml.sax.SAXException;
public class TimestampGenerator extends AbstractSAXGenerator {
public void execute() {
SAXConsumer consumer = this.getSAXConsumer();
try {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
consumer.startDocument();
consumer.startElement("", "timestamp", "timestamp", new ImmutableAttributesImpl());
String timestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(new Date());
consumer.characters(timestamp.toCharArray(), 0, timestamp.length());
consumer.endElement("", "timestamp", "timestamp");
consumer.endDocument();
} catch (SAXException e) {
throw new ProcessingException(e);
}
}