QHtmlParser
0.0.1
A Qt/C++ library for parsing and traversing/searching HTML documents.
|
Represents a HTML element/tag. More...
#include <qhtmlparser.h>
Public Member Functions | |
QHtmlElement () | |
Constructs a null QHtmlElement. | |
QHtmlElement (const QHtmlElement &other) | |
Contructs a copy of other. | |
~QHtmlElement () | |
Destroys the QHtmlElement. | |
QHtmlAttributes | attributes () const |
Returns the attributes of the element. | |
QString | attribute (const QString &name) const |
Returns the value of the attribute with the specified name. More... | |
QHtmlElement | parentElement () const |
Returns the element's parent. | |
QHtmlElement | nextSibling () const |
Returns the next sibling of the element. More... | |
QHtmlElement | previousSibling () const |
Returns the previous sibling of the element. More... | |
QHtmlElementList | childElements () const |
Returns all elements that are a direct child of the element. | |
QHtmlElement | firstChildElement () const |
Returns the first direct child of the element. More... | |
QHtmlElement | lastChildElement () const |
Returns the last direct child of the element. More... | |
QHtmlElement | nthChildElement (int n) const |
Returns the nth direct child of the element. More... | |
QHtmlElement | elementById (const QString &id) const |
Returns the child of the element with 'id' attribute matching id. More... | |
QHtmlElementList | elementsByTagName (const QString &name) const |
Returns all children of the element with tagName() matching name. | |
QHtmlElementList | elementsByTagName (const QString &name, const QHtmlAttributeMatch &match) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns all children of the element with tagName() matching name and attribute matching match. | |
QHtmlElementList | elementsByTagName (const QString &name, const QHtmlAttributeMatches &matches, QHtmlParser::MatchType matchType=QHtmlParser::MatchAll) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns all children of the element with tagName() matching name and attributes matching matches. | |
QHtmlElement | firstElementByTagName (const QString &name) const |
Returns the first child with tagName() matching name. More... | |
QHtmlElement | firstElementByTagName (const QString &name, const QHtmlAttributeMatch &match) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the first child with tagName() matching name and attribute matching match. | |
QHtmlElement | firstElementByTagName (const QString &name, const QHtmlAttributeMatches &matches, QHtmlParser::MatchType matchType=QHtmlParser::MatchAll) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the first child with tagName() matching name and attributes matching matches. | |
QHtmlElement | lastElementByTagName (const QString &name) const |
Returns the last child with tagName() matching name. More... | |
QHtmlElement | lastElementByTagName (const QString &name, const QHtmlAttributeMatch &match) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the last child with tagName() matching name and attribute matching match. | |
QHtmlElement | lastElementByTagName (const QString &name, const QHtmlAttributeMatches &matches, QHtmlParser::MatchType matchType=QHtmlParser::MatchAll) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the last child with tagName() matching name and attributes matching matches. | |
QHtmlElement | nthElementByTagName (int n, const QString &name) const |
Returns the nth child with tagName() matching name. More... | |
QHtmlElement | nthElementByTagName (int n, const QString &name, const QHtmlAttributeMatch &match) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the nth child with tagName() matching name and attribute matching match. | |
QHtmlElement | nthElementByTagName (int n, const QString &name, const QHtmlAttributeMatches &matches, QHtmlParser::MatchType matchType=QHtmlParser::MatchAll) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the nth child with tagName() matching name and attributes matching matches. | |
QString | tagName () const |
Returns the tag name of the element. More... | |
QString | text (bool includeChildElements=false) const |
Returns any text for the element, including any child elements if includeChildElements is true . More... | |
QString | toString () const |
Returns the HTML string of the element. More... | |
bool | isNull () const |
Returns true if the element is null. More... | |
bool | operator== (const QHtmlElement &other) const |
Returns true if other represents the same tag in the same document as this QHtmlElement. | |
bool | operator!= (const QHtmlElement &other) const |
Returns true if other does not represent the same tag in the same document as this QHtmlElement. | |
Represents a HTML element/tag.
QString QHtmlElement::attribute | ( | const QString & | name | ) | const |
Returns the value of the attribute with the specified name.
If no attribute is found, an empty string is returned.
QHtmlElement QHtmlElement::nextSibling | ( | ) | const |
Returns the next sibling of the element.
If the element has no next sibling, a null element is returned.
QHtmlElement QHtmlElement::previousSibling | ( | ) | const |
Returns the previous sibling of the element.
If the element has no previous sibling, a null element is returned.
QHtmlElement QHtmlElement::firstChildElement | ( | ) | const |
Returns the first direct child of the element.
If the element has no children, a null element is returned.
QHtmlElement QHtmlElement::lastChildElement | ( | ) | const |
Returns the last direct child of the element.
If the element has no children, a null element is returned.
QHtmlElement QHtmlElement::nthChildElement | ( | int | n | ) | const |
Returns the nth direct child of the element.
If the element has no children, a null element is returned.
QHtmlElement QHtmlElement::elementById | ( | const QString & | id | ) | const |
Returns the child of the element with 'id' attribute matching id.
If no matching element is found, a null element is returned.
QHtmlElement QHtmlElement::firstElementByTagName | ( | const QString & | name | ) | const |
Returns the first child with tagName() matching name.
If no matching element is found, a null element is returned.
QHtmlElement QHtmlElement::lastElementByTagName | ( | const QString & | name | ) | const |
Returns the last child with tagName() matching name.
If no matching element is found, a null element is returned.
QHtmlElement QHtmlElement::nthElementByTagName | ( | int | n, |
const QString & | name | ||
) | const |
Returns the nth child with tagName() matching name.
If no matching element is found, a null element is returned.
QString QHtmlElement::tagName | ( | ) | const |
Returns the tag name of the element.
If the element is null, an empty string is returned.
QString QHtmlElement::text | ( | bool | includeChildElements = false | ) | const |
Returns any text for the element, including any child elements if includeChildElements is true
.
If the element is null, an empty string is returned.
QString QHtmlElement::toString | ( | ) | const |
Returns the HTML string of the element.
If the element is null, an empty string is returned.
bool QHtmlElement::isNull | ( | ) | const |
Returns true
if the element is null.
An element is null if it does not represent a tag in a HTML document.