Get Namepaces and find uri of prefix
Problem:
- You have an XML with a lot of namespaces
- you need to create namespace Objects for a prefix
- the namespace uri could change in different environements
Solution
- Get all Namespaces:
var namespaces : Array = _xformsData.namespaceDeclarations();
- Loop them and search for the prefix and save the namespace:
var ns:Namespace;
var i:int = namespaces.length;
while(i--){
if(namespaces[i].prefix == 'xforms'){
ns = new Namespace(namespaces[i].prefix,namespaces[i].uri);
break;
}
}
No comments:
Post a Comment