Jump to content

remove &


Azteroth

Recommended Posts

ok I am receiving a string from a database and on of the strings returns a & so my xml output is giving me the following error:

 

Whitespace is not allowed at this location. Error processing resource

 

I am wondering how to make this string if it contains the & replace it with &

 

Thank you ahead for any help

Link to comment
https://forums.phpfreaks.com/topic/107851-remove/
Share on other sites

thanks for the quick response

 

but what happens if there is no & in the data that comes back... I just found something on using CDATA to have & in my data... problem is that it comes back with an error like this:

 

Declaration has an invalid name

 

It seems that I am having troubles with the xml that php is putting out...

 

$xml_out = "<!CDATA[".$full_descRow['listingsdbelements_field_value']."]]>";

 

this is the line that is giving the error now:(

 

Link to comment
https://forums.phpfreaks.com/topic/107851-remove/#findComment-552887
Share on other sites

ok so that works on the description string that is returned from my db... would this be an alright way to go about making sure my xml will work...

 

$str = str_replace("&", "&", $misc_string);
$final_str = str_replace("<", "<", &str);

echo $str;

 

because it will still register to $str if there is no & right?

Link to comment
https://forums.phpfreaks.com/topic/107851-remove/#findComment-552912
Share on other sites

thank you I found that the other day when I ran into a problem and got rid of it... now I know that my database and my clients database aren't exactly the same... so it was sending back a character error... now I am just creating on my clients database so I shouldn't run into the same problem hopefully... thank you for your response discomatt.

 

I have another question how would I take a string that comes back like:

 

0123456789

 

and make it display like:

 

123 456 789

 

this is for an Italian phone number but was stored on the database like the prior... but if the first character is not zero I want it to display it also... with the same sort of formatting... how can I do this

Link to comment
https://forums.phpfreaks.com/topic/107851-remove/#findComment-553001
Share on other sites

just tried the htmlentities() and get the following error

 

	<listing_desc>La Divisione Ricerca & Selezione di MEN AT WORK - FILIALE DI ODERZO - sta cercando una persona da inserire in uno studio professionale ubicato a Oderzo; la/il candidata/o ideale dovrebbe possedere i seguenti requisiti: esperienza significativa nella tenuta della contabilità fino al bilancio contabile di chiusura con scritture di rettifica, autonomia nella gestione dei clienti e dello studio, diploma di ragioneria, preferibile esperienza precedente in studio professionale.</listing_desc>		<listing_create_date>27/03/2008</listing_create_date>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^

 

so I think that sticking with what I have is the best bet

Link to comment
https://forums.phpfreaks.com/topic/107851-remove/#findComment-553005
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.