getXMLString (DOMDocument - JavaScript)

Gets the XML represented by the Document Object Model.

Defined in

DOMDocument

Syntax

getXMLString() : string

getXMLString(compact:boolean) : string

getXMLString(compact:boolean, xmldecl:boolean) : string

Parameter Description
compact True to compact the XML.
xmldecl True to retain the XML declaration.
Return value Description
string The document in XML format.

Examples

This button gets the document in the current database specified byrequestScope.n and puts it in requestScope.y. The requestScope variables are bound to fields. The commented lines show alternate calls.
if (requestScope.n != null
	&& requestScope.n < database.getDocumentCount()
	&& requestScope.n >= 0) {
	var dc = database.getAllDocuments();
	var doc = dc.getDocumentArray()[requestScope.n];
	var dom = doc.getDOM();
	requestScope.s = dom.getStringValue("/schema0/element0");
	requestScope.y = dom.getXMLString();
//	requestScope.y = dom.getXMLString(false, true);
//	requestScope.y = dom.getXMLString(true);
//	requestScope.y = dom.getXMLString(true, true);
}
Here is output for dom.getXMLString() where requestScope.y is bound to a multiline edit box.
<schema0>
  <element0>Content of element.</element0>
</schema0>
Here is output for dom.getXMLString(false, true) where requestScope.y is bound to a multiline edit box.
<?xml version="1.0" encoding="UTF-8"?>
<schema0>
  <element0>Content of element.</element0>
</schema0>
Here is output for dom.getXMLString(true) where requestScope.y is bound to a multiline edit box.
<schema0><element0>Content of element.</element0></schema0>
Here is output for dom.getXMLString(true, true) where requestScope.y is bound to a multiline edit box.
<?xml version="1.0" encoding="UTF-8"?>
<schema0><element0>doc1</element0></schema0>