本文整理汇总了C++中TiXmlAttribute::SetName方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlAttribute::SetName方法的具体用法?C++ TiXmlAttribute::SetName怎么用?C++ TiXmlAttribute::SetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlAttribute
的用法示例。
在下文中一共展示了TiXmlAttribute::SetName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindOrCreate
TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const char* _name )
{
TiXmlAttribute* attrib = Find( _name );
if ( !attrib ) {
attrib = new TiXmlAttribute();
Add( attrib );
attrib->SetName( _name );
}
return attrib;
}
示例2: LoadData
bool CPlayListASX::LoadData(istream& stream)
{
CLog::Log(LOGNOTICE, "Parsing ASX");
if(stream.peek() == '[')
{
return LoadAsxIniInfo(stream);
}
else
{
CXBMCTinyXML xmlDoc;
stream >> xmlDoc;
if (xmlDoc.Error())
{
CLog::Log(LOGERROR, "Unable to parse ASX info Error: %s", xmlDoc.ErrorDesc());
return false;
}
TiXmlElement *pRootElement = xmlDoc.RootElement();
// lowercase every element
TiXmlNode *pNode = pRootElement;
TiXmlNode *pChild = NULL;
CStdString value;
value = pNode->Value();
value.ToLower();
pNode->SetValue(value);
while(pNode)
{
pChild = pNode->IterateChildren(pChild);
if(pChild)
{
if (pChild->Type() == TiXmlNode::TINYXML_ELEMENT)
{
value = pChild->Value();
value.ToLower();
pChild->SetValue(value);
TiXmlAttribute* pAttr = pChild->ToElement()->FirstAttribute();
while(pAttr)
{
value = pAttr->Name();
value.ToLower();
pAttr->SetName(value);
pAttr = pAttr->Next();
}
}
pNode = pChild;
pChild = NULL;
continue;
}
pChild = pNode;
pNode = pNode->Parent();
}
CStdString roottitle = "";
TiXmlElement *pElement = pRootElement->FirstChildElement();
while (pElement)
{
value = pElement->Value();
if (value == "title")
{
roottitle = pElement->GetText();
}
else if (value == "entry")
{
CStdString title(roottitle);
TiXmlElement *pRef = pElement->FirstChildElement("ref");
TiXmlElement *pTitle = pElement->FirstChildElement("title");
if(pTitle)
title = pTitle->GetText();
while (pRef)
{ // multiple references may apear for one entry
// duration may exist on this level too
value = pRef->Attribute("href");
if (value != "")
{
if(title.IsEmpty())
title = value;
CLog::Log(LOGINFO, "Adding element %s, %s", title.c_str(), value.c_str());
CFileItemPtr newItem(new CFileItem(title));
newItem->SetPath(value);
Add(newItem);
}
pRef = pRef->NextSiblingElement("ref");
}
}
else if (value == "entryref")
{
value = pElement->Attribute("href");
if (value != "")
{ // found an entryref, let's try loading that url
auto_ptr<CPlayList> playlist(CPlayListFactory::Create(value));
if (NULL != playlist.get())
//.........这里部分代码省略.........