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

Reply via email to