Options

Reading XML Nodes

LewisTiogaLewisTioga Member Posts: 40
I Have an XML Document and I want to read the first 3 elements of (Line, Location, and component).

In the Example below we have Elements labeled as above but then each recurring element after that has a different prefix and I don't know how you would loop through these specific ones. As you can tell my knowledge on this is very little. I've started with something like this.


CLEAR(xmlDoc);
xmlDoc := xmlDoc.XmlDocument();
xmlDoc.Load('http:///viewPCB.cgi?PCB=02884 BV-00001 BOT');
xmlRoot := xmlDoc.DocumentElement();

xmlNodeListData :=
xmlRoot.SelectNodes('html/body/Table/thead Class="DateTable"/tr/th');

// XML document
hr>
<table>
<thead class="DataTable">
<tr class="DataTable">
<th class="DataTable">Line</th>
<th class="DataTable">Location</th>
<th class="DataTable">Component</th>
<th class="DataTable">Comment</th>
<th class="DataTable">Stock Location</th>
<th class="DataTable">X</th>
<th class="DataTable">Y</th>
<th class="DataTable">Z</th>
<th class="DataTable">Angle</th>
<th class="DataTable">Group</th>
<th class="DataTable">Notes</th>
</tr>
</thead>
<tbody>
<tr class="DataTable">
<th class="DataTable">1</th>
<td class="DataTable">C4</td>
<td class="DataTable">
<a href="http:///viewComponent.cgi?CMP=PN-0000170&quot;&gt;PN-0000170&lt;/a&gt;
</td>
<td class="DataTable">1NF 0402 50V C0G 5%</td>
<td class="DataTable"></td>
<td class="DataTableNumeric">81.318mm</td>
<td class="DataTableNumeric">47.984mm</td>
<td class="DataTableNumeric">0.000mm</td>
<td class="DataTableNumeric">-90°</td>
<td class="DataTable">0</td>
</tr>
<tr class="DataTable">
<th class="DataTable">2</th>
<td class="DataTable">C9</td>
<td class="DataTable">
<a href="http:///viewComponent.cgi?CMP=PN-1007815&quot;&gt;PN-1007815&lt;/a&gt;
</td>
<td class="DataTable">10PF 0402 50V C0G 1%</td>
<td class="DataTable"></td>
<td class="DataTableNumeric">86.116mm</td>
<td class="DataTableNumeric">47.489mm</td>
<td class="DataTableNumeric">0.000mm</td>
<td class="DataTableNumeric">180°</td>
<td class="DataTable">0</td>
</tr>

Answers

Sign In or Register to comment.