JSFiddle - React, Tailwind, and code Playground
by xonev
JavaScript
var fetchXml = '<fetch version="1.0" output-format="xml-platform" mapping="logical"><entity name="opportunity"><attribute name="name" /><attribute name="estimatedvalue" /><attribute name="estimatedclosedate" /><order attribute="estimatedclosedate" descending="false" /><filter type="and"><condition attribute="ownerid" operator="eq-userid" /><condition attribute="statecode" operator="eq" value="0" /></filter><attribute name="customerid" /><attribute name="closeprobability" /><attribute name="opportunityratingcode" /><link-entity alias="opportunitycustomeridcontactcontactid" name="contact" from="contactid" to="customerid" link-type="outer" visible="false"><attribute name="emailaddress1" /></link-entity><attribute name="opportunityid" /></entity></fetch>';
var fetchXml2 = '<fetch version="2.0"><channel><title>RSS Title</title></channel></fetch>';
var xml = $.parseXML(fetchXml);
var $xml = $(xml);
var element = $xml.find('filter').first().get(0);
window.alert((new XMLSerializer()).serializeToString(element));