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


C++ TiXmlNode::ValueStr方法代码示例

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


在下文中一共展示了TiXmlNode::ValueStr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Parse

MSBInfoPage* MSBInfo::Parse(TiXmlNode* page)
{
	if (page)
	{
		_page = new MSBInfoPage();

		TiXmlNode* child = 0;
		TiXmlNode* root = page;
		TiXmlElement* pageElement = page->ToElement();
		
		if (pageElement)
		{
			_page->EID = pageElement->Attribute("eid");
			_page->Category = pageElement->Attribute("category");
			_page->Type = pageElement->Attribute("type");
			_page->NodeName = pageElement->Attribute("nodeName");

			TiXmlNode* title = page->FirstChild("title");
			if (title)
				_page->Title = title->ToElement()->GetText();
			else
				Core::Dbg->Log(Warning, "No title node found");
		}
		else
			Core::Dbg->Log(Warning, "Page node not accessible");
		pageElement = 0;

		// Navigate to the 'background' part while adding skills
		while((child = root->IterateChildren(child)))
		{
			if (child->ValueStr().compare("skill") == 0)
			{
				TiXmlElement* skillelement = child->ToElement();
				if (skillelement)
				{
					Skill* sk = new Skill();
					sk->ID = skillelement->Attribute("kid");
					sk->Name = skillelement->GetText();
					_page->Skills.push_back(sk);
				}
				else
					Core::Dbg->Log(Warning, "Conversion error in Skill node");
			}
			if (child->ValueStr().compare("backgroundInfo") == 0)
			{
				// Handle background node
				XMLProcessBackground(child);
			}
		}
	
	}
	else
		Core::Dbg->Log(Warning, "XML parse error, no page element found");

	return _page;
}
开发者ID:rpheuts,项目名称:PSPFramework,代码行数:56,代码来源:msbinfo.cpp

示例2: Load

bool CSmartPlaylistRule::Load(TiXmlElement *element, const CStdString &encoding /* = "UTF-8" */)
{
  if (element == NULL)
    return false;

  // format is:
  // <rule field="Genre" operator="contains">parameter</rule>
  // where parameter can either be a string or a list of
  // <value> tags containing a string
  const char *field = element->Attribute("field");
  const char *oper = element->Attribute("operator");
  TiXmlNode *parameter = element->FirstChild();
  if (field == NULL || oper == NULL || parameter == NULL)
    return false;

  if (parameter->Type() == TiXmlNode::TINYXML_TEXT)
  {
    CStdString utf8Parameter;
    if (encoding.IsEmpty()) // utf8
      utf8Parameter = parameter->ValueStr();
    else
      g_charsetConverter.stringCharsetToUtf8(encoding, parameter->ValueStr(), utf8Parameter);

    if (!utf8Parameter.empty())
      m_parameter.push_back(utf8Parameter);
  }
  else if (parameter->Type() == TiXmlNode::TINYXML_ELEMENT)
  {
    TiXmlElement *valueElem = element->FirstChildElement("value");
    while (valueElem != NULL)
    {
      TiXmlNode *value = valueElem->FirstChild();
      if (value != NULL && value->Type() == TiXmlNode::TINYXML_TEXT)
      {
        CStdString utf8Parameter;
        if (encoding.IsEmpty()) // utf8
          utf8Parameter = value->ValueStr();
        else
          g_charsetConverter.stringCharsetToUtf8(encoding, value->ValueStr(), utf8Parameter);

        if (!utf8Parameter.empty())
          m_parameter.push_back(utf8Parameter);
      }

      valueElem = valueElem->NextSiblingElement("value");
    }
  }
  else
    return false;

  m_field = TranslateField(field);
  m_operator = TranslateOperator(oper);
  return true;
}
开发者ID:mindcorrosive,项目名称:xbmc,代码行数:54,代码来源:SmartPlayList.cpp

示例3: Parse

