简体   繁体   中英

Flex 3 Error Loading XML

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

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM