I am using C++ and libtidy to parse the html page. but the document for libtidy is so incomplete that I can hardly understand what do the API functions do. What I want is to get the specific attribute value from a html dom node, for example:
<table class="xxxx" ...
I want to get the "xxxx" out. How can I do this? Do I have to traverse all the attributes under the table node like this?
if (tidyNodeIsTABLE(tdNode))
{
TidyAttr attr;
for (attr=tidyAttrFirst(tdNode); attr; attr=tidyAttrNext(attr))
{
if (tidyAttrGetId(attr) == TidyAttr_CLASS)
{
std::string value = tidyAttrValue(attr);
break;
}
}
}
or is there any more convenient way? Thanks.