SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2003
    Location
    ny
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation removing the <b> tag from a string

    OK, first of all I must say that i can't find a good tutorial to teach me how to parse XML using PHP. I'm trying to parse a RSS 2.0 file. It is setup like this

    <channel>
    <title>info</title>
    <link>info</link>
    <description>info</description>
    <language>info</language>
    <pubDate></pubDate>
    <docs>info</docs>
    <generator>info</generator>
    <webMaster>info</webMaster>
    <item>
    <title>Big Team Battle: Assault on Headlong</title>
    <link></link>
    <pubDate></pubDate>
    <guid></guid>
    <description>Team game played at Wed, 24 Nov 2004 06:00:18 GMT&lt;br/&gt;&lt;br/&gt;Playlist: Big Team Battle&lt;br/&gt;Assault on Headlong&lt;br/&gt;&lt;br/&gt;<b>Gamertag (Team): Score, Kills, Deaths, Assists</b>&lt;br/&gt;Luis Alejandro (0): 1, 5, 8, 1&lt;br/&gt;Fatb0y (1): 1, 12, 3, 2&lt;br/&gt;cacplaya05 (1): 1, 8, 3, 0&lt;br/&gt;jay2266 (0): 0, 2, 8, 2&lt;br/&gt;gold77 (0): 0, 6, 9, 1&lt;br/&gt;Jake Blade (1): 0, 1, 7, 1&lt;br/&gt;NickGrahamFox (0): 0, 2, 4, 1&lt;br/&gt;CrunchEM (1): 0, 6, 5, 2&lt;br/&gt;neonMcGurk (0): 0, 5, 3, 1&lt;br/&gt;SmArTeR tHaN u (0): 0, 4, 3, 1&lt;br/&gt;PluggedOXY80 (1): 0, 0, 3, 4&lt;br/&gt;cacballa08 (1): 0, 4, 2, 2&lt;br/&gt;Clade (1): 0, 3, 7, 2&lt;br/&gt;Magic Hat 9 (0): 0, 6, 8, 2&lt;br/&gt;AztecWarrior7 (0): 0, 1, 3, 0&lt;br/&gt;BIGGIEG (1): 0, 8, 6, 3&lt;br/&gt;
    </description>
    </item>
    <item>
    . . . .
    </item>
    and there are tons of item tags

    What I would like to do it to read this file and get the info from the description tag in every item. I have found a few scripts that can do this. The ones that sort -of-work display the info until it hits the <b> tag in the description.
    I tried using php to replace the <b> and </b> tags with a empty space, but that doesnt work. How would I go about removing the <b> and </b> tag from the $description variable.

    How can I get this to work ?

    Point me in the right direction and maybe I can figure out. Thanks

  2. #2
    SitePoint Evangelist Aska's Avatar
    Join Date
    Aug 2003
    Location
    Melbourne, Australia
    Posts
    454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you "replacing" them like this?
    PHP Code:
    $search = array( '<b>''</b>' );

    $description str_replace$search" "$description ); 


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •