Skip to content

Instantly share code, notes, and snippets.

@davidjgraph
Last active December 15, 2015 19:18
Show Gist options
  • Save davidjgraph/5309973 to your computer and use it in GitHub Desktop.
Save davidjgraph/5309973 to your computer and use it in GitHub Desktop.
mxUtils.getXml patch in mxGraph 1.12.0.1
mxUtils.getXml: function(node, linefeed)
{
var xml = '';
if (window.XMLSerializer != null)
{
var xmlSerializer = new XMLSerializer();
xml = xmlSerializer.serializeToString(node);
}
else if (node.xml != null)
{
xml = node.xml.replace(/\r\n\t[\t]*/g, '').
replace(/>\r\n/g, '>').
replace(/\r\n/g, '\n');
}
// Replaces linefeeds with HTML Entities.
linefeed = linefeed || '
';
xml = xml.replace(/\n/g, linefeed);
return xml;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment