3

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)?

jsims281
  • 2,206
  • 2
  • 30
  • 57

2 Answers2

2

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
  • 8,344
  • 22
  • 76
  • 103
-2

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

Josh Leitzel
  • 15,089
  • 13
  • 59
  • 76