...

View Full Version : Parsing XML with PHP question



MrRooster
10-11-2009, 07:16 AM
I'm really new to parsing XML so forgive me if my terminology is a bit off.

I have a script that was written by some else and I have been working on updating it's abilities to display the outputs. Basically what this script does is parses an xml page, gathers the info and outputs it in a .png image.

I have run into a problem when parsing a line from the xml page that contains line breaks and a link with some other info.

The line in the xml I want to show looks like this:


<stateMessage> In-Game<br />Day of Defeat: Source - <a href="steam://connect/69.12.91.31:27015">Join</a> </stateMessage>

the line in the php code that controls the output looks like this:


imagettftext($image, $state['fontsize'], 0, $state['x'], $state['y'], $colors['state'], $fontpath.$state['font'], "". strip_tags($steam['msg']));

the ['msg'] is the <stateMessage> and if I remove the strip_tags() the the whole text line shows with the line breaks and link code.

What ends up happening is the output looks like this with everything all smashed together:

In-GameDay of Defeat: Source - Join

What I would like to do is have a space in between the In-Game and the Name of the game and remove the - Join

I know this can be done because I have seen similar php code do it but I can not figure out what I need to change or add to make mine work this way.

Not sure if this is enough info to even get an answer but any help would be greatly appreciated.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum