简体   繁体   English

Flex / AIR / AS3 XML换行问题

[英]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 &lt; 选项2 - 使用&lt; and &gt; &gt; for < and > 为<和>

Then <br/> = &lt;b/&gt; 然后<br/> = &lt;b/&gt;

加载xml时,将ignoreWhitespace属性设置为true。

XML.ignoreWhitespace = true;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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