html in xml, php & flash

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


is there an official or a correct way for the following problem:

in my xml file, there is also html text. this xml file is used in flash =
and a php code.=20
the problem is, that - using simplexml in php - the html-tags are =
interpreted as xml-tags and it gets difficult to use the content. if i =
use &gt and &lt instead of < and > or place the html-text in a CDATA, =
flash doesnt display the text as html and also returns errors. is it =
common at all, to place html into an xml-file?

a simple example of the xml-file:
<?xml version=3D'1.0' encoding=3D'utf-8'?>=20
<site title=3D"Titel">=20
<text><p>lalala <b>tada</b> <font color=3D"#ff0000">dings=20
</font></p> and a <a href=3D"blabla.html" target=3D"_blank">=20
link</a><img src=3D"bild.jpg"/></text>=20

i already have some methods of resolution to solve the problem:
- modify the html tags in the php code, so simplexml does not recognize =
them as xml-tags
- replace/delete the &lt and &gt or cdata by string operator in flash
- code own php script to put the xml into a php array=20

the point is that i want to do it correctly, use a "clean" (and perhaps =
not pedestrian) way so i will not have any unconsidered problems =
afterwards. perhaps you could suggest how to do it best - it would be =
great, thank you!

Re: html in xml, php & flash

Rebecca Tsukalas wrote:

Quoted text here. Click to load it

I guess the question is really this: Is the HTML always atomic wrt the XML -
in which case it doesn't matter.

The CDATA thing will work as long as you don't have CDATA encolsures within
your html. Personally, I would go for base64 encoding the html and
including the encoding mechanism in the markup - that should be less of an
overhead than the string replace method and (IIRC) the HTML can be
reconstructred by XSLT.

Of course, if you're HTML is not atomic with regard to the XML, then you've
got quite a different problem.



Site Timeline