当前位置: 首页>>代码示例>>C++>>正文


C++ CXMLNode::AttributeAsUInt方法代码示例

本文整理汇总了C++中CXMLNode::AttributeAsUInt方法的典型用法代码示例。如果您正苦于以下问题:C++ CXMLNode::AttributeAsUInt方法的具体用法?C++ CXMLNode::AttributeAsUInt怎么用?C++ CXMLNode::AttributeAsUInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CXMLNode的用法示例。


在下文中一共展示了CXMLNode::AttributeAsUInt方法的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>&#x2117; &amp; &#xA9; 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;
}
开发者ID:MaiTiano,项目名称:fuppes,代码行数:80,代码来源:PlaylistParser.cpp


注:本文中的CXMLNode::AttributeAsUInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。