Hi,
I am newby in Xml
I want to build a table that i can later manipulate in javascript
The Sample.xml contains several Assay with varying number of sample; it looks like that
[HTML]
<Assay AssayType="DNA" AssayNumber="3">
<Sample>
<Destination Position="D2"/>
<Source SourcePlate="P3" SourcePos="A2" sourceConc=2"/>
</Source>
</Sample>
<Sample>
<Destination Position="D12"/>
<Source SourcePlate="P5" SourcePos="C1" sourceConc=3"/>
</Source>
</Sample>
<Sample>
<Destination Position="D5"/>
<Source SourcePlate="P7" SourcePos="B1" sourceConc=1"/>
</Source>
</Sample>
</Assay>
<Assay AssayType="DNA" AssayNumber="5">
<Sample>
<Destination Position="A3"/>
<Source SourcePlate="P4" SourcePos="A9" sourceConc=4"/>
</Source>
</Sample>
<Sample>
<Destination Position="D2"/>
<Source SourcePlate="P5" SourcePos="R1" sourceConc=2"/>
</Source>
</Sample>
</Assay>[/HTML]
I can upload the file
[HTML]<xml
src=" Sample.xml"
id="xmldso"
async="false">
</xml>[/HTML]
I would like to create a table with 2 columns:one for AssayNumber and the second for SourcePlate
[HTML]<table
datasrc="#xmldso"
width="100%"
border="1">
<thead>
<th>AssayNumber</th>
<th>SourcePlate</th>
</thead>
<tr>
<td><span datafld="AssayNum"></span></td>
<td><span datafld="SourceP"></span></td>
</tr>
</table>[/HTML]
But I don't know how to populate
I have tried with
[HTML]function populateTable(){
for (i=0;i<Sample.xml;i++){
var TheDatas=xmldoc.getElementsByTagName('Assay');
var AssayNum=TheDatas[i].getElementsByTagName('AssayNumber')[i].getAttribute('AssayNumber');
alert('AssayNumber='+AssayNum);
var desc=TheDatas[i].getElementsByTagName('AssayNum')[i];
SourceP=desc.getElementsByTagName('Source')[i].getAttribute('SourcePlate');
alert( 'SourcePlate '+ SourceP);
};[/HTML]
Many thanks for your advice and ideas