bool BXBoxeeServices::Parse()
{
    TiXmlHandle docHandle(&m_doc);
    TiXmlNode* pTSChild = docHandle.FirstChild("services").FirstChild("timestamp").FirstChild().Node();

    if (pTSChild)
    {
        m_timestamp = atoi(pTSChild->Value());
    }

    TiXmlElement *pChild = docHandle.FirstChild("services").Element();
    if (!pChild)
    {
        LOG(LOG_LEVEL_ERROR,"BXBoxeeServices::Parse - FAILED to find <applications> node");
        return false;
    }

    m_services.clear();

    TiXmlNode *pMsgNode = 0;
    while ((pMsgNode = pChild->IterateChildren(pMsgNode)) != NULL)
    {
        if (pMsgNode->ValueStr().compare("object") == 0)
        {
            BXObject obj;
            if (obj.FromXML(pMsgNode))
            {
                m_services.push_back(obj);
            }
        }
    }

    return true;
}
开发者ID:sd-eblana,项目名称:bawx,代码行数:34,代码来源:bxboxeeservices.cpp

示例4: LoadAlbumsInfo

bool CMetadataResolverMusic::LoadAlbumsInfo(BOXEE::BXXMLDocument& doc, vectorMetadata& list)
{
  TiXmlElement* pRootElement = doc.GetDocument().RootElement();
  bool bRetVal = true;
  if (pRootElement->ValueStr() == "results")
  {
    TiXmlNode* pTag = 0;
    BXMetadata album(MEDIA_ITEM_TYPE_AUDIO);

    while ((pTag = pRootElement->IterateChildren(pTag)))
    {
      if (pTag && pTag->ValueStr() == "album")
      {
        TiXmlElement* pValue = pTag->FirstChildElement();

        if (pValue && (LoadAlbumInfo(pValue,album)))
          list.push_back(album);
        else
           bRetVal = false;
      }
      else
        bRetVal = false;
    }
  }
  else
    bRetVal = false;

  return bRetVal;
}
开发者ID:sd-eblana,项目名称:bawx,代码行数:29,代码来源:MetadataResolverMusic.cpp

示例5: ParseBiLink

//<BiLink>
void LibraryParser::ParseBiLink(TiXmlNode* pParent) {
	GetBiLinkAttributes(pParent ) ;
	TiXmlNode* Child;
	string Elem;
	BiLink L;
	int Lcount = 0;
	for (Child = pParent->FirstChild() ; Child != 0; Child
			= Child->NextSibling() ) {
		Elem = Child->ValueStr() ;
		if (Elem == "Link") {
			ParseLink(Child ) ;
			if (Lcount == 0) {
				L.L1(mCurrentLink) ;
				Lcount++;
			} else if (Lcount==1) {
				L.L2(mCurrentLink) ;
			}
		} else {
			cout << "Unknown XML element "<< Elem << " in file "<< mFname
					<< endl ;
		}

	}
	mCurrentBiLink = L ;
	mLib->AddBiLink(mCurrentBiLink) ;
}
开发者ID:alessandro-pinto,项目名称:commsynth,代码行数:27,代码来源:LibraryParser.cpp

示例6: Parse

bool BXBoxeeWebFavorites::Parse()
{
  TiXmlHandle docHandle(&m_doc);

  TiXmlElement *pChild = docHandle.FirstChild("bookmarks").Element();
  if (!pChild)
  {
    LOG(LOG_LEVEL_ERROR,"BXBoxeeWebFavorites::Parse - FAILED to find <bookmark> node");
    return false;
  }

  m_webFavorites.clear();

  TiXmlNode *pMsgNode = 0;
  while ((pMsgNode = pChild->IterateChildren(pMsgNode)) != NULL)
  {
    if (pMsgNode->ValueStr().compare("bookmark") == 0)
    {
      BXObject obj;
      if (obj.FromXML(pMsgNode))
      {
        m_webFavorites.push_back(obj);
      }
    }
  }

  return true;
}
开发者ID:flyingtime,项目名称:boxee,代码行数:28,代码来源:bxboxeewebfavorites.cpp

示例7: ResolveParametersForNode

