XML : Javascript/jQuery create a two-way HTML table from XML

I've an XML file which look like this :

  <TcPropertyConstantAttach constantName="ComplexProperty" typeName="AE5_CorrespExt" propertyName="ae5_codif2" value="$ae5_origin_project+&quot;-&quot;+$ae5_issue_entity+&quot;-&quot;+$item_id+&quot;-&quot;+$ae5_recipient_entity"/>  <TcPropertyConstantAttach constantName="ComplexProperty" typeName="AE5_CorrespExt"     propertyName="ae5_codif_ds" value="$ae5_origin_project+$item_id"/>  <TcPropertyConstantAttach constantName="Enabled" typeName="AE5_GenDoc" propertyName="ae5_codif2"         value="true"/>    

What matters here are the constantName, the propertyName and the value.

I want to show this in an HTML table with the propertyName as row identifier and the constantName as column identifier. The result of the matching must be the value field. I don't know how many constantName or propertyName I have.

With the 3 lines of my example I must have something like :

  <table border=1>    <tr>      <th>Attribute Name</th>      <th>ComplexProperty</th>      <th>Enabled</th>    </tr>    <tr>      <td>ae5_codif2</td>      <td>$ae5_origin_project+&quot;-&quot;+$ae5_issue_entity+&quot;-&quot;+$item_id+&quot;-&quot;+$ae5_recipient_entity</td>      <td>true</td>    </tr>    <tr>      <td>ae5_codif_ds</td>      <td>$ae5_origin_project+$item_id</td>      <td></td>    </tr>  </table>  

I can't figure how to do this using javascript/jQuery.

I tried putting constant names into an array to create the header but then I don't know how to fill my table.

No comments:

Post a Comment