3 Replies Latest reply on Jul 16, 2007 9:29 AM by ntsiii

    How to use string variabel in xml parse call ?

    MaxMuld
      Hi you can find many samples on the net how to search for specifik xml nodes. So for instance you can find a node in the xml structure below here by using this statement where you find a book with ISBN=1590595181:

      myBooks.book.(@ISBN=="1590595181")

      This is very smart but is it possible somehow to use a variabel string instead of a hardcoded string "1590595181". For instance i tried:

      var str:String = "1590595181";
      trace(myBooks.book.(@ISBN=={str}))

      where i use {} around the variabel, but it doesn't work. Is it possible to use such a variabel somehow?


      private var myBooks:XML =
      <books>

      <book ISBN="1590595181">
      <title>Foundation ActionScript Animation: Making Things Move</title>
      <author>Keith Peters</author>

      <amazonUrl> http://tinyurl.com/npuxt</amazonUrl>
      <pageCount>470</pageCount>
      </book>

      <book ISBN="1582346194">
      <title>Send in the Idiots: Stories from the Other Side of Autism</title>

      <author>Kamran Nazeer</author>
      <amazonUrl> http://tinyurl.com/lo5ts</amazonUrl>
      <pageCount>500</pageCount>

      </book>
      </books>