0

I'm running into a problem trying to use XML in a Flex 3 app. I'm on a Mac running Flex Builder 3.

I just upgraded to the 3.6 SDK and I started targetting Flash Player 10 instead of Flash Play 9.0.124-- so maybe that has something to do with it. Maybe I upgraded incorrectly?

For some reason, it won't let me load some XML. I'm getting a lot of syntax errors.

<mx:XML id="myStuff" source="data/myData.xml" format="e4x" />

My data is Google Maps encoded data. It looks like this:

<group>
    <area stackName="PlaceA">
        <name>Place A</name>
        <latitudeCenter>38.954069</latitudeCenter>
        <longitudeCenter>-77.033408</longitudeCenter>
        <encoding>qgtlFvdeuMaF@{Y?sJCqJI}IB{NCq]@?{h@lw@?@vKgC`C}@fAzBEfGBbFCzEBdJ?xQfO|ClCbBnA</encoding>
        <level>P?A?@@@HIGD@G@@@?F?@P</level>
        <zoomFactor>2</zoomFactor>
        <numlevels>18</numlevels>
    </area>

    <area stackName="PlaceB">
        <name>Place B</name>
        <latitudeCenter>38.91911901743697</latitudeCenter>
        <longitudeCenter>-77.04505920410156</longitudeCenter>
        <encoding>ieqlFjiguM?_YHW\k@ZYd@UNAcA{AsGaLkJcRkAuBpm@BjBlJdBlJZ`@fCfBd@r@dFnMbCxF|B`Fn@fAmCViDHu@RoCnAsCfA}BhAe@`@OZu@fDSb@wAj@e@VUq@uB}@aAy@yCf@_AFs@i@Fe@y@}@Eo@c@@[[CcAQAk@ZQf@o@BIA?W</encoding>
        <level>PD@BA@F?B@HI?E@AD@A@HAD@?@E@B@C?FBAD@EBBBCABDABC?BP</level>
        <zoomFactor>2</zoomFactor>
        <numlevels>18</numlevels>
     </area>
</group>

If I remove both lines then, I don't get any errors. If I leave them in, then I get lots of syntax errors. Maybe something needs to be escaped? If so, how?

Before I upgraded to SDK 3.6, I used similar data without any problems.

Any suggestions?

Thank you.

-Laxmidi

Laxmidi
  • 2,650
  • 12
  • 49
  • 81
  • Is there some reason you're not using Flex 4? - Anyway, please post the error messages. – ocodo May 06 '11 at 01:10
  • Hi Slomojo, Thanks for the message. I haven't upgraded, yet. I'm cheap/lazy, and it didn't seem like FlashBuilder 4 added a lot. The problem is definitely with escaping characters. It's interesting that with Flash 9 and the 3.2 SDK, that loading the XML wasn't an issue, but with Flash 10 and the 3.6 SDK, it is an issue. If I escape all of the weird characters between the tags, the errors go away. But, when I use the escaped version of the in Google Maps, it draws a crazy line. So, I need to figure out a solution to that. – Laxmidi May 06 '11 at 16:51
  • I also noticed that the XML tag with Flash 10 and the 3.6 SDK has a place for a namespace , which it didn't with the older version. Do I need to put a namespace? If so, what? I thought XML was part of the core? – Laxmidi May 06 '11 at 16:52
  • I'm not familiar enough with the post v4 versions of the Flex 3 sdk, the last one I used was 3.2. So I can't really help you on that. However, Flex 4 is a significant upgrade, particularly the Spark library, not too sure why cost is an issue, the SDK and compiler is free. Aside from autocomplete FlashBuilder doesn't really do that much anyway. (design mode is a joke!) – ocodo May 07 '11 at 07:45
  • This may be of interest... http://www.adobe.com/devnet-apps/flex/free/ – ocodo May 07 '11 at 07:48

1 Answers1

0

I suggest use CDATA tags wrap the content.

<mx:XML xmlns="">
<group>
    <place stackName="Place1">
        <name>Place ABC</name>
        <encoding>
            <![CDATA[
                ieqlFjiguM?_YHW\k@ZYd@UNAcA{AsGaLkJcRkAuBpm@BjBlJdBlJZ`@fCfBd@r@dFnMbCxF|B`Fn@fAmCViDHu@RoCnAsCfA}BhAe@`@OZu@fDSb@wAj@e@VUq@uB}@aAy@yCf@_AFs@i@Fe@y@}@Eo@c@@[[CcAQAk@ZQf@o@BIA?W
            ]]>
        </encoding>
    </place>
</group>

xavierzhao
  • 780
  • 9
  • 18