Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8130723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:49:40+00:00 2026-06-06T08:49:40+00:00

The Scenario I am using PHP’s SimpleXML to parse a blog feed. The most

  • 0

The Scenario

I am using PHP’s SimpleXML to parse a blog feed. The most important node in the tree is the content. I would like to trim the fat from the node, namely the styling features added by the blog site. It is all contained within the same node, and the html entities are encoded. FirePHP logging shows that the string is HTML.

For example, the content node looks like this:

<content type='html'>
BLAH BLAH BLAH.&lt;div class="blogger-post-footer"&gt;&lt;img width='1'
height='1' src='https://blogger.googleusercontent.com/tracker
6552111825067891333-7815715921198109330?l=cobracabanarecords.blogspot.com'
alt='' /&gt;&lt;/div&gt;
&lt;a href="http://4.bp.blogspot.com/-RQPMMDLPMqg/T9ePf9jbXFI/
AAAAAAAAAGs/6egu-05Zim4/s1600/blogHeader.jpg" imageanchor="1"
style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;
"&gt;&lt;img border="0" height="92" src="http://4.bp.blogspot.com/
-RQPMMDLPMqg/T9ePf9jbXFI/AAAAAAAAAGs/6egu-05Zim4/s320/blogHeader.jpg" 
width="320" /&gt;&lt;/a&gt;
&lt;a href="http://website.com"&gt;Homepage!&lt;/a&gt;
</content>

My Question

How can I strip out the parts that I want, and leave the bloat? I would like to keep the text, images and links, but don’t need blogger’s styling syntax or the element with class “blogger-post-footer.” Is there a class or function that will identify those particular HTML elements and allow me to strip out the irrelevant elements?

Update

I tried the recommended html_entity_decode function. Now I have the raw html in a string. I read about the DOMDocument class and tried this:

$doc = new DOMDocument();
$doc->loadHTML($htmlContent);

Logging with firephp shows the $doc variable contains only the number 1, and I am unable to manipulate the string as though it were HTML. If I can get that to work, I think the next step will be to try a getElementsByTagName function, then traversing through the nodelist to removeChild, or copying it to an array. I could still use some guidance on this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T08:49:41+00:00Added an answer on June 6, 2026 at 8:49 am

    get the string from <content>, use html_entity_decode() on the string to get back raw html. use strip_tags() to remove all html or create another simple xml object with the content html and go through and remove the style/other attributes and tags.

    You can also use strip_tags() to remove all html except for a whitelist of tags that are allowed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario: Sending XML, generated using php, via cURL to an external server for parsing.
i am using php arrays in my project like below but i am confused
Here's a scenario; I want to send email using PHP and Zend Framework. Here's
We are develping an application using PHP and Symfony framework. Ideally the system would
I am using PHP and mysql. Scenario: The registration form only required 2 fields.
whenever we include\require some file using php like require ('links.php'); OR include ('links.php'); which
Here's the scenario I would like to know if a date like '2011-03-04' and
Consider the following scenario: http://www.restserver.com/example.php returns some content that I want to work with
I am using a dynamic HTML template system (like PHP) and I'm wondering if
I am using PHP via Codeigniter for this scenario. It's a basic category listing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.