PHP Classes
elePHPant
Icontem

Class to convert HTML into objects.: Class to convert HTML into objects, XML DOM style.

Recommend this page to a friend!
  All requests RSS feed  >  Class to convert HTML into objects.  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

Class to convert HTML into objects.

Edit

by Everton da Rosa - 5 years ago (2014-11-12)

Class to convert HTML into objects, XML DOM style.

This request is clear and relevant.
This request is not clear or is not relevant.

0

Hello friends, I need a class that transforms the HTML code (which can be read from a string or a file) on an object, the style of the XML DOM with access to tags, attributes and content of tags.

  • 1 Clarification request
  • 1. by Manuel Lemos - 5 years ago (2014-11-13) Reply

    What about the DOM classes that come with PHP?

    • 2. by Everton da Rosa - 5 years ago (2014-11-13) in reply to comment 1 by Manuel Lemos Comment

      You refers to XML manipulation classes? Say something look like them, but shall apply to HTML documents. Thought to use the DOM class, but could have problems with content tags with characters such as "<" for example, which documents are XML be used with CDATA markup.

    • 3. by Manuel Lemos - 5 years ago (2014-11-13) in reply to comment 2 by Everton da Rosa Comment

      Yes, DOMDocument has a loadHTML function to parse HTML.

      I am not sure what is you concern with CDATA sections. I think they are like regular data sections. They are decoded but tags characters < and > are returned without special meaning, just like every other character.

      Did you try that or did you have any difficulties?

    • 4. by Everton da Rosa - 5 years ago (2014-11-18) in reply to comment 3 by Manuel Lemos Comment

      Tanks, I will test the DOMDocument class.

Ask clarification

1 Recommendation

HTMLPP: Parse HTML code and manage the DOM structure

This recommendation solves the problem.
This recommendation does not solve the problem.

0

by Manuel Lemos Reputation 17800 - 3 years ago (2016-02-14) Comment

There is this old class that can parse HTML using pure PHP and return a DOM like document structure.

For most purposes the PHP DOM extensions may be more useful but if you stumbled in a limitation of those extensions, you may want to try this package.


Recommend package
: 
: