Flex / Actionscript-为什么\'XML.ignoreWhitespace = false\'不起作用?
|
以下简单的代码显示了我如何在XML中保留空白,但是它不起作用!知道我在这里做错了什么吗? (请注意\'world!\'之前的空格
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<s:Application
xmlns:fx=\"http://ns.adobe.com/mxml/2009\"
xmlns:s=\"library://ns.adobe.com/flex/spark\"
xmlns:mx=\"library://ns.adobe.com/flex/mx\"
minWidth=\"955\" minHeight=\"600\"
creationComplete=\"application1_creationCompleteHandler(event)\"
>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.controls.Alert;
XML.ignoreWhitespace = false;
protected function application1_creationCompleteHandler(event:FlexEvent):void {
var xmlString:String =
\"<sentence><word1>hello</word1><word2> world!</word2></sentence>\";
trace(xmlString);
XML.ignoreWhitespace = false;
var xml:XML =
new XML(xmlString);
trace(xml.toXMLString());
Alert.show(xml.toXMLString());
}
]]>
</fx:Script>
</s:Application>
请帮忙...谢谢!
没有找到相关结果
已邀请:
2 个回复
拟蓬
本关于
的含义是正确的。
脖呐