本文整理汇总了C++中CXMLNode::Attribute方法的典型用法代码示例。如果您正苦于以下问题:C++ CXMLNode::Attribute方法的具体用法?C++ CXMLNode::Attribute怎么用?C++ CXMLNode::Attribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CXMLNode
的用法示例。
在下文中一共展示了CXMLNode::Attribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Parse
bool RSS_PlaylistParser::Parse(std::string p_sContent)
{
CXMLDocument* pDoc = new CXMLDocument();
if(!pDoc->LoadFromString(p_sContent)) {
// TODO Log the incorrect format
delete pDoc;
return false;
}
CXMLNode* pTmp;
pTmp = pDoc->RootNode()->FindNodeByName("channel");
if(!pTmp) {
// TODO Log the incorrect format
delete pDoc;
return false;
}
for(int i = 0; i < pTmp->ChildCount(); i++) {
if(pTmp->ChildNode(i)->Name().compare("item") != 0) {
// TODO Log the incorrect format
continue;
}
CXMLNode* pEnc = pTmp->ChildNode(i)->FindNodeByName("enclosure");
if(!pEnc) {
// TODO Log the incorrect format
continue;
}
PlaylistEntry_t* pEntry = new PlaylistEntry_t();
pEntry->sFileName = pEnc->Attribute("url");
pEntry->nSize = pEnc->AttributeAsUInt("length");
pEntry->sMimeType = pEnc->Attribute("type");
pEntry->bIsLocalFile = false;
if(pTmp->ChildNode(i)->FindNodeByName("title")) {
pEntry->sTitle = pTmp->ChildNode(i)->FindNodeByName("title")->Value();
}
m_lEntries.push_back(pEntry);
}
/* <channel>
<title>Marillion Online Podcast</title>
<link>http://www.marillion.com</link>
<language>en</language>
<copyright>℗ & © 2006 Marillion</copyright>
<pubDate>Wed, 13 Dec 2006 15:00:00 GMT</pubDate>
<itunes:subtitle>Find a Better Way of Life at marillion.com</itunes:subtitle>
<itunes:author>Marillion</itunes:author>
<itunes:summary>Official insider information for British rock band Marillion. Whether writing in the studio, recording new material, preparing for a live show, or on the road - get the scoop DIRECT from the band members themselves. Find a Better Way of Life at marillion.com</itunes:summary>
<description>Official insider information for British rock band Marillion. Whether writing in the studio, recording new material, preparing for a live show, or on the road - get the scoop DIRECT from the band members themselves. Find a Better Way of Life at marillion.com</description>
<item>
<title>Album Number 14 Begins</title>
<itunes:author>Marillion</itunes:author>
<itunes:subtitle>Recording is set to begin on the next studio album</itunes:subtitle>
<itunes:summary>26 May 2006. Marillion have been jamming song ideas since the beginning of 2006 and have now come up with a short-list of contenders for the next studio album. Coming to you direct from the live room at the Racket Club studio with Mark Kelly, Ian Mosley, Pete Trewavas, Mike Hunter, and the Racket Records Peanut Gallery.</itunes:summary>
<enclosure url="http://media.marillion.com/podcast/20060526.mp3" length="3361560" type="audio/mpeg" />
<guid>http://media.marillion.com/podcast/20060526.mp3</guid>
<pubDate>Fri, 26 May 2006 09:00:00 GMT</pubDate>
<itunes:duration>4:00</itunes:duration>
<itunes:explicit>yes</itunes:explicit>
<itunes:keywords>marillion, studio, new, album, recording, update, racket, hogarth, kelly, mosley, trewavas, rothery</itunes:keywords>
</item> */
delete pDoc;
if(!m_lEntries.empty()) {
m_bEof = false;
m_lEntriesIterator = m_lEntries.begin();
}
return true;
}