[英]Flex / AIR / AS3 XML newline problem
i have an xml i load within my air app which looks like this: 我在我的空中应用程序中加载了一个xml,如下所示:
<chapter title="hello" nr="111" src="">
<page>
<text>To adjust <br/><br/>. . .</text>
<text>To adjust <br/><br/>. . .</text>
</page>
</chapter>
when i trace or debug what is between the text element ... i get: 当我跟踪或调试文本元素之间的内容时......我得到:
To adjust <br/>
<br/>
. . .";
Why do i get those newlines, or even better... how do i get rid of them? 为什么我会得到这些换行符,甚至更好...我如何摆脱它们? (the full xml is a bit more complicated but i load the xml-file in a xmllist-component and navigate the structure until i get the correct value)
(完整的xml有点复杂,但我在xmllist组件中加载xml文件并导航结构,直到我得到正确的值)
The page-element is loaded in a XMLList-component and with a for-loop I read the data from the text-elements. 页面元素加载到XMLList组件中,并且使用for-loop我从text-elements读取数据。
我想你想要lineEnding
Option 1 - USE <![CDATA[ ]]>
选项1 - 使用
<![CDATA[ ]]>
<chapter title="hello" nr="111" src="">
<page>
<text><![CDATA[To adjust <br/><br/>. . . ]]></text>
<text><![CDATA[To adjust <br/><br/>. . . ]]></text>
</page>
</chapter>
Option 2 - use <
选项2 - 使用
<
and >
和
>
for < and > 为<和>
Then <br/> = <b/>
然后
<br/> = <b/>
I guess it's 我猜是的
XML.prettyPrinting = false;
see prevent pretty printting - wonderfl build flash online 看看防止漂亮的打印 - wonderfl build flash online
加载xml时,将ignoreWhitespace属性设置为true。
XML.ignoreWhitespace = true;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.