have a go at http://www.darronschall.com/weblog/archives/000223.cfm too.
DK On 9/26/07, Paul deCoursey <[EMAIL PROTECTED]> wrote: > > I have been getting caught up with with one for a few weeks now, I keep > forgetting to specify the namespace. I actually think this is a bug, > but I haven't checked the Ecma requirements yet. In XPATH and the like > if you don't specify a namespace in the query it will return all > elements regardless of namespace. This only seems to be an issue in the > ecma world, and it seems wrong to me. I suppose it could be argued that > this helps us be better programmers and specifying namespaces is better > in the long run. But in the example that you guys were working with it > was the xml namespace, that should just be handled... just my opinion, > but a lot of time was wasted on this and in my opinion it's a bug, > possibly a language level "bug". > > Paul > > > 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 > > > > > > > > > -- Douglas Knudsen http://www.cubicleman.com this is my signature, like it?

