Thanks for that.

So: It looks like all items in xml get the parent namespaces associated with 
them as XML objects, but the namespaces are not written when using 
toXMLString().

Transferring an element with a namespace to another xml element loses the 
prefix and has an un-prefixed namespace applied to it.
If the uri exists in the new element with a prefix, the element takes on the 
prefix of the new element.


On Jan 11, 2016, at 5:21 AM, Andy Dufilie <andy.dufi...@gmail.com> wrote:

> On Sun, Jan 10, 2016 at 4:53 PM, Harbs <harbs.li...@gmail.com> wrote:
> 
>> I’m trying to figure out namespace behavior.
>> 
>> I’m probably tired, but can someone tell me why the  “catalog_item” var in
>> this test (on line 70) does not get any results?
>> 
>> https://gist.github.com/Harbs/c24285b3af80eeed251d
>> 
> 
> 
> I put your code in an .as file instead of an .mxml, and it won't compile
> because of this line:
> 
> var catalog_item = xml..fx::catalog_item[0];
> 1120: Access of undefined property fx.
> 
> I think it's only a warning in MXML ("*possibly* undefined property")
> because you've defined the fx namespace in the mxml tag at the top of the
> file. To fix it, you either need to add the following to your code inside
> CDATA:
> 
> namespace fx = 'http://ns.adobe.com/mxml/2009';
> 
> or use one of these forms:
> 
> var catalog_item = xml..('http://ns.adobe.com/mxml/2009')::catalog_item[0];
> var catalog_item = xml.descendants(new QName('http://ns.adobe.com/mxml/2009',
> 'catalog_item'))[0];

Reply via email to