How do I know when I encounter a node with a namespace and when I do is it possible to extract that name and URL of that namespace?
XML:
<s:Image xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:test="library://ns.test.com/flex/"
visible="false"
test:locked="true" />
XML parsing code:
public static function getAttributeNames(node:XML):Array {
var result:Array = [];
var attributeName:String;
for each (var attribute:XML in node.attributes()) {
attributeName = attribute.name().toString();
result.push(attributeName);
}
return result;
}
trace (result);
[0] visible
[1] library://ns.test.com/flex/::locked
I could do a check for "::" in the string but that seems cumbersome. There must be a better way.