Polycom PDS 2000 Car Stereo System User Manual


 
Polycom Digital Signage Administrator Guide Data Source Tutorial
184 Polycom, Inc.
All of the remaining parsing rules in this tutorial are contained in this
DataItem element.
In the HTML we've isolated, each cell of the table row contains the forecast for
a day part. For example, the cell contains the forecast for "Today" (we've
reformatted the code below to make it easier to see the forecast data):
<td width="11%">
<b>Today<br></b>
<br>
<imgsrc="/images/wtf/tsra70.jpg"
width="55" height="58"
alt="Heavy Rain Chance for Measurable Precipitation 70%"
title="Heavy Rain Chance for Measurable Precipitation 70%" >
<br>
Heavy<br>Rain
<br>
Hi <font color="#FF0000">81°F</font>
</td>
Each cell contains the day part's name (e.g. "Today"), the conditions (as the
image's alternative text, e.g. "Heavy Rain Chance for Measurable Precipitation
70%"), the temperature (e.g. "81°F") and an image file (e.g.
"/images/wtf/tsra70.jpg"). We'll extract each of these pieces of information in
turn.
First, we need to isolate a given day part's table cell. We do this using a GetTag
rule to isolate the text between the <td> and </td> tags:
<ParsingRule type="GetTag" Source="Source" result="DaySource">
<StartTag>&lt;td </StartTag>
<EndTag>&lt;/td&gt;</EndTag>
</ParsingRule>
The GetTag rule is index-aware, so because it is inside a <DataItem> element
it will extract each table cell in turn. We used the <DataItem> element to apply
its rules 9 times, so this GetTag rule will extract each of the 9 table cells. On the
first iteration, the rule extracts the contents of the first table cell:
width="11%"><b>Today<br></b><br><img
src="/images/wtf/tsra70.jpg" width="55" height="58" alt="Heavy
Rain Chance for Measurable Precipitation 70%" title="Heavy Rain
Chance for Measurable Precipitation 70%"
><br>Heavy<br>Rain<br>Hi <font color="#FF0000">81°F</font>
On the second iteration, the rule extracts the contents of the second table cell:
width="11%"><b>Tonight<br></b><br><img
src="/images/wtf/ntsra80.jpg" width="55" height="58" alt="Heavy
Rain Chance for Measurable Precipitation 80%" title="Heavy Rain
Chance for Measurable Precipitation 80%"
><br>Heavy<br>Rain<br>Lo <font color="#0033CC">69°F</font>
And so on for each of the 9 iterations.