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="#xmlds o"
width="100%"
border="1">
<thead>
<th>AssayNumber </th>
<th>SourcePlate </th>
</thead>
<tr>
<td><span datafld="AssayN um"></span></td>
<td><span datafld="Source P"></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.x ml;i++){
var TheDatas=xmldoc .getElementsByT agName('Assay') ;
var AssayNum=TheDat as[i].getElementsByT agName('AssayNu mber')[i].getAttribute(' AssayNumber');
alert('AssayNum ber='+AssayNum) ;
var desc=TheDatas[i].getElementsByT agName('AssayNu m')[i];
SourceP=desc.ge tElementsByTagN ame('Source')[i].getAttribute(' SourcePlate');
alert( 'SourcePlate '+ SourceP);
};[/HTML]
Many thanks for your advice and ideas
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="#xmlds o"
width="100%"
border="1">
<thead>
<th>AssayNumber </th>
<th>SourcePlate </th>
</thead>
<tr>
<td><span datafld="AssayN um"></span></td>
<td><span datafld="Source P"></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.x ml;i++){
var TheDatas=xmldoc .getElementsByT agName('Assay') ;
var AssayNum=TheDat as[i].getElementsByT agName('AssayNu mber')[i].getAttribute(' AssayNumber');
alert('AssayNum ber='+AssayNum) ;
var desc=TheDatas[i].getElementsByT agName('AssayNu m')[i];
SourceP=desc.ge tElementsByTagN ame('Source')[i].getAttribute(' SourcePlate');
alert( 'SourcePlate '+ SourceP);
};[/HTML]
Many thanks for your advice and ideas
Comment