<pre>
<a href="img2206061137281654515448083107450.jpg">img2206061137281654515448083107450.jpg</a>
<a href="img2206061155111654516511739131625.jpg">img2206061155111654516511739131625.jpg</a>
<a href="img2206061216591654517819022061150.jpg">img2206061216591654517819022061150.jpg</a>
<a href="img2206061224491654518289579009950.jpg">img2206061224491654518289579009950.jpg</a>
<a href="img2206061227371654518457056026425.jpg">img2206061227371654518457056026425.jpg</a>
<a href="img2206061228371654518517663163200.jpg">img2206061228371654518517663163200.jpg</a>
<a href="img2206061228581654518538851165975.jpg">img2206061228581654518538851165975.jpg</a>
<a href="img2206061229351654518575452128175.jpg">img2206061229351654518575452128175.jpg</a>
<a href="img70010100004848237809850.jpg">img70010100004848237809850.jpg</a>
<a href="img700101000348228512491075.jpg">img700101000348228512491075.jpg</a>
<a href="img7001010037032223473654175.jpg">img7001010037032223473654175.jpg</a>
<a href="img7001010037382258595567350.jpg">img7001010037382258595567350.jpg</a>
</pre>
解析如上示例,获取照片名称
在pro文件下添加
QT += xml
添加头文件
```cpp
#include <QDomDocument>
```cpp
m_PhotoName = pReply->readAll();//m_PhotoName即为http get返回的数据,即上边示例数据
if(!doc.setContent(m_PhotoName, false))//html 存储在byteArr中,QByteArray类型。
return ;
QDomElement root = doc.documentElement();
QDomNodeList nodelist=root.elementsByTagName("a");//调用Qt自带的函数提取全部的链接
if (nodelist.isEmpty())
return;
for (int i=0; i<nodelist.size(); i++)
{
href=nodelist.at(i).toElement().attribute("href");
text=nodelist.at(i).toElement().text();
qDebug()<<"new photo path"<< path;
}