Reading XML Nodes

LewisTioga
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">PN-0000170</a>
</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">PN-1007815</a>
</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>
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">PN-0000170</a>
</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">PN-1007815</a>
</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>
0
Answers
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions