2 Replies Latest reply on Oct 25, 2007 8:17 PM by ntsiii

    Reserved Word in Data Provider

    NigelGo
      I'm using a httpService to pull back some XML to be used in a dataProvider. However the returned XML (see below) uses '<interface-response>' as it's root node. This causes a problem when defining the dataProvider (see below) as the word 'interface' is reserved. I've no way of changing the XML that is returned, is there way around this problem?

      // DataGrid with dataProvider definition
      <mx:DataGrid id="dg" dataProvider="{resultsService.lastResult.interface-response}">

      // example of returned XML
      <interface-response>
      <DomainName>pullingmyhairout.com</DomainName>
      <RRPCode>210</RRPCode>
      <RRPText>Domain available</RRPText>
      <AuctionDate/>
      <AuctionID/>
      <Command>CHECK</Command>
      <Language>eng</Language>
      <ErrCount>0</ErrCount>
      <ResponseCount>0</ResponseCount>
      <MinPeriod>1</MinPeriod>
      <MaxPeriod>10</MaxPeriod>
      <Server>RESELLERTEST</Server>
      <Site>eNom</Site>
      <IsLockable>True</IsLockable>
      <IsRealTimeTLD>True</IsRealTimeTLD>
      <TimeDifference>+08.00</TimeDifference>
      <ExecTime>0.734</ExecTime>
      <Done>true</Done>
      <debug></debug>
      </interface-response>
        • 1. Re: Reserved Word in Data Provider
          mae@ccg Level 1
          Instead of doing .lastResult, you could try using a result handler function which

          1. edits the xml response as a string and changes the <interface-response> elements
          2. takes the edited xml and sets it as the data provider for the grid.

          I'm doing something similar to remove a T from some datetime strings.

          someone else mentioned recently that it's better to get out of the habit of using lastResult...
          • 2. Re: Reserved Word in Data Provider
            ntsiii Level 3
            First, I fully agree with the responder. Do not bind directly to lastResult. there are so many reasons, just don't do it.

            Now to solve the reserved word issue, you can use bracket notation:
            dataProvider="{resultsService.lastResult.["interface-response']}

            Tracy