incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Duane Nickull <>
Subject Re: Flex and names spaces in MXML
Date Wed, 14 Mar 2012 21:44:52 GMT

On 12-03-14 1:54 PM, "David Francis Buhler" <> wrote:

>Omitting the xmlns attributes in MXML would make MXML valid XML, it
>just wouldn't prevent namespace collisions (because there is no
>namespace prefix).

Correct.  XML NameSpaces are perhaps one of the most misunderstood
mechanisms on the planet.  You can have perfectly legal XML like this:

<!--I am not typing the XML PI every time to demonstrate-->


But if you have a large schema and there are different elements with the
same name, a parser's handler will not know how to differentiate the two.

 <bar>This bar is meant for a widget</bar>
     <bar>This is some other bar</bar>

Because the designers of MXML wanted to allow developers to build custom
components, the namespaces are considered a mandatory piece of the MXML to
avoid collisions (elements in different classes with the same name) in the
event those building custom components accidentally used names used by
MXML (this still throws the odd error WRT the SDK and named methods like

Consider an XML fragment like this:

<?xml version="1.0"?>
<document xmlns:foo="" >
<!--If you do a "getNamespace()" on the following element, it will
return the value of ""-->
<foo:name>Duane Nickull</foo:name>
<InnerElement xmlns:foo=""><name/>
<!-- if you do the same "getNamespace()" operation on the next
line, the value will be>
<foo:name>Duane Nickull</foo:name>

Parsers always resort to the inner most lexically
scoped namespace.  In any event, you would need a conflict of both the
namespace itself AND the namespace value before any harm was done.

I vote to leave MXML as it is from an XML namespace standpoint.

I would suggest one minor fix ->  CDATA declarations for anything like CSS
styles that have even the remote possibility of having XML illegal
characters in them one day.



View raw message