public void serialize(XLog log, OutputStream out) throws IOException {
		XLogging.log("start serializing log to XES.XML",
				XLogging.Importance.DEBUG);
		long start = System.currentTimeMillis();
		SXDocument doc = new SXDocument(out);
		doc.addComment("This file has been generated with the OpenXES library. It conforms");
		doc.addComment("to the XML serialization of the XES standard for log storage and");
		doc.addComment("management.");
		doc.addComment("XES standard version: " + XRuntimeUtils.XES_VERSION);
		doc.addComment("OpenXES library version: "
				+ XRuntimeUtils.OPENXES_VERSION);
		doc.addComment("OpenXES is available from http://www.openxes.org/");
		SXTag logTag = doc.addNode("log");
		logTag.addAttribute("xes.version", XRuntimeUtils.XES_VERSION);
		logTag.addAttribute("xes.features", "nested-attributes");
		logTag.addAttribute("openxes.version", XRuntimeUtils.OPENXES_VERSION);
		logTag.addAttribute("xmlns", "http://www.xes-standard.org/");
		// define extensions
		for (XExtension extension : log.getExtensions()) {
			SXTag extensionTag = logTag.addChildNode("extension");
			extensionTag.addAttribute("name", extension.getName());
			extensionTag.addAttribute("prefix", extension.getPrefix());
			extensionTag.addAttribute("uri", extension.getUri().toString());
		}
		// define global attributes
		addGlobalAttributes(logTag, "trace", log.getGlobalTraceAttributes());
		addGlobalAttributes(logTag, "event", log.getGlobalEventAttributes());
		// define classifiers
		for (XEventClassifier classifier : log.getClassifiers()) {
			if (classifier instanceof XEventAttributeClassifier) {
				XEventAttributeClassifier attrClass = (XEventAttributeClassifier) classifier;
				SXTag clsTag = logTag.addChildNode("classifier");
				clsTag.addAttribute("name", attrClass.name());
				clsTag.addAttribute("keys", XTokenHelper
						.formatTokenString((List<String>) Arrays
								.asList(attrClass.getDefiningAttributeKeys())));
			}
		}
		// add log attributes
		addAttributes(logTag, log.getAttributes().values());
		for (XTrace trace : log) {
			SXTag traceTag = logTag.addChildNode("trace");
			addAttributes(traceTag, trace.getAttributes().values());
			for (XEvent event : trace) {
				SXTag eventTag = traceTag.addChildNode("event");
				addAttributes(eventTag, event.getAttributes().values());
			}
		}
		//
		doc.close();
		String duration = " (" + (System.currentTimeMillis() - start)
				+ " msec.)";
		XLogging.log("finished serializing log" + duration,
				XLogging.Importance.DEBUG);
	}
public void serialize ( XLog log , OutputStream out ) throws IOException { XLogging . log ( "start serializing log to XES.XML" , XLogging . Importance . DEBUG ) ; long start = System . currentTimeMillis ( ) ; SXDocument doc = new SXDocument ( out ) ; doc . addComment ( "This file has been generated with the OpenXES library. It conforms" ) ; doc . addComment ( "to the XML serialization of the XES standard for log storage and" ) ; doc . addComment ( "management." ) ; doc . addComment ( "XES standard version: " + XRuntimeUtils . XES_VERSION ) ; doc . addComment ( "OpenXES library version: " + XRuntimeUtils . OPENXES_VERSION ) ; doc . addComment ( "OpenXES is available from http://www.openxes.org/" ) ; SXTag logTag = doc . addNode ( "log" ) ; logTag . addAttribute ( "xes.version" , XRuntimeUtils . XES_VERSION ) ; logTag . addAttribute ( "xes.features" , "nested-attributes" ) ; logTag . addAttribute ( "openxes.version" , XRuntimeUtils . OPENXES_VERSION ) ; logTag . addAttribute ( "xmlns" , "http://www.xes-standard.org/" ) ; for ( XExtension extension : log . getExtensions ( ) ) { SXTag extensionTag = logTag . addChildNode ( "extension" ) ; extensionTag . addAttribute ( "name" , extension . getName ( ) ) ; extensionTag . addAttribute ( "prefix" , extension . getPrefix ( ) ) ; extensionTag . addAttribute ( "uri" , extension . getUri ( ) . toString ( ) ) ; } addGlobalAttributes ( logTag , "trace" , log . getGlobalTraceAttributes ( ) ) ; addGlobalAttributes ( logTag , "event" , log . getGlobalEventAttributes ( ) ) ; for ( XEventClassifier classifier : log . getClassifiers ( ) ) { if ( classifier instanceof XEventAttributeClassifier ) { XEventAttributeClassifier attrClass = ( XEventAttributeClassifier ) classifier ; SXTag clsTag = logTag . addChildNode ( "classifier" ) ; clsTag . addAttribute ( "name" , attrClass . name ( ) ) ; clsTag . addAttribute ( "keys" , XTokenHelper . formatTokenString ( ( List < String > ) Arrays . asList ( attrClass . getDefiningAttributeKeys ( ) ) ) ) ; } } addAttributes ( logTag , log . getAttributes ( ) . values ( ) ) ; for ( XTrace trace : log ) { SXTag traceTag = logTag . addChildNode ( "trace" ) ; addAttributes ( traceTag , trace . getAttributes ( ) . values ( ) ) ; for ( XEvent event : trace ) { SXTag eventTag = traceTag . addChildNode ( "event" ) ; addAttributes ( eventTag , event . getAttributes ( ) . values ( ) ) ; } } doc . close ( ) ; String duration = " (" + ( System . currentTimeMillis ( ) - start ) + " msec.)" ; XLogging . log ( "finished serializing log" + duration , XLogging . Importance . DEBUG ) ; }
/*
(non-Javadoc)

@see
org.deckfour.xes.out.XesSerializer#serialize(org.deckfour.xes.model.XLog,
java.io.OutputStream)