开发者

Flex3: Escaping Characters in XML

I'm using Flex 3, SDk 3.6, Flash Player 10.

Flex is giving me syntax errors if I don't escape characters in my XML data. For example:

<mx:XML xmlns="">
       <group>
    <place stackName="Place1">
        <name>Place ABC</nam开发者_Go百科e>
        <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>
    </place>
        </group>
</mx:XML>

In this case, the data surrounded by the tags causes a problem. If I add a backslash to all of the special characters, then I don't get any errors, but I can't use it to make a google maps encoded polygon.

Edit: These are the errors I'm getting:

1084: Syntax error: expecting colon before rightparen.

1084: Syntax error: expecting rightparen before ampersand.

1084: Syntax error: expecting rightparen 1093: Syntax error.

1093: Syntax error. Syntax error: expecting identifier before rightbrace. [Generated code (use -keep to save) Syntax error: expecting rightparen before rightbrace. [Generated code (use -keep to save)


I suggest you use CDATA tags contain 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>
</mx:XML>


Okay, I followed this tutorial and loaded the XML from an external file and it works. I must have screwed up how the XML was loaded.

Thank you John and xavierzhao for trying to help me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