dimanche 27 novembre 2016

Can't get list of descendants in XML node?

I have this XML and no matter what I use I'm not able to get a list of the nodes:

<s:LinearGradient rotation="90" xmlns:xlink="http://ift.tt/PGV9lw" xmlns:fx="http://ift.tt/rYUnH9" xmlns:flow="http://ift.tt/1MMzxNZ" xmlns:fc="library://ns.flexcapacitor.com/flex" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex" xmlns:html="http://ift.tt/lH0Osb" xmlns:svg="http://ift.tt/nvqhV5">
  <s:GradientEntry color="0x000000" alpha="0.8"/>
  <s:GradientEntry color="0xFFFFFF" alpha="0.8"/>
</s:LinearGradient>

Here is what I've tried so far:

var fillXML:XML = <s:LinearGradient rotation="90" xmlns:xlink="http://ift.tt/PGV9lw" xmlns:fx="http://ift.tt/rYUnH9" xmlns:flow="http://ift.tt/1MMzxNZ" xmlns:fc="library://ns.flexcapacitor.com/flex" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex" xmlns:html="http://ift.tt/lH0Osb" xmlns:svg="http://ift.tt/nvqhV5">
      <s:GradientEntry color="0x000000" alpha="0.8"/>
      <s:GradientEntry color="0xFFFFFF" alpha="0.8"/>
    </s:LinearGradient>;

var entriesXML:XMLList;
var GRADIENT_ENTRY:String = "GradientEntry";
entriesXML = fillXML..entries;

if (entriesXML.length()==0) {
    entriesXML = fillXML.descendants(GRADIENT_ENTRY);

    if (entriesXML.length()==0) {
        entriesXML = fillXML.elements(GRADIENT_ENTRY);
    }
}

Aucun commentaire:

Enregistrer un commentaire