开发者

Flex 4 fails to parse XML with quoted text

开发者 https://www.devze.com 2023-01-18 15:44 出处:网络
<?xml version=\"1.0\" encoding=\"utf-8\"?开发者_开发技巧> <WorkItems> <WorkItem Duration=\"1\" ID=\"1\" Title=\"this breaks: &quot;\"></WorkItem>
<?xml version="1.0" encoding="utf-8"?开发者_开发技巧>
<WorkItems>
  <WorkItem Duration="1" ID="1" Title="this breaks: &quot;"></WorkItem>
</WorkItems>

I embed this XML into my Flex 4 app:

<fx:XML source="data.xml" id="Data">
</fx:XML>

And I get an error: TypeError: Error #1090: XML parser failure: element is malformed.

If I remove the quot part of the title it works fine. How come? Isn't this the proper way to escape "?


Edit: Opened a bug with Adobe.


That's valid XML, possibly a bug in Flex...? Try parsing it in ActionScript instead and see what happens.


You could look into using <![CDATA[ ]]> , maybe that will help your efforts.

http://www.actionscript.org/forums/showthread.php3?t=224590"Naam"]]>BlockquoteBlockquote


I've had a similar issue - though I was working with free standing "&" characters and had to do preprocess the XML with:

        $xml = str_replace("&", "&amp;", $response->getBody());

Can you pre-process the XML to change the escape string into character literals?

0

精彩评论

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