Jump to content

simplexml escape characters (e.g. &)


Komikio

Recommended Posts

Hi there,I'm using PHP 5 and the simplexml. I have some XML file with a tag <description>, for example:

<description>Hello <br>world</description>

However, when I load the xml-file with simplexml it automatically replaces the <br> with <br>. This is not what I want, since my goal is to insert the data into a MySQL database (& in a field gives an unterminated entity reference error in MySQL). Now I have to manually replace the '<', '>' and '&' again with < etc.Is there a way to circumvent this and let simplexml read > as > and not as '>' so I can directly insert it into the database?Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...