QHtmlParser
0.0.1
A Qt/C++ library for parsing and traversing/searching HTML documents.
|
Represents a HTML document. More...
#include <qhtmlparser.h>
Public Member Functions | |
QHtmlDocument () | |
Constructs a null QHtmlDocument. | |
QHtmlDocument (const QString &content) | |
Constructs a QHtmlDocument and sets the document content to content. More... | |
QHtmlDocument (const QByteArray &content) | |
Constructs a QHtmlDocument and sets the document content to content. More... | |
QHtmlDocument (QIODevice *device) | |
Constructs a QHtmlDocument and sets the document content to the data contained in device. More... | |
~QHtmlDocument () | |
Destroys the QHtmlDocument. More... | |
bool | setContent (const QString &content) |
Sets the document content to content. More... | |
bool | setContent (const QByteArray &content) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
bool | setContent (QIODevice *device) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the document content to the data contained in device. More... | |
QHtmlElement | documentElement () const |
Returns the root element of the document. More... | |
QHtmlElement | htmlElement () const |
Returns the html element of the document (the element with tag name 'html'). More... | |
QHtmlElement | headElement () const |
Returns the head element of the document (the element with tag name 'head'). More... | |
QHtmlElement | bodyElement () const |
Returns the body element of the document (the element with tag name 'body'). More... | |
QString | toString () const |
Returns the HTML string of the document. More... | |
bool | hasError () const |
Returns true if an error occurred when parsing the document. | |
QString | errorString () const |
Returns a description of any error that occurred when parsing the document. More... | |
bool | isNull () const |
Returns true if the document is null. More... | |
Represents a HTML document.
The QHtmlDocument class is used for loading and parsing a HTML document.
Example usage:
|
explicit |
Constructs a QHtmlDocument and sets the document content to content.
|
explicit |
Constructs a QHtmlDocument and sets the document content to content.
|
explicit |
Constructs a QHtmlDocument and sets the document content to the data contained in device.
The device should be open and ready for reading the entire document.
QHtmlDocument::~QHtmlDocument | ( | ) |
Destroys the QHtmlDocument.
bool QHtmlDocument::setContent | ( | const QString & | content | ) |
Sets the document content to content.
Returns true if the content can be parsed, otherwise false.
bool QHtmlDocument::setContent | ( | QIODevice * | device | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the document content to the data contained in device.
The device should be open and ready for reading the entire document.
QHtmlElement QHtmlDocument::documentElement | ( | ) | const |
Returns the root element of the document.
If the document is null, a null element is returned.
QHtmlElement QHtmlDocument::htmlElement | ( | ) | const |
Returns the html element of the document (the element with tag name 'html').
If the document is null, a null element is returned.
QHtmlElement QHtmlDocument::headElement | ( | ) | const |
Returns the head element of the document (the element with tag name 'head').
If the document is null, a null element is returned.
QHtmlElement QHtmlDocument::bodyElement | ( | ) | const |
Returns the body element of the document (the element with tag name 'body').
If the document is null, a null element is returned.
QString QHtmlDocument::toString | ( | ) | const |
Returns the HTML string of the document.
If the document is null, an empty string is returned.
QString QHtmlDocument::errorString | ( | ) | const |
Returns a description of any error that occurred when parsing the document.
If no error occurred, an empty string is returned.
bool QHtmlDocument::isNull | ( | ) | const |
Returns true
if the document is null.
The document is null if no content has been set.