6 Replies Latest reply on Jul 11, 2007 11:55 AM by ntsiii

    Accessing XML elements using E4X

    flashgruven
      A Webservice is returning an XMLList in E4X format having set the resultFormat. I can get at the elements using children()[x] notation however I can’t access the elements using dot notation.

      I'm finding that:

      event.result.children()[0].children()1 works

      but not

      event.result.WineList.name

      Here is what the XML looks like (abbreviated):

      <?xml version="1.0" encoding="utf-8"?>
      <WineList xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns=" http://www.xyzzy.com/">
      <id>43888830-7dff-4ac0-a5a6-59efa12c0c6f</id>
      <name>French</name>
      <isAvailable>true</isAvailable>
      <displayOrder>1</displayOrder>
      <wineCategories>
      <WineCategory>
      <id>0c8aa898-58fc-43e7-baf7-a84ba38ef436</id>
      <name>Half-Bottle</name>
      <isAvailable>true</isAvailable>
      <displayOrder>0</displayOrder>
      <wineTypes>
      <WineType>
      <id>691d8316-4d60-4702-a8b3-c921c89dd3a0</id>
      <name>White</name>
      <isAvailable>true</isAvailable>
      <displayOrder>0</displayOrder>
      <regions />
      <aWines>
      <AWine>
      <id>4373663b-b649-4be5-8ebf-7339340d45ca</id>
      <name>Ramey, Chardonnay, Carneros 2002</name>
      <bottleSize />
      <price>45</price>
      <bin>713A</bin>
      </AWine>
      --etc.

      The XML is returned from an ASP.NET web service.

      What is the trick to get dot notation to work?

      TIA,
      George