6 Replies Latest reply on Jul 7, 2006 4:55 PM by djsodom

    App broke over night (XML not parsing)

    djsodom
      I had a nicely working app that used an external xml file as its data source. I woke up early this morning excited to be able to move on and add simple functionality to my app. But it when I reopened and compiled it, it had stopped parsing the xml. Thinking I might have typed in something by mistake, I went to a back up version I knew worked (I had saved it with a _working prefix). That one no longer parsed either.

      After a couple of hours of troubleshooting, I thought let me try a simple HTTPService example. I found the below code as an example to see if it would work. And it doesn't work either.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="vertical"
      initialize="myService.send()">

      <mx:Script>
      <![CDATA[
      import mx.collections.ArrayCollection;
      import mx.rpc.events.ResultEvent;

      [Bindable]
      private var myData:ArrayCollection;

      private function resultHandler(event:ResultEvent):void {
      myData = event.result.titles.title;
      }
      ]]>
      </mx:Script>

      <mx:HTTPService id="myService"
      url="data/videoTitles.xml"
      result="resultHandler(event)"/>

      <mx:DataGrid dataProvider="{myData}"/>

      </mx:Application>

      Here is my xml file (in a data subdirectory)
      <?xml version="1.0"?><?xml version="1.0"?>
      <titles>
      <title>
      <className>Flash User Experience Best Practices</className>
      <duration>4.25</duration>
      </title>
      <title>
      <className>Flash Professional 8 New Features</className>
      <duration>1.0</duration>
      </title>
      <title>
      <className>Flash Professional 8 Essential Training</className>
      <duration>11.5</duration>
      </title>
      <title>
      <className>Flash Professional 8 Beyond the Basics</className>
      <duration>10</duration>
      </title>
      <title>
      <className>Flash Professional 8 Video Integration</className>
      <duration>7.25</duration>
      </title>
      <title>
      <className>Photoshop CS2 and Flash 8 Integration</className>
      <duration>2.5</duration>
      </title>
      </titles>
      <titles>
      <title>
      <className>Flash User Experience Best Practices</className>
      <duration>4.25</duration>
      </title>
      <title>
      <className>Flash Professional 8 New Features</className>
      <duration>1.0</duration>
      </title>
      <title>
      <className>Flash Professional 8 Essential Training</className>
      <duration>11.5</duration>
      </title>
      <title>
      <className>Flash Professional 8 Beyond the Basics</className>
      <duration>10</duration>
      </title>
      <title>
      <className>Flash Professional 8 Video Integration</className>
      <duration>7.25</duration>
      </title>
      <title>
      <className>Photoshop CS2 and Flash 8 Integration</className>
      <duration>2.5</duration>
      </title>
      </titles>

      And this doesn't work either. Mind you, these were working before. I've restarted my machine, turned it off and turned it back on. I'm using a mac osx (latest operating system as this is a new intel macbook). I'm using the flex 2 sdk free downloaded one week ago.

      any ideas?

      Steve
      http://www.trivionomy.com
      http://www.smarkets.net
        • 1. Re: App broke over night (XML not parsing)
          ntsiii Level 3
          A few thoughts:
          your sample xml has no root tag and so is not valid xml. Are you aware of that?

          It has two titles nodes. Is that intentional?

          HTTPService defaults to resultType="object". Is that what you want? I much prefer "e4x", but that presents some issues of its own.

          Tracy
          • 2. Re: App broke over night (XML not parsing)
            djsodom Level 1
            Thanks. I've stripped everything down to the simplest of examples - which does not work for me.

            my xml file (in the same directory as my mxml file)
            <?xml version="1.0" encoding="UTF-8"?>
            <title>test #3</title>

            my mxml file:
            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
            creationComplete="simple.send()">

            <mx:HTTPService id="simple" url="simple.xml" />

            <mx:Text width="100" id="question" htmlText = "{simple.lastResult.title}"/>
            </mx:Application>

            It compiles okay. The command I'm using to compile is:
            steve-odoms-computer:~ steveodom$ flex/bin/mxmlc Desktop/hellomxml.mxmlLoading configuration file /Users/steveodom/flex/frameworks/flex-config.xml
            /Users/steveodom/Desktop/hellomxml.swf (183423 bytes)
            steve-odoms-computer:~ steveodom$

            Both files are on my desktop. Nothing shows up.

            Mind you, I had a more complicated solution working before this morning. I woke up, changed nothing, and started having this problem.

            thanks,

            Steve
            • 3. Re: App broke over night (XML not parsing)
              Flex harUI Adobe Employee
              I think there is an issue with datatypes. If the service is returning the XML un-converted, then it is pure XML and not an array or a string. XML doesn't to String very well, and XMLLists aren't really arrays and don't work well as ArrayCollections.

              Please check your configuration to see if you've set up the service to convert the data. I think there's a way, but I'm not sure. If not, you should treat the data as XML and use XMLListCollection and and XML expression that extracts text nodes.
              • 4. Re: App broke over night (XML not parsing)
                djsodom Level 1
                All my xml was working previously in this current format. I think there is some deeper problem. Because of the problems with xml you mentioned, that is why I stripped down the problem to one not using xml and using just an externalinterface call in my other post.
                • 5. Re: App broke over night (XML not parsing)
                  ntsiii Level 3
                  You last example works ok under Flex Builder Beta 3.
                  • 6. Re: App broke over night (XML not parsing)
                    djsodom Level 1
                    Yes, it seems to be a mac (possible mactel) problem. See my other post where Adobe was able to replicate at least some of the problem on a mactel machine.