Does ExtendScript Support E4X QNames?
I am in the middle of converting my ActionScript extensions to JavaScript, in anticipation of the move to HTML5 extensions.
I made extensive use of XML Namespaces and QNames in ActionScript, with no problem.
I am now finding that ExtendScript does not fully support QNames. Only the method XML.descendants() seems to support QNames. The XML.elements(), XML.child() and XML.children() do not.
For example, the following code returns 2, as expected:
function main()
{
var qName = new QName ('ns','Son');
var xml = <Father name="Michael" xmlns="ns"><Son name="John"/><Son name="Tom"/></Father>;
var sons = xml.descendants(qName);
return sons.length();
}
However both of the following examples return 0. According to the ECMA spec and de facto ActionScript behavior, I should have gotten 2 for these examples, too.
function main()
{
var qName= new QName ('ns','Son');
var xml = <Father name="Michael" xmlns="ns"><Son name="John"/><Son name="Tom"/></Father>;
var sons = xml.children(qName);
return sons.length();
}
function main()
{
var qName= new QName ('ns','Son');
var xml = <Father name="Michael" xmlns="ns"><Son name="John"/><Son name="Tom"/></Father>;
var sons = xml.elements(qName);
return sons.length();
}
This is a major problem for me, as I only want the immediate child nodes of the current XML, and not n generations.
All help much appreciated.
Best regards for a Happy New Year!
mlavie