Manipulating XML

wxdqz

New Member
Hi,

I have the following XML. I am trying to alter it so the I copy some of the nodes contents and add it to other nodes if they are empty. I am getting stuck at the first hurdle because the XML is not getting loaded properly. It seems to load the XML up until one of the nodes is empty, then it gets stuck.

Is the following valid XML (see below script) and is it ok to load using. Also if it is not does anyone know how I can do this - copy the content from the first set of description nodes to the description nodes further down with the translation nodes. Any help muchnb appreciated, thanks!

<script language="javascript" type="text/javascript">
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.load("note.xml");

// documentElement always represents the root node
var x=xmlDoc.documentElement;

for (i=0;i<x.childNodes.length;i++)
{
document.write(x.childNodes.nodeName);
document.write("=");
document.write(x.childNodes.childNodes[0].nodeValue);
document.write("<br />");
}
</script>




<?xml version="1.0" encoding="utf-16"?>
<!--start 2006-10-09T14:53:32+02:00-->
<translations language="ET" country="EE">
<items type="car">
<item id="345aa894-9e5a-41ea-b76b-9d3b146a9e4e">
<name>
GS 300
</name>
<tooltip>
GS 300
</tooltip>
<description>
GS 300. 3.0 litre V6 VVT-i petrol, 6 speed automatic
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="e518c947-f9f9-4eb5-90be-466e10de17c3">
<name>
GS 430
</name>
<tooltip>
GS 430
</tooltip>
<description>
GS 430. 4.3 litre V8 VVT-i petrol, 6 speed automatic
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="7b3682a0-e015-4729-9332-357ff17b82dc">
<name>
GS 450h
</name>
<tooltip />
<description>
GS 450h. 3.5 litre V6 VVT-i petrol with electric motors hybrid, E-CVT
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="ddaa090e-3469-4749-8422-c5a83cd56e22">
<name>
IS 220d
</name>
<tooltip>
IS 220d
</tooltip>
<description>
IS 220d. 2.2 litre 4 cylinder direct injection diesel, 6 speed manual
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="7aec1ed6-5836-4d87-8d7b-b3c3d24810cb">
<name>
IS 220d LUXURY
</name>
<tooltip>
IS 220d LUXURY
</tooltip>
<description>
IS 220d. 2.2 litre 4 cylinder direct injection diesel, 6 speed manual, Luxury
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="d6beb39e-40a9-410a-9448-71fc776d7a90">
<name>
IS 220d SPORT
</name>
<tooltip>
IS 220d SPORT
</tooltip>
<description>
IS 220d. 2.2 litre 4 cylinder direct injection diesel, 6 speed manual, Sport
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="96b39dd0-7514-4cae-920e-9a7a25bf2870">
<name>
IS 250
</name>
<tooltip>
IS 250 Manual
</tooltip>
<description>
IS 250. 2.5 litre V6 VVT-i petrol, 6 speed manual
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="53e36540-75be-4eaa-9436-113cd134eecf">
<name>
IS 250 AUTOMATIC
</name>
<tooltip />
<description>
IS 250. 2.5 litre V6 VVT-i petrol, 6 speed automatic
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="7914286b-9b1f-4937-8f79-e9c9e0348ba9">
<name>
IS 250 LUXURY
</name>
<tooltip>
IS 250 LUXURY
</tooltip>
<description>
IS 250. 2.5 litre V6 VVT-i petrol, 6 speed manual, Luxury
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="2f03cb9e-b3ac-4454-b067-b1455d6ee44d">
<name>
IS 250 LUXURY AUTOMATIC
</name>
<tooltip>
IS 250 LUXURY AUTOMATIC
</tooltip>
<description>
IS 250. 2.5 litre V6 VVT-i petrol, 6 speed automatic, Luxury
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="19e9973a-9b9f-477a-8cf8-460e29349216">
<name>
IS 250 SPORT
</name>
<tooltip>
IS 250 SPORT
</tooltip>
<description>
IS 250. 2.5 litre V6 VVT-i petrol, 6 speed manual, Sport
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="fc330719-1847-4b3d-b1b7-be65b0e0c445">
<name>
IS 250 SPORT AUTOMATIC
</name>
<tooltip>
IS 250 SPORT AUTOMATIC
</tooltip>
<description>
IS 250. 2.5 litre V6 VVT-i petrol, 6 speed automatic, Sport
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="c745d699-e2df-4536-ba0f-e8597a276c19">
<name>
LS 430
</name>
<tooltip>
LS 430
</tooltip>
<description>
LS 430. 4.3 litre V8 VVT-i petrol, 6 speed automatic
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="e3476034-48ce-4d51-9bd3-3b00991657e2">
<name>
LS 460
</name>
<tooltip>
LS 460
</tooltip>
<description>
LS 460 4.6 litre V8 VVT-iE petrol, 8 speed automatic
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="bc2c670b-05dd-4b22-a115-f3e801c05448">
<name>
LX470
</name>
<tooltip />
<description />
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="6d97e45d-8ca0-467c-9744-51b233b0fa54">
<name>
LX470 LHD
</name>
<tooltip />
<description />
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="7c0d07ab-e0a4-4b5c-b86e-4f73612ff903">
<name>
RX 350
</name>
<tooltip />
<description>
RX 350. 3.5 litre V6 VVT-i petrol, 5 speed automatic
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="0fe54471-a8f8-4fb0-95c8-dca2c3e4e5a0">
<name>
RX 400h
</name>
<tooltip>
RX 400h
</tooltip>
<description>
RX 400h. 3.3 litre V6 VVT-i petrol with electric motors hybrid, E-CVT
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
<item id="78765001-ac1c-4af7-94df-a81b115b5a2f">
<name>
SC 430
</name>
<tooltip>
SC 430
</tooltip>
<description>
SC 430. 4.3 litre V8 VVT-i petrol, 6 speed automatic
</description>
<footnote />
<translation>
<name />
<tooltip />
<description />
<footnote />
</translation>
</item>
</items>
</translations>
<!--end 2006-10-09T14:53:45+02:00-->
 
Back
Top