Hi,
I’m bringing in some XML from a PHP generated page. unfortunately they PHP generates the XML as follows:
<moreInfo><b>Abstract Painting</b><br />1963<br />170.00 x 215.00
cm<br />Oil on canvas<</moreInfo>
Rather than processing and reading the data as HTML, flash will print this out as html:
<b>Abstract Painting</b><br />1963<br />170.00 x 215.00 cm<br />Oil on canvas<br />
I’m using AS2, a HTML enabled text field and i’ve tried the unescape/escape function. It looks like unescape will only work on hexadecimal data.
Any ideas on how to get flash to read this as html?
Cheers,
Luke.
Edited (I found a possible solution)
Here’s a test I ran
var m:String= "<items><one>plain</one><two><![CDATA[this is <i>italic</i>]]></two></items>";
var my_xml:XML = new XML(m);
trace("using firstChild:");
for (var i = 0; i<my_xml.firstChild.childNodes.length; i++) {
trace("\t"+my_xml.firstChild.childNodes[i].firstChild);
}
trace("");
trace("using firstChild.nodeValue:");
for (var i = 0; i<my_xml.firstChild.childNodes.length; i++) {
trace("\t"+my_xml.firstChild.childNodes[i].firstChild.nodeValue);
}
Output is
using firstChild:
plain
this is <i>italic</i>
using firstChild.nodeValue:
plain
this is <i>italic</i>
- 25 March 2009 03:54 PM
-
Thanks for your help, this is looking good. It’s returning “null” at the moment. Can you figure out what’s happening? Here’s what I’ve got:
AS2
[AS]moreInfoTxt.htmlText = mainNode.childNodes[moreInformation].childNodes[0].nodeValue[/AS]
XML:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<songs>
<song trackTitle="track tite1">
<moreInfo><![CDATA[ <b>Abstract Painting</b><
br />1963<br />170.00 x 215.00 cm<br />Oil on canvas<
br />Catalogue Raisonné: 144<br />Collection: K21 Kunstsammlung,
Düsseldorf, Germany<br />Audio courtesy of <u><
a href='http://:www.acoustiguide.com' target='_blank'>
Acoustiguide</a></u>]]></moreInfo>
</song>
</songs>
(I’ve broken the xml apart so the forum page holds together)
- 26 March 2009 06:52 AM
-
- Log in or join for free to make a comment.