void CGUIIncludes::ResolveParametersForNode(TiXmlElement *node, const Params& params)
{
  if (!node)
    return;
  std::string newValue;
  // run through this element's attributes, resolving any parameters
  TiXmlAttribute *attribute = node->FirstAttribute();
  while (attribute)
  {
    ResolveParamsResult result = ResolveParameters(attribute->ValueStr(), newValue, params);
    if (result == SINGLE_UNDEFINED_PARAM_RESOLVED && strcmp(node->Value(), "param") == 0 &&
        strcmp(attribute->Name(), "value") == 0 && node->Parent() && strcmp(node->Parent()->Value(), "include") == 0)
    {
      // special case: passing <param name="someName" value="$PARAM[undefinedParam]" /> to the nested include
      // this usually happens when trying to forward a missing parameter from the enclosing include to the nested include
      // problem: since 'undefinedParam' is not defined, it expands to <param name="someName" value="" /> and overrides any default value set with <param name="someName" default="someValue" /> in the nested include
      // to prevent this, we'll completely remove this parameter from the nested include call so that the default value can be correctly picked up later
      node->Parent()->RemoveChild(node);
      return;
    }
    else if (result != NO_PARAMS_FOUND)
      attribute->SetValue(newValue);
    attribute = attribute->Next();
  }
  // run through this element's value and children, resolving any parameters
  TiXmlNode *child = node->FirstChild();
  if (child)
  {
    if (child->Type() == TiXmlNode::TINYXML_TEXT)
    {
      ResolveParamsResult result = ResolveParameters(child->ValueStr(), newValue, params);
      if (result == SINGLE_UNDEFINED_PARAM_RESOLVED && strcmp(node->Value(), "param") == 0 &&
          node->Parent() && strcmp(node->Parent()->Value(), "include") == 0)
      {
        // special case: passing <param name="someName">$PARAM[undefinedParam]</param> to the nested include
        // we'll remove the offending param tag same as above
        node->Parent()->RemoveChild(node);
      }
      else if (result != NO_PARAMS_FOUND)
        child->SetValue(newValue);
    }
    else if (child->Type() == TiXmlNode::TINYXML_ELEMENT)
    {
      do
      {
        TiXmlElement *next = child->NextSiblingElement();   // save next as current child might be removed from the tree
        ResolveParametersForNode(static_cast<TiXmlElement *>(child), params);
        child = next;
      }
      while (child);
    }
  }
}
开发者ID:AchimTuran,项目名称:xbmc,代码行数:53,代码来源:GUIIncludes.cpp

示例8: XMLProcessBackground

void MSBInfo::XMLProcessBackground(TiXmlNode* bg)
{
	if (bg)
	{
		TiXmlNode* child = 0;
		_page->Text = "";
		while((child = bg->IterateChildren(child)))
		{
			if (child->ValueStr().compare("avobject") == 0)
			{
				TiXmlElement* av = child->ToElement();
				_page->Image = av->Attribute("filename");
			}
			if (child->ValueStr().compare("txt") == 0)
			{
				TiXmlElement* txt = child->ToElement();
				_page->Text += txt->GetText();
			}
		}
	}
	else
		Core::Dbg->Log(Warning, "NULL value passed to utterance node handler");
}
开发者ID:rpheuts,项目名称:PSPFramework,代码行数:23,代码来源:msbinfo.cpp

示例9: while

void
XmlPrototypesFile::LoadPrototypes()
{
    TiXmlNode* node = m_File.RootElement();

    if( node == NULL || node->ValueStr() != "prototypes" )
    {
        LOG_ERROR( "UI Manager: " + m_File.ValueStr() + " is not a valid prototypes file! No <prototypes> in root." );
        return;
    }

    node = node->FirstChild();
    while( node != NULL )
    {
        if( node->Type() == TiXmlNode::TINYXML_ELEMENT && node->ValueStr() == "prototype" )
        {
            Ogre::String name = GetString( node, "name" );
            UiManager::getSingleton().AddPrototype( name, node->Clone() );
        }

        node = node->NextSibling();
    }
}
开发者ID:DeejStar,项目名称:q-gears,代码行数:23,代码来源:XmlPrototypesFile.cpp

示例10: ParseInterface

//<Interface>
void LibraryParser::ParseInterface(TiXmlNode* pParent) {
	GetInterfaceAttributes(pParent ) ;
	TiXmlNode* Child;
	string Elem;
	for (Child = pParent->FirstChild() ; Child != 0; Child
			= Child->NextSibling() ) {
		Elem = Child->ValueStr() ;
		if (Elem == "") {
			Parse(Child ) ;
		} else {
			cout << "Unknown XML element "<< Elem << " in file "<< mFname
					<< endl ;
		}
	}
}
开发者ID:alessandro-pinto,项目名称:commsynth,代码行数:16,代码来源:LibraryParser.cpp

示例11: GetString

const Ogre::String
XmlMapFile::GetWalkmeshFileName()
{
    TiXmlNode* node = m_File.RootElement();

    if( node == NULL || node->ValueStr() != "map" )
    {
        LOG_ERROR( "Field Map XML Manager: " + m_File.ValueStr() + " is not a valid fields map file! No <map> in root." );
        return "";
    }

    node = node->FirstChild();
    while( node != NULL )
    {
        if( node->Type() == TiXmlNode::TINYXML_ELEMENT && node->ValueStr() == "walkmesh" )
        {
            return GetString( node, "file_name" );
        }
        node = node->NextSibling();
    }

    LOG_WARNING( "Can't find field's walkmesh in " + m_File.ValueStr() + "." );
    return "";
}
开发者ID:DeejStar,项目名称:q-gears,代码行数:24,代码来源:XmlMapFile.cpp

示例12: ParseLibrary

//<Library>
void LibraryParser::ParseLibrary(TiXmlNode* pParent) {
	cerr << "Parsing the Library "<< endl ;
	GetLibraryAttributes(pParent ) ;
	TiXmlNode* Child;
	string Elem;
	for (Child = pParent->FirstChild() ; Child != 0; Child
			= Child->NextSibling() ) {
		Elem = Child->ValueStr() ;
		if (Elem == "Node") {
			ParseNode(Child ) ;
		} else if (Elem == "Link") {
			ParseLink(Child ) ;
		} else if (Elem == "BiLink") {
			ParseBiLink(Child ) ;
		} else {
			cout << "Unknown XML element "<< Elem<< " in file "<< mFname<< endl ;
		}
	}
}
开发者ID:alessandro-pinto,项目名称:commsynth,代码行数:20,代码来源:LibraryParser.cpp

示例13: ParseLink

//<Link>
void LibraryParser::ParseLink(TiXmlNode* pParent) {
	GetLinkAttributes(pParent ) ;
	TiXmlNode* Child;
	string Elem;
	for (Child = pParent->FirstChild() ; Child != 0; Child
			= Child->NextSibling() ) {
		Elem = Child->ValueStr() ;
		if (Elem == "Source") {
			ParseLinkSource(Child ) ;
		} else if (Elem == "Dest") {
			ParseLinkDest(Child ) ;
		} else {
			cout << "Unknown XML element "<< Elem << " in file "<< mFname
					<< endl ;
		}
	}
	//Add link to the library
	mLib->AddLink(mCurrentLink) ;
}
开发者ID:alessandro-pinto,项目名称:commsynth,代码行数:20,代码来源:LibraryParser.cpp

示例14: ParseDocument

void LibraryParser::ParseDocument(TiXmlNode* pParent) {
	if ( !pParent )
		return;

	int Type = pParent->Type() ;
	string Elem;

	if (Type == TiXmlNode::DOCUMENT ) {
		cout << "Parsing the library from file  "<< mFname << endl ;
		TiXmlNode* Child;
		for (Child = pParent->FirstChild() ; Child != 0; Child
				= Child->NextSibling() ) {
			Elem = Child->ValueStr() ;
			if (Elem == "Library")
				ParseLibrary(Child ) ;
		}
	} else {
		cout << "The document should be parsed..."<< endl ;
	}
	return;
}
开发者ID:alessandro-pinto,项目名称:commsynth,代码行数:21,代码来源:LibraryParser.cpp

示例15: Test

bool CXBMCTinyXML::Test()
{
  // scraper results with unescaped &
  CXBMCTinyXML doc;
  CStdString data("<details><url function=\"ParseTMDBRating\" "
                  "cache=\"tmdb-en-12244.json\">"
                  "http://api.themoviedb.org/3/movie/12244"
                  "?api_key=57983e31fb435df4df77afb854740ea9"
                  "&language=en&#x3f;&#x003F;&#0063;</url></details>");
  doc.Parse(data.c_str());
  TiXmlNode *root = doc.RootElement();
  if (root && root->ValueStr() == "details")
  {
    TiXmlElement *url = root->FirstChildElement("url");
    if (url && url->FirstChild())
    {
      return (url->FirstChild()->ValueStr() == "http://api.themoviedb.org/3/movie/12244?api_key=57983e31fb435df4df77afb854740ea9&language=en???");
    }
  }
  return false;
}
开发者ID:jmarshallnz,项目名称:xbmc-database-4.0,代码行数:21,代码来源:XBMCTinyXML.cpp


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