I put 3 files in same folder: jquery-1.10.2.js
, info.xml
and info.htm
.
This is my info.xml
:
<Check>
<Metainformation>
<cash>ABC XYZ</cash>
<Doctor>Dr. Peter Smith</Doctor>
<DoctorID>12345678</DoctorID>
<Quartal>Q22004</Quartal>
<Checkdate>20040404123000</Checkdate>
</Metainformation>
<Patientlist>
<Normal_Patient>
<Unchanged count="123" />
<New count="3" />
<Closed count="2" />
<InTest count="4" />
</Normal_Patient>
<Special_Patient>
<Special_Quantity count="8" />
</Special_Patient>
<Notfound_Patient>
<ABC_available count="9" />
<DEF_available count="7" />
</Notfound_Patient>
<Total old="125" new="126"/>
</Patientlist>
</Check>
This is my info.htm
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name="Daniel" content="Geneva">
<script language="JavaScript" type="text/javascript" src="jquery-1.10.2.js"></script>
<style type="text/css">
.frame {
font-size: 10pt;
}
.div1 {
margin-right:80px;
margin-left:80px;
}
.table1 {
width: 640px;
margin: 0 auto;
border-collapse: collapse;
font-weight: bold;
}
.table1 td {
vertical-align: top;
padding-left: 6px;
padding-bottom: 5px;
border: 1px solid black;
width: 320px;
}
.table1 tr:nth-child(2) td {
border: none;
}
</style>
</head>
<body>
<div class ='frame'>
<div class='div1'>
<table class='table1' style ='margin-top:20px'>
<tr>
<td>Contract</td>
<td id="cash"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Doctor</td>
<td id="Doctor"> </td>
</tr>
<tr>
<td>Quartal</td>
<td id="Quartal"> </td>
</tr>
<tr>
<td>Test carried out by</td>
<td id="Doctor1"></td>
</tr>
<tr>
<td>Checkdate</td>
<td id="Date"></td>
</tr>
</table>
</div>
</div>
<script>
var xml = "info.xml";
xmlDoc = $.parseXML(xml);
$xml = $(xmlDoc);
$doctor = $xml.find("Doctor");
$id = $xml.find("DoctorID");
var doc = $doctor.text() + "(ID: " + $id.text() + ")";
$("#Doctor").append(doc);
$("#Doctor1").append(doc);
</script>
</body>
</html>
I need to load Doctor
and DoctorID
from info.xml
and put together into field Doctor
and Doctor1
. But it does not work. Could you guys tell me where I am wrong here?