Today I worked a lot with XML and namespaces, I have to add nodes and so on. And stumbled into problems regarding namespaces.After some struggles I found the solution.
Because of the namespaces things don't work when copy pasting from the documentation from AS3.
For example defining a node like this:
var data:XML = <sa:photos>
<sa:photo src="left.jpg"/>
<sa:photo src="right.jpg"/>
</sa:photos>
The compiler throws the following error: The prefix "sa" for element "sa:photos" is not bound.
You have to define it like:
var data:XML = <sa:photos xmlns:sa="uri of namespace">
<sa:photo src="left.jpg"/>
<sa:photo src="right.jpg"/>
</sa:photos> Maybe this sounds logical now but the documentation is not so clear about this.
When added a node to this object you could do it like:
var x:XML = <sa:photo src="filename" />
data.appendChild(x); But the same error is thrown, you have to do it like:
var x:XML = <sa:photo src="filename" xmlns:sa="uri of namespace" />
data.appendChild(x);

