0

I have an XML document and I would like to get a list of all the attributes of a given name including descendent nodes. In this case I need to get all attributes whose name is "ISBN".

Here is my XML:

   <order> 
        <book ISBN="0942407296"> 
            <title>Baking Extravagant Pastries with Kumquats</title> 
            <author> 
                <lastName>Contino</lastName> 
                <firstName>Chuck</firstName> 
            </author> 
            <pageCount>238</pageCount> 
            <parent ISBN="094240235"> 
        </book> 
        <book ISBN="0865436401"> 
            <title>Emu Care and Breeding</title> 
            <editor> 
                <lastName>Case</lastName> 
                <firstName>Justin</firstName> 
            </editor> 
            <pageCount>115</pageCount> 
            <parent ISBN="202394245"> 
        </book> 
    </order>

Here is what I want but I don't know how to write it:

var list:XMLList = xml..@attribute=="ISBN";
trace(list[0]); // 0942407296
1.21 gigawatts
  • 16,517
  • 32
  • 123
  • 231

1 Answers1

1

I was close. Using the two dots for descendents selector "..", the at symbol, "@" and then the name of the attribute, "ISBN" I was able to get a list of all the values:

var list:XMLList = myXML..@ISBN;
1.21 gigawatts
  • 16,517
  • 32
  • 123
  • 231