You are a legend, thanks so much!
On 26/09/2007, at 11:27 , Seth Caldwell wrote:
Oh my god Toby, I just spent an hour because I was determined to
learn about namespaces, and found a solution for you. =)
After reading http://www.partlyhuman.com/blog/roger/using-e4x-with-
xhtml-watch-your-namespaces
I created blah.xml
<test xmlns:b="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><a
b:c="d">bleh</a><a b:c="e">blah</a></test>
Then loaded it with <mx:XML source="blah.xml" id="tx"
format="e4x" />
Then ran this:
mx.controls.Alert.show("value is: "+tx.a.(attributes()[0]=="d"));
which alerted “value is: bleh”.
We could also do this:
mx.controls.Alert.show("value is: " +tx.a.(@*::c=="d"));
Oh my god, right? So I put your original XML into blah.xml, then
did this:
mx.controls.Alert.show("value is: "+tx.*::Status.*::presence.
(@*::lang=="en"));
Guess what?! “value is: Away”!!
We win.
Change this code
for (i=0; i < event.result.RDF.Status.presence.length; i++) {
if(event.result.RDF.Status.presence[i]["xml:lang"] == "en")
if(event.result.RDF.Status.presence[i]["value"] != "Offline")
status = "Online";
to this code
if(event.result.RDF.*::Status.*::presence.(@*::lang==”en”)
==”Offline”) status = “Online”;
wewt,
Seth
-----------------------------------
Life is poetry, write it in your own words
-----------------------------------
Toby Tremayne
IT Director
Code Poet and Zen Master of the Heavy Sleep
Codename:Tuesday
02 8012 0953
0416 048 090
ICQ: 13107913