Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6233135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:14:38+00:00 2026-05-24T10:14:38+00:00

I am working on project in flex 3 , where user enters some text

  • 0

I am working on project in flex 3, where user enters some text which is to be stored in a mysql database and shown later. I am using XML for data transfer from flex to php and vice-versa. SimpleXMLElement in php is being used to create the XML. The problem is the XML breaks on special characters.

Here is sample code:

FLEX:

var someXML:XML = <root><data>somedata</data><data>...</data> ... </root>
var data:Object = {};
data.xmlData = someXML;

saveDataService.send(data);

Here somedata is the data entered by the user. In php, I extract the someXML using SimpleXMLElement and store it to mysql. There is no problem till here. Even if somedata has special characters its working fine and data is stored properly.

Now, in the other case, getting data from database and showing in flex, the response from the php breaks with an error:

SimpleXMLElement::addChild() [simplexmlelement.addchild]:
unterminated entity reference

I tried using urlencode in php, and decodeURI function in flex, but the decoded string is not the same, few special characters are still %xy after decoding.

How do I solve this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T10:14:39+00:00Added an answer on May 24, 2026 at 10:14 am

    First off, if you have a dangling & character in your xml, then you have an xml syntax error. Its nothing to do with SimpleXML or any other parser complaining. I’d suggest you fix this even before the data gets into the db, better yet, before it is sent to the php service.

    Gordon’s suggestion works, for & at least. You’ll likely face the problem with other characters like <, " etc., later on and you’ll be facing pretty much the same thing.

    I’d suggest you do a htmlentities like operation on the text data in side the xml, not including the xml tags themselves. Following code taken from http://thingsthatwork.net/index.php/2008/06/26/html-entities-and-actionscript/

    XML(new XMLNode(XMLNodeType.TEXT_NODE, "content with special chars like & and others")).toXMLString();
    

    Haven’t tested the above, but it should return you the sanitized content that you can put into xml. It should effectively turn & chars into &amp;, all of them. i.e., This should also turn occurences of &gt; to &amp;gt;, so be wary of that.

    Let me know if you need anything else. Also, how ya doin’ man!? 😉

    Edit: Oh, keep in mind, it has been long time since I used php, so some of the info above might be a bit off. Please correct me guys. Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on some old Flex project (Flex 2.0.1 hotfix 2) and I
I'm working on a large-size dual AS3/Flex project (some parts are pure AS3, other
I am working on web project. We are using flex as UI layer. My
I'm working on a blank template flex 4.5 mobile project. I am using states,
I'm working on a Flex 3 project, and I'm using a pair of XMLListCollection(s)
Am working on a flex project I am looking to provide some UI functionality
I'm working on important project using Flex framework and i want to keep my
I am working on a flex project using sharedobjects to store information on my
I am working on flex mobile project using flex 4.5.1. I want to get
I'm looking to have a couple of plugins in a Flex project I'm working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.