views:

2124

answers:

2

I need to generate an editable xml file to supply content to a flash website.

I am generating my file with a html form, and htmlspecialchars e.g.:

    $currentItem = htmlspecialchars(stripslashes($currentItem));

This is to prevent xml entries which would produce the error "XML Parsing Error: not well-formed", such as

<entry title="Words & Things">
---------------------^

It has the side effect of making the flash file display the html codes for the content, rather than the proper characters.

Is there a good way to convert the codes back, once they are read into the Flash file (as3)?

+1  A: 

Maybe try:

public function htmlUnescape(str:String):String
{
    return new XMLDocument(str).firstChild.nodeValue;
}

(Found at: http://www.razorberry.com/blog/archives/2007/11/02/converting-html-entities-in-as3/)

Ryan Smith
Tidy! Thanks Ryan not had chance to check it yet but this should work a treat I'm sure.
jsims281
A: 

Use html_entity_decode: http://us.php.net/manual/en/function.html-entity-decode.php

Josh Leitzel
I think he's looking for a way to do it inside the flash once he has the XML loaded.
Ryan Smith