Hi I need to create xml from data in form to send it to webservice. The problem is that .append()
is case insensitive, so .append(\'
jQuery.parseXML will always create a new DOMParse
and a new Document
, so it is pretty heavy.
A better approach would be to use the (unintuitive) parseHTML, using the context
paramter:
// Create the context XML document; doc and $doc is reusable
var doc = (new DOMParser()).parseFromString( ' ', 'text/xml' );
var $doc = $( doc.documentElement )
// Create case-sensitive XML element;
// this will call doc.createElement( 'EDO' ), as of jQuery 2.1.3
$doc.append( $.parseHTML( ' ', doc ) );