html in xml, php & flash

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rebecca Tsukalas

    html in xml, php & flash

    hello,

    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.
    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='1.0' encoding='utf-8'?
    <website
    <site title="Titel"
    <text><p>lala la <b>tada</b<font color="#ff0000" >dings
    </font></pand a <a href="blabla.ht ml" target="_blank"
    link</a><img src="bild.jpg"/></text
    </site
    </website
    ----------------------------------

    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

    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!
  • Colin McKinnon

    #2
    Re: html in xml, php &amp; flash

    Rebecca Tsukalas wrote:
    >
    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
    >
    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.

    HTH

    C.

    Comment

    Working...