开发者

How to let special XML chars unconverted in flex?

开发者 https://www.devze.com 2023-01-23 10:41 出处:网络
That\'s my xml node: <node att=\"something &lt; something else\"> </node> When i write in my code :

That's my xml node:

 <node att="something &lt; something else"> </node>

When i write in my code :

trace(xml.node.@att.toStrin开发者_Python百科g());

it prints out the string :

something < something else

My problem is that i need to print out the orriginal string:

 something $lt; something else //put $ instead of &

Does anyone know how to solve this?

Thanks in advance.


Hey ! Just tried this and it seems to work... : )

var xml:XML=<node att="something &lt; something else"> </node>;
trace(xml.toXMLString());//<node att="something &lt; something else"/>
trace(xml.@att.toXMLString());//something &lt; something else


The basic XML Parser will unespace them.

If you want the converted char again, you'll need to reconvert it again using ActionScript 3.

You can also convert it twice, using &amp;lt;


Option 1 - USE <![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; and &gt; for < and >

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

0

精彩评论

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