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 > > > >