title: WSO2 Script mediator unable to parse self closing XML tags
body: <p>I'm using a script mediator to convert the XML response to a JSON. The mediator works properly if the XML is well formatted but if the XML has self closing tags , it fails.. </p>
  
  <p>Any ideas to fix this issue is greatly appreciated.. </p>
  
  <pre><code>&lt;!-- XML data--&gt;
  &lt;getMyClsScheduleResponse &gt;
  &lt;RegisteredClass&gt;
    &lt;ClassNumber&gt;10757&lt;/ClassNumber&gt;
    &lt;SubjectCode&gt;AAS&lt;/SubjectCode&gt;
    &lt;CatalogNumber&gt;510&lt;/CatalogNumber&gt;
    &lt;SectionNumber&gt;001&lt;/SectionNumber&gt;
    &lt;SectionType&gt;IND&lt;/SectionType&gt;
    &lt;SectionTypeDescr&gt;Independent Study&lt;/SectionTypeDescr&gt;
    &lt;SessionDescr&gt;Regular&lt;/SessionDescr&gt;
    &lt;CourseDescr&gt;Supervised Research&lt;/CourseDescr&gt;
    &lt;ClassTopic /&gt;
    &lt;CreditHours&gt;1 - 6&lt;/CreditHours&gt;
    &lt;LMSURL /&gt; &lt;!--  Self Closing tag --&gt;
    &lt;Meeting&gt;
       &lt;MeetingNumber&gt;1&lt;/MeetingNumber&gt;
       &lt;Days /&gt;
       &lt;Times /&gt;
       &lt;StartDate&gt;09/02/2014&lt;/StartDate&gt;
       &lt;EndDate&gt;12/10/2014&lt;/EndDate&gt;
       &lt;Location&gt;TBA&lt;/Location&gt;
       &lt;TopicDescr /&gt;
    &lt;/Meeting&gt;
  </code></pre>
  
  <p>
  </p>
  
  <pre><code>/** Script Mediator */              
  function transformPayload(output) {
  payload = output.getPayloadJSON();
  results = payload.getMyClsScheduleResponse.RegisteredClasses;
  var response = new Array();
  
  var registeredClass = new Array();
  for (i=0;i&lt;results.length; i++ ) {
      class_schedule = results[i];
      newcls = new Object();
      newcls.Link = class_schedule.LMSURL; // Error at this line.. 
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Error Log :</p>
  
  <pre><code>TID: [0]  [ESB]  [2014-10-24 14:19:45,541] ERROR -  The script engine returned an error executing the external js script : Value {name ='null', keyValue ='conf:/repository/esb/js/functions.js'} function transformPayload {org.apache.synapse.mediators.bsf.ScriptMediator}
  com.sun.phobos.script.util.ExtendedScriptException: org.mozilla.javascript.WrappedException: Wrapped com.sun.phobos.script.util.ExtendedScriptException: org.mozilla.javascript.EvaluatorException: syntax error (&lt;Unknown source&gt;#1) in &lt;Unknown source&gt; at line number 1 (&lt;Unknown source&gt;#53) in &lt;Unknown source&gt; at line number 53
      at com.sun.phobos.script.javascript.RhinoScriptEngine.invokeMethod(RhinoScriptEngine.java:259)
  </code></pre>
  
  <p>Thanks
  Kranthi </p>