generateXML (NotesDocument - JavaScript)

Generates an XML representation of a document to the Writer. The XML conforms to the Domino® Document DTD.

Defined in

NotesDocument

Syntax

generateXML() : string

generateXML(writer:java.io.Writer) : void

generateXML(style:Object, result:XSLTResultTarget) : void

Parameter Description
writer The Writer that will receive the result XML.
style The style sheet you want to use to transform the generated XML.
result The object that receives the transformed XML.
Return value Description
string The XML representation of the document.

Usage

This method takes the same arguments as the transformXML method in NotesEmbeddedObject, NotesItem, NotesMIMEEntity, and NotesRichTextItem. The transformXML method reads the XML from an item, attachment, MIME entity, or rich text item and transforms the XML. The generateXML method generates the XML from the document and then transforms it.
The generateXML method supports the following simple items:
  • Text
  • Text list
  • Number
  • Number list
  • Datetime
  • Datetime list
To generate form semantics, you must call computeWithForm before calling generateXML.

Examples

This button creates a document, generates an XML representation of the document, and writes the result to a file.
try {
	var doc:NotesDocument = database.createDocument();
	doc.appendItemValue("Form", "main");
	doc.appendItemValue("Subject", requestScope.query);
	doc.appendItemValue("Quantity", requestScope.quantity);
	var bw:java.io.BufferedWriter = new java.io.BufferedWriter(new
		java.io.FileWriter("c:\\temp\\document.xml"));
	doc.generateXML(bw);
	bw.close();
	requestScope.status = "XML document written to c:\\temp";
} catch(e) {
	requestScope.status = e.toString();
}