本文整理汇总了C++中CXMLNode::ChildCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CXMLNode::ChildCount方法的具体用法?C++ CXMLNode::ChildCount怎么用?C++ CXMLNode::ChildCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CXMLNode
的用法示例。
在下文中一共展示了CXMLNode::ChildCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Parse
bool WPL_PlaylistParser::Parse(std::string p_sContent)
{
CXMLDocument* pDoc = new CXMLDocument();
if(!pDoc->LoadFromString(p_sContent)) {
delete pDoc;
return false;
}
// Parse <head> data
CXMLNode* pHead;
pHead = pDoc->RootNode()->FindNodeByName("head");
if (!pHead) {
delete pDoc;
return false;
}
// parse <body> data
CXMLNode* pSeq;
pSeq = pDoc->RootNode()->FindNodeByName("body");
if (!pSeq) pSeq = pSeq->FindNodeByName("seq");
if (!pSeq) {
delete pDoc;
return false;
}
int children = pSeq->ChildCount();
CXMLNode* child;
PlaylistEntry_t* pEntry;
for (int i = 0; i < children; ++i) {
child = pSeq->ChildNode(i);
if(child->Name().compare("media") != 0) {
continue;
}
pEntry = new PlaylistEntry_t();
if(IsURL(child->Value())) {
pEntry->sFileName = child->Value();
pEntry->bIsLocalFile = false;
}
else {
pEntry->sFileName = FormatFileName(child->Value());
pEntry->bIsLocalFile = true;
}
m_lEntries.push_back(pEntry);
}
if(!m_lEntries.empty()) {
m_bEof = false;
m_lEntriesIterator = m_lEntries.begin();
}
delete pDoc;
return true;
}