Reputation: 6635
I have an ugly druple-gardens RSS feed coming into flash and I'm using the same idea as this link. http://www.eccesignum.org/blog/accessing-views-from-flash-in-drupal-gardens to parse it into a new xml structure.
flash code:
var str = item.description;
var newString = str.split("<").join("<").split(">").join(">").split(""`").join("\"").split(" ").join(" ");
var description = new XML('<description>'+ newString + '</description>');
trace("myXML = "+description[0]);
I'm trying to see how I can get to each element by names. Here is the first description node. traced out description xml.
<description>
<div class="field field-name-field-hometown field-type-text field-label-above">
<div class="field-label">Home Town:</div>
<div class="field-items">
<div class="field-item even">Bemidji, Minnesota (up near where they filmed Fargo)</div>
</div>
</div>
<div class="field field-name-field-school field-type-text field-label-above">
<div class="field-label">School:</div>
<div class="field-items">
<div class="field-item even">UCONN Undergrad / Columbia MBA</div>
</div>
</div>
<div class="field field-name-field-lives field-type-text field-label-above">
<div class="field-label">Currently Live:</div>
<div class="field-items">
<div class="field-item even">Milford, CT</div>
</div>
</div>
<div class="field field-name-field-relationship field-type-text field-label-above">
<div class="field-label">relationship status:</div>
<div class="field-items">
<div class="field-item even">Married with two boys</div>
</div>
</div>
<div class="field field-name-field-tidbit field-type-text-long field-label-above">
<div class="field-label">tidbit:</div>
<div class="field-items">
<div class="field-item even">I’m an avid UCONN fan, a Green Bay Packers shareholder and I golf whenever I get the chance.</div>
</div>
</div>
<div class="field field-name-field-favorite-memory field-type-text-long field-label-above">
<div class="field-label">Favorite Memory:</div>
<div class="field-items">
<div class="field-item even">beating Worthington in the Ping Pong Tournament</div>
</div>
</div>
</description>
I have tried to get to field-label with no luck. Example:
description.div.field-label and the value of the field items
Anyone have any idea how I can get to the elements using the names in the above xml.
Upvotes: 0
Views: 399
Reputation: 6961
Have you tried
var list:XMLList =yourXML.descendents('div').(attribute('class')=='field-label');
for each var (node:XML in list) {
trace(node.text());
}
?
Upvotes: 1