canaille
01-31-2007, 09:31 AM
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
<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>
can upload the file
<xml
src=" Sample.xml"
id="xmldso"
async="false">
</xml>
I would like to create a table with 2 columns for AssayNumber and the second for SourcePlate
<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>
But I don't know how to populate
I have tried with
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);
};
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
<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>
can upload the file
<xml
src=" Sample.xml"
id="xmldso"
async="false">
</xml>
I would like to create a table with 2 columns for AssayNumber and the second for SourcePlate
<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>
But I don't know how to populate
I have tried with
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);
};
Many thanks for your advice and ideas