It seems like a limitation that toXmlString() can't handle default
namespaces or implicitly defined namespaces. For instance, when you
use xml:id, you're using a namespace xml that you don't declare, and
when you're using the default namespace http://example.com that
namespace doesn't have a binding. toXmlString() apparently wants
everything to be explicit, so it makes up bindings for the two
namespaces — aaa and aab — and uses them to explicitly namespace the
id attribute as well as the <root> node. I think the output XML string
is functionally equivalent, but it's clearly not literally equivalent
:(

On 3/22/07, Roger Braunstein <[EMAIL PROTECTED]> wrote:
> Interesting! I didn't know about xml:id. It appears that for
> processors that support it, the xml namespace is bound implicitly to
> http://www.w3.org/XML/1998/namespace, and id is an attribute scoped to
> this namespace.
> AS3 seems to support this. Hurray! Here are some ways you could
> extract the id attribute. This shows how you can use namespaced
> attributes as well.
> trace([EMAIL PROTECTED]); //null
> trace([EMAIL PROTECTED]::id); //wtf
> namespace xml="http://www.w3.org/XML/1998/namespace";;
> trace([EMAIL PROTECTED]::id); //wtf
>
> On 3/22/07, Claus Wahlers <[EMAIL PROTECTED]> wrote:
> >
> > >> var a:XMLList = new XMLList(
> > >>    '<?xml-stylesheet href="my.css" type="text/css"?>' +
> > >>    '<root xmlns="http://example.com/"; xmlns:id="wtf" />');
> > >> var b:XML = a[1];
> > >> trace(b.namespaceDeclarations()); //wtf
> > >> trace(b.namespace()); //http://example.com/
> > >> namespaceDeclarations() gets the namespaces the node defines, and
> > >> namespace() gets the namespace the node is in. You can see that the
> > >> processing instruction has no impact on whether this works.
> > >
> > > Shouldn't b.namespaceDeclarations() also include the default namespace
> > > declaration (xmlns="http://example.com/";), or does that get stripped out
> > > because it's already accessible via b.namespace()?
> >
> > XML.ignoreProcessingInstructions = false;
> > var a:XML = new XML(
> >     '<?xml-stylesheet href="my.css" type="text/css"?>' +
> >     '<root xmlns="http://example.com/"; xml:id="wtf" />');
> > trace(a.namespaceDeclarations());
> >
> > When i use XML, namespaceDeclarations() contains the default
> > declaration. When i use XMLList as in the example above, it doesn't.
> >
> > Cheers,
> > Claus.
> >
> > --
> > claus wahlers
> > côdeazur brasil
> > http://codeazur.com.br/
> > http://wahlers.com.br/claus/blog/
> >
> >
> > --
> > Flexcoders Mailing List
> > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
> > Yahoo! Groups Links
> >
> >
> >
> >
>


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to