homepage Welcome to WebmasterWorld Guest from 54.167.10.244
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP/XML Issue that Is Driving Me Nuts
sysdomatic




msg:4052686
 9:09 pm on Jan 1, 2010 (gmt 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!

 

rocknbil




msg:4052699
 9:48 pm on Jan 1, 2010 (gmt 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.

sysdomatic




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved