Welcome to WebmasterWorld Guest from 54.196.145.173

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP/XML Issue that Is Driving Me Nuts

     
9:09 pm on Jan 1, 2010 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 30, 2003
posts:57
votes: 0


Hey Everyone

I am trying to dynamically create a block of XML text to use in a program that I recently purchased. This works totally fine:

$strXML .= "<chart caption='" . $state1 . " Unemployment Rate' subCaption='For " . $year . " - Test' xAxisName='Month' yAxisName='Unemployment Rate' showBorder='0' showValues='0'>";

However, when I change it to this:

$strXML .= "<chart caption='" . $state1 . " Unemployment Rate' subCaption='For " . $year . " - Test' xAxisName='Month' yAxisName='Unemployment Rate' showBorder='0' showValues='0' numberSuffix='%'>";

I get an Invalid XML Data message.

I know what the problem is - the % is causing issues.

However, I am not sure how to fix it! I have tried changing it to the HTML code, etc. , but nothing seems to work.

Can anyone help? Thanks!

9:48 pm on Jan 1, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


Not sure if this will help, but XML is extremely strict. Did you try an entity?

....numberSuffix='&#37;'>";

or it may need to be encoded.

10:54 pm on Jan 1, 2010 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 30, 2003
posts:57
votes: 0


Awesome rocknbil - thank you. It worked when I encoded it - thanks!