Poco::log
Poco::json
Poco::XML
void LPocoXml::OpenFile(const string &path)
{
InputSource src(path);
try
{
Poco::XML::DOMParser parset;
Poco::AutoPtr<Document> pDoc = parset.parse(&src);
int pCount = atoi((GetNodeAttr("PersonS", "personCount",pDoc)).c_str());
for (int i = 1; i <= pCount; i++) {
struct Person tempPerson;
char name[MAX_PATH];
char age[MAX_PATH];
char address[MAX_PATH];
sprintf_s(name, sizeof(name), "PersonS/Person[@id='%d']/elem[@eName='name']", i);
sprintf_s(age, sizeof(age), "PersonS/Person[@id='%d']/elem[@eName='age']", i);
sprintf_s(address, sizeof(address), "PersonS/Person[@id='%d']/elem[@eName='address']", i);
strcpy(tempPerson.name, (GetNodeAttr(name, "value", pDoc)).c_str());
tempPerson.age = atoi(GetNodeAttr(age, "value", pDoc).c_str());
strcpy(tempPerson.address, (GetNodeAttr(address, "value", pDoc)).c_str());
qDebug() << tempPerson.name<<endl;
qDebug() << tempPerson.age<<endl;
qDebug() << tempPerson.address<<endl;
}
/*
NodeIterator it(pDoc, NodeFilter::SHOW_ALL);
Node* pNode = it.nextNode(); //指向第0个节点
while (pNode)
{
NamedNodeMap* nodeMap = pNode->attributes(); //return the node attribut
//遍历nodeMap中所有属性
if (nodeMap)
{
for (int i = 0; i < nodeMap->length(); i++) {
Node* attr = nodeMap->item(i);
std::cout << attr->nodeName() << std::endl;
std::cout << attr->nodeValue() << std::endl;
}
}
std::cout << pNode->nodeName() << std::endl;
std::cout << pNode->nodeValue() << std::endl;
pNode = it.nextNode();
}
*/
}
catch (Poco::Exception& e)
{
std::cerr << e.displayText() << std::endl;
}
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具