bonjour
bon j ai un gros probleme de parcours d un fichier xml en javascript
xml file :
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE counties SYSTEM "county.dtd">
<counties>
<aCounty>
<county>All Ireland</county>
<TotalPopulation>5602470</TotalPopulation>
<TotalMale>2767613</TotalMale>
<TotalFemale>2834857</TotalFemale>
<PercPropMale>49,4</PercPropMale>
<PercPropFemale>50,6</PercPropFemale>
<DependencyRatio>0,5</DependencyRatio>
<Pop_0_14>1198380</Pop_0_14>
<Pop_15_24>880108</Pop_15_24>
<Pop_25_44>1669454</Pop_25_44>
<Pop_45_65>1195202</Pop_45_65>
<Pop_65plus>659325</Pop_65plus>
<PercProp_0_14>21</PercProp_0_14>
<PercProp_15_24>16</PercProp_15_24>
<PercProp_25_44>29,8</PercProp_25_44>
<PercProp_45_64>21,33</PercProp_45_64>
<PercProp_65plus>11,77</PercProp_65plus>
<Pop15_16plus>4376985</Pop15_16plus>
<Married>2112496</Married>
<Separated>236261</Separated>
<Single>1740878</Single>
<PercProp_Married>48,26</PercProp_Married>
<Perc_Prop_Separated>5,4</Perc_Prop_Separated>
<Perc_Prop_Single>39,77</Perc_Prop_Single>
<Pop_Catholic>4200017</Pop_Catholic>
<Perc_Prop_Catholic>74,97</Perc_Prop_Catholic>
<Pop_NonCatholic>1139234</Pop_NonCatholic>
<Perc_Prop_NonCatholic>20,33</Perc_Prop_NonCatholic>
<Pop_NoneNotStated>263274</Pop_NoneNotStated>
<Perc_Prop_NoneNotStated>4,7</Perc_Prop_NoneNotStated>
<TotalHHlds>1914683</TotalHHlds>
<OnePersHhlds>449146</OnePersHhlds>
<PP_OnePersHhlds>23,46</PP_OnePersHhlds>
<MarriedCoupleHholds_NoChildren>327306</MarriedCoupleHholds_NoChildren>
<PP_MarriedCoupleHholds_NoChild>17,09</PP_MarriedCoupleHholds_NoChild>
<MarriedCoupleHholds_Children>614501</MarriedCoupleHholds_Children>
<PP_MarriedCoupleHholds_Childre>32,09</PP_MarriedCoupleHholds_Childre>
<CohabitingcoupleHholds_NoChild>56057</CohabitingcoupleHholds_NoChild>
<PP_CohabitingcoupleHholds_NoCh>2,93</PP_CohabitingcoupleHholds_NoCh>
<CohabitingCouple_Children>37087</CohabitingCouple_Children>
<PP_CohabitingCouple_Children>1,94</PP_CohabitingCouple_Children>
<LoneParentHholds_Children>181832</LoneParentHholds_Children>
<PP_LoneParentHholds_Children>9,5</PP_LoneParentHholds_Children>
<AllHholds>1847081</AllHholds>
<Households_OO_NoMortgage>645256</Households_OO_NoMortgage>
<Households_OO_Mortgage>781679</Households_OO_Mortgage>
<Households_OO>1426935</Households_OO>
<HouseholdsRented_LA_NIHE_HCOP>221116</HouseholdsRented_LA_NIHE_HCOP>
<HouseholdsRented_Private>199030</HouseholdsRented_Private>
<Perc_Hholds_OO>77,25</Perc_Hholds_OO>
<Perc_Hholds_Rented_LA>11,97</Perc_Hholds_Rented_LA>
<Perc_Hholds_Rented_P>10,78</Perc_Hholds_Rented_P>
<TotalHholds>1914732</TotalHholds>
<PrivateHhold_House_orBungalow>1717159</PrivateHhold_House_orBungalow>
<Private_Hhold_Flat_Apartment_M>160793</Private_Hhold_Flat_Apartment_M>
<PrivateHhold_Mobile_TemporaryS>10096</PrivateHhold_Mobile_TemporaryS>
<PP_PrivateHhold_House_orBungal>89,68</PP_PrivateHhold_House_orBungal>
<PP_Private_Hhold_Flat_Apartmen>8,4</PP_Private_Hhold_Flat_Apartmen>
<PP_PrivateHhold_Mobile_Tempora>0,53</PP_PrivateHhold_Mobile_Tempora>
<Pop_15plus_16plus>3809537</Pop_15plus_16plus>
<SecondLeveletc>1794823</SecondLeveletc>
<ThirdLeveletc>834348</ThirdLeveletc>
<Perc_Second>47,11</Perc_Second>
<Perc_Third>21,9</Perc_Third>
<Total15plus_16plus>4276854</Total15plus_16plus>
<Employed>2303591</Employed>
<PercProp_Employed>53,86</PercProp_Employed>
<Unemployed>208444</Unemployed>
<PercProp_Unemployed>4,87</PercProp_Unemployed>
<Student>446429</Student>
<PercProp_Student>10,44</PercProp_Student>
<Retired>463568</Retired>
<PercProp_Retired>10,84</PercProp_Retired>
<LookingafterHome>527193</LookingafterHome>
<PercProp_Lookingafterhome>12,33</PercProp_Lookingafterhome>
<Unable_work_disabled>241042</Unable_work_disabled>
<PercProp_Unable_work_disabled>5,64</PercProp_Unable_work_disabled>
<AtWork15plus_16plus>2328215</AtWork15plus_16plus>
<Agriculture_Hunting_Forestry_F>118015</Agriculture_Hunting_Forestry_F>
<PercProp_AHFF>5,07</PercProp_AHFF>
<Building_Construction>211022</Building_Construction>
<PercProp_Building_Construction>9,06</PercProp_Building_Construction>
<ManufacturingIndustries>366911</ManufacturingIndustries>
<PercProp_ManufacturingIndustri>15,76</PercProp_ManufacturingIndustri>
<Commerce>630061</Commerce>
<PercProp_Commerce>27,06</PercProp_Commerce>
<Transport>134061</Transport>
<PercProp_Transport>5,76</PercProp_Transport>
<PublicAdministration>158771</PublicAdministration>
<PercProp_PublicAdministration>6,82</PercProp_PublicAdministration>
<ProfessionalServices>400813</ProfessionalServices>
<PercProp_ProfessionalServices>17,22</PercProp_ProfessionalServices>
<Other>308561</Other>
<PercProp_Other>13,25 </PercProp_Other>
</aCounty>
</counties>
et le javascript qui bug
<script type="text/javascript">
<![CDATA[
// load xml file
function loadXMLFile()
{
if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange = function () {
if (xmlDoc.readyState == 4) createTable()
};
}
else if (document.implementation && document.implementation.createDocument)
{
xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.onload = createTable;
}
else
{
alert('Your browser can\'t handle this script');
return;
}
xmlDoc.load("../data/county.xml");
}
function createTable()
{
var x = xmlDoc.getElementsByTagName('aCounty');
alert(x.length); // display 1 =OK
alert(x[0].childNodes.length); // display 189 = NOT OK
alert(x[0].childNodes); // display object node list --> je pense que c est correct
alert(x[0].childNodes[0]); // display object text --> cela doit correspondre a <aCounty>
alert(x[0].childNodes[0].nodeValue); // display nothing (viewbox with nothing inside)
alert(x[0].childNodes[0].nodeValue.length); // display 9 = ?
alert(x[0].childNodes[0].length); // display 9 = ?
}
// display information about county
var count = 0;
function displayInformation(evt){
loadXMLFile();
svgDocument = evt.target.ownerDocument;
var text = svgDocument.getElementById("percent").firstChild;
text.data = ++count;
}
// ]]>
</script>
le probleme viendrait de la navigation (bon j ai un probleme avec ie aussi mais tant pis je verrais cela plus tard)
j ai mis des alert un peu partout pour comprendre mais les resultats qu il me sort ne correspondent vraiment a rien du tout.
si quelqu un pouvait m aider je bosse dessus depuis hier et je bloque totalement
merci d avance :hello: Configuration: Windows 2000
Internet Explorer 6.0

