1 Reply Latest reply on Dec 6, 2007 6:11 PM by ntsiii

    Xquery XML data

    Zolotoj Level 3
      How can I extract parts of my xml data?
      For example:
      <root>
      <states>
      <name>IL></>
      </states>
      <codes>
      <code>3></>
      </code>
      </root>
      I want to extract, lets say states. But I can't use notation like XMLdata.states. I want to use something like this:
      XMLData[varname] where varname is "states"

      Thanks
        • 1. Re: Xquery XML data
          ntsiii Level 3
          Use bracket notation to resolve a string to an object:
          var sNodename:String = "states";
          var xmlStates:XML = XMLData[sNodename][0]; //e4x expessions all return an XMLlist, event if there is only one

          I've used that for attribute strings, and am pretty sure it will work ofr nodes as well.
          Tracy