When using the new XML object in ActionScript 3 and parsing the data with E4X, if your XML data has a “xmlns” attribute- you may have a difficult time getting any accessible data out of it. The infuriating thing is that the process will fail silently without throwing any errors, returning null, undefined, or anything else…
The way around this is to explicitly let Flash know what namespace you are intending to use:
namespace xspf = "http://xspf.org/ns/0/";
use namespace xspf;
In this case, I am importing XSPF playlist data for an audio project.
I wonder….
can the namespace be interrogated dynamically instead? It’s not often that the namespace would change (and if it does it usually heralds other changes that would break your app anyway…)
… just curious
thanx
It would be nice… I haven’t found a way.
How about this?
default xml namespace = myXML.namespace();
While I can trace out the xmlns using xml.namespace(), it seems to be problematic when trying to apply that result as a default namespace.
I’ve tried a lot of different things so far and nothing seems to be able to handle this exactly as I’d like.
You saved my day mate! Absolute niceness!