еще так:
X++:
static void Job30(Args _args)
{
XMLDocument x= XMLDocument::newBlank();
XMLElement root = x.appendChild(x.createElement('x'));
;
x.preserveWhitespace(true);
root.appendChild(x.createElement('line1'));
root.appendChild(x.createTextNode('\r\n'));
root.appendChild(x.createElement('line2'));
info(x.xml());
}