code: function replaceSelfClosingTags(xmlStr) {
  
      var selfClosingTags = xmlStr.match(/<[^/][^>]*\/>/g);
  
      if (selfClosingTags) {
          for (var i = 0; i < selfClosingTags.length; i++) {
  
              var oldTag = selfClosingTags[i];
              var tempTag = oldTag.substring(0, oldTag.length - 2);
              tempTag += ">";
  
              var tagName = oldTag.match(/[^<][\w+$]*/)[0];
              var closingTag = "</" + tagName + ">";
              var newTag = "<" + tagName + ">";
  
              var attrs = tempTag.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?/g);
  
              if (attrs) {
                  for(var j = 0; j < attrs.length; j++) {
                      var attr = attrs[j];
                      var attrName = attr.substring(0, attr.indexOf('='));
                      var attrValue = attr.substring(attr.indexOf('"') + 1, attr.lastIndexOf('"'));
                      
                      newTag += "<" + attrName + ">" + attrValue + "</" + attrName + ">";
                  }
              }
  
              newTag += closingTag;
  
              xmlStr = xmlStr.replace(oldTag, newTag);
          }
      }
  
      return xmlStr;
  }
docs: ************************************************************************************************************ Replaces all the self closing tags with attributes with another tag containing its attribute as a property. The function works if the tag contains multiple attributes.  Example : '<tagName attrName="attrValue" />' becomes '<tagName><attrName>attrValue</attrName></tagName>' ************************************************************************************************************