Problem to create HTML table from XML file using javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bogey
    New Member
    • Jan 2007
    • 8

    #1

    Problem to create HTML table from XML file using javascript

    Hi,
    I am a complet newby in XML; I just want to create a table for datas coming from XML file
    [HTML] <Study StudyNumber="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>
    </Study>[/HTML]


    I have found some script for data organized like
    [HTML]<Study>
    <StudyNumber> 3</StudyNumber>
    <Sample>
    <Destination>po sition D2</Destination>
    <Source>
    <SourcePlate>P3 </SourcePlate>
    <Source Pos>A2</SourcePos>
    <SourceConc>B 1</SourceConc>
    </Source>
    </Sample>
    </Study>[/HTML]
    I would like to have at the end a table containing all SourcePlate;Sou rcePos and SourcePos
    I have the script to load the file
    [HTML]<html>
    <body>
    <xml
    src=" sample2.xml"
    id="xmldso"
    async="false">
    </xml>[/HTML]
    But I dont know how to populate the table
    [HTML]<table
    datasrc="#xmlds o"
    width="100%"
    border="1">

    <thead>
    <th>SourcePlate </th>
    <th>SourcePos </th>
    <th>sourceCon c</th>
    </thead>

    </body>
    </html>[/HTML]
    I would really appreciated any advice or idea
Working...