本文整理汇总了C++中TiXmlNode::NextSibling方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlNode::NextSibling方法的具体用法?C++ TiXmlNode::NextSibling怎么用?C++ TiXmlNode::NextSibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlNode
的用法示例。
在下文中一共展示了TiXmlNode::NextSibling方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
SipRedirectorJoin::textContentDeepRecursive(UtlString& string,
TiXmlElement *element)
{
// Iterate through all the children.
for (TiXmlNode* child = element->FirstChild(); child;
child = child->NextSibling())
{
// Examine the text nodes.
if (child->Type() == TiXmlNode::TEXT)
{
// Append the content to the string.
string.append(child->Value());
}
else if (child->Type() == TiXmlNode::ELEMENT)
{
// Recurse on this element.
textContentDeepRecursive(string, child->ToElement());
}
}
}
示例2: CopyTo
void TiXmlElement::CopyTo( TiXmlElement* target ) const
{
// superclass:
TiXmlNode::CopyTo( target );
// Element class:
// Clone the attributes, then clone the children.
const TiXmlAttribute* attribute = 0;
for( attribute = attributeSet.First();
attribute;
attribute = attribute->Next() )
{
target->SetAttribute( attribute->Name(), attribute->Value() );
}
TiXmlNode* node = 0;
for ( node = firstChild; node; node = node->NextSibling() )
{
target->LinkEndChild( node->Clone() );
}
}
示例3: Load
void tPlayer::Load()
{
TiXmlDocument xmlDoc( (PLAYER_DIR + playername + PLAYER_EXT).c_str() );
TiXmlElement *xmlePlr;
TiXmlNode *node = 0;
bool loadOkay = xmlDoc.LoadFile();
if( loadOkay )
{
TiXmlHandle xmlDocHandle( &xmlDoc );
xmlePlr = xmlDocHandle.FirstChild( "player" ).Element();
if( xmlePlr != NULL )
{
password = xmlePlr->Attribute( "password" );
room = atoi( xmlePlr->Attribute( "room" ) );
for( node = xmlePlr->FirstChild( "flags" )->FirstChild( "flag" );
node;
node = node->NextSibling( "flag" ) )
{
flags.insert( node->ToElement()->GetText() );
}
node = xmlePlr->FirstChild( "stats" );
if( node )
{
maxhp = atoi( node->FirstChild( "maxHP" )->FirstChild()->Value() );
curhp = atoi( node->FirstChild( "curHP" )->FirstChild()->Value() );
baseskl = atoi( node->FirstChild( "baseSkill" )->FirstChild()->Value() );
}
else
throw runtime_error( "Player data corrupt, please contact an admin for assistance" );
}
}
else
throw runtime_error( "That player does not exist, type 'new' to create a new one." );
} /* end of tPlayer::Load */
示例4: geoNode
void XmlParser::geoNode(TiXmlNode* pParent) {
TiXmlNode* pChild;
for (pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) {
int t = pChild->Type();
if (t == TiXmlNode::ELEMENT) {
string element_value(pChild->Value());
if (element_value == "surface")
objects.push_back(surfaceAttrib(pChild->ToElement()));
else if (element_value == "cell")
objects.push_back(cellAttrib(pChild->ToElement()));
else if (element_value == "lattice")
objects.push_back(latticeAttrib(pChild->ToElement()));
else {
vector<string> keywords;
keywords.push_back(element_value);
throw KeywordParserError("Unrecognized geometry keyword <" + element_value + ">",keywords);
}
}
}
}
示例5: LoadXML
bool TLFSemanticImageDescriptor::LoadXML(const char* lpFileName)
{
this->Clear();
TiXmlDocument doc;
if (!doc.LoadFile(lpFileName))
return false;
TiXmlHandle hDoc(&doc);
TiXmlElement* pElem = NULL;
pElem = hDoc.FirstChildElement().Element();
if (pElem == NULL)
return false;
if (strcmp(pElem->Value(), GetName()) != 0)
return false;
int w, h;
pElem->QueryIntAttribute("ImageWidth", &w);
pElem->QueryIntAttribute("ImageHeight", &h);
for(TiXmlNode* child = pElem->FirstChild(); child; child = child->NextSibling() )
{
TLFDetectedItem* di = new TLFDetectedItem();
if (strcmp(child->Value(), di->GetName()) != 0)
{
Clear();
return false;
}
if (!di->LoadXML(child->ToElement()))
{
Clear();
return false;
}
Add(di);
}
return true;
}
示例6: LoadKeymap
bool CButtonTranslator::LoadKeymap(const CStdString &keymapPath)
{
TiXmlDocument xmlDoc;
CLog::Log(LOGINFO, "Loading %s", keymapPath.c_str());
if (!xmlDoc.LoadFile(keymapPath))
{
CLog::Log(LOGERROR, "Error loading keymap: %s, Line %d\n%s", keymapPath.c_str(), xmlDoc.ErrorRow(), xmlDoc.ErrorDesc());
return false;
}
TiXmlElement* pRoot = xmlDoc.RootElement();
CStdString strValue = pRoot->Value();
if ( strValue != "keymap")
{
CLog::Log(LOGERROR, "%s Doesn't contain <keymap>", keymapPath.c_str());
return false;
}
// run through our window groups
TiXmlNode* pWindow = pRoot->FirstChild();
while (pWindow)
{
if (pWindow->Type() == TiXmlNode::ELEMENT)
{
int windowID = WINDOW_INVALID;
const char *szWindow = pWindow->Value();
if (szWindow)
{
if (strcmpi(szWindow, "global") == 0)
windowID = -1;
else
windowID = TranslateWindow(szWindow);
}
MapWindowActions(pWindow, windowID);
}
pWindow = pWindow->NextSibling();
}
return true;
}
示例7: read
void Triangle::read(TiXmlNode* node)
{
String materialName;
TiXMLHelper::GetAttribute(node, "materialName", &materialName);
material = resourceManager.getMaterial(materialName);
TiXmlNode* vertexInfosNode = node->FirstChild("vertexInfos");
assert(vertexInfosNode);
TiXmlNode* vertexInfoNode = vertexInfosNode->FirstChild("vertexInfo");
int vertexIndex = 0;
while (vertexInfoNode)
{
TiXMLHelper::GetAttribute(vertexInfoNode, "position", &coords[vertexIndex]);
vertexIndex++;
vertexInfoNode = vertexInfoNode->NextSibling();
}
assert(vertexIndex == 3);
recomputeNormal();
}
示例8: parsePartitioning
void XCFParser::parsePartitioning(TiXmlElement* root){
TiXmlNode* node = root->FirstChild();
while (node != NULL){
if (node->Type() == TiXmlNode::TINYXML_ELEMENT) {
TiXmlElement* element = (TiXmlElement*)node;
TiXmlString name(node->Value());
if (name == XCFMapping::PARTITIONING) {
parsePartitioning(element);
}else if (name == XCFMapping::PARTITION) {
parsePartition(element);
}else {
cerr << "Invalid node "<< name.c_str() << endl;
exit(1);
}
}
node = node->NextSibling();
}
}
示例9: LoadLircMap
bool CButtonTranslator::LoadLircMap()
{
// load our xml file, and fill up our mapping tables
TiXmlDocument xmlDoc;
// Load the config file
CStdString lircmapPath = g_settings.GetUserDataItem("Lircmap.xml");
CLog::Log(LOGINFO, "Loading %s", lircmapPath.c_str());
if (!xmlDoc.LoadFile(lircmapPath))
{
g_LoadErrorStr.Format("%s, Line %d\n%s", lircmapPath.c_str(), xmlDoc.ErrorRow(), xmlDoc.ErrorDesc());
return true; // This is so people who don't have the file won't fail, just warn
}
lircRemotesMap.clear();
TiXmlElement* pRoot = xmlDoc.RootElement();
CStdString strValue = pRoot->Value();
if (strValue != "lircmap")
{
g_LoadErrorStr.Format("%sl Doesn't contain <lircmap>", lircmapPath.c_str());
return false;
}
// run through our window groups
TiXmlNode* pRemote = pRoot->FirstChild();
while (pRemote)
{
const char *szRemote = pRemote->Value();
if (szRemote)
{
TiXmlAttribute* pAttr = pRemote->ToElement()->FirstAttribute();
const char* szDeviceName = pAttr->Value();
MapRemote(pRemote, szDeviceName);
}
pRemote = pRemote->NextSibling();
}
return true;
}
示例10: ProcessAndValidate
/*
* TinyXml has loaded and parsed the XML document for us. We need to
* run through the DOM tree, pull out the interesting bits, and make
* sure the stuff we need is present.
*
* Returns "true" on success, "false" on failure.
*/
bool PhoneData::ProcessAndValidate(TiXmlDocument* pDoc)
{
bool deviceFound = false;
TiXmlNode* pChild;
assert(pDoc->Type() == TiXmlNode::DOCUMENT);
for (pChild = pDoc->FirstChild(); pChild != NULL;
pChild = pChild->NextSibling())
{
/*
* Find the <device> entry. There should be exactly one.
*/
if (pChild->Type() == TiXmlNode::ELEMENT) {
if (strcasecmp(pChild->Value(), "device") != 0) {
fprintf(stderr,
"SimCFG: Warning: unexpected element '%s' at top level\n",
pChild->Value());
continue;
}
if (deviceFound) {
fprintf(stderr, "SimCFG: one <device> per customer\n");
return false;
}
bool result = ProcessDevice(pChild);
if (!result)
return false;
deviceFound = true;
}
}
if (!deviceFound) {
fprintf(stderr, "SimCFG: no <device> section found\n");
return false;
}
return true;
}
示例11: parseNewsAndGifts
void User::parseNewsAndGifts(TiXmlNode* xmlNode, Event<std::vector<UserCore::Misc::NewsItem*> > &onEvent)
{
if (!xmlNode)
return;
std::vector<UserCore::Misc::NewsItem*> itemList;
TiXmlNode* pChild = xmlNode->FirstChild();
while (pChild)
{
if (XML::isValidElement(pChild))
{
TiXmlElement *itemElem = pChild->ToElement();
const char* szId = itemElem->Attribute("id");
gcString szTitle;
gcString szUrl;
XML::GetChild("title", szTitle, itemElem);
XML::GetChild("url", szUrl, itemElem);
if (szId && szTitle != "" && szUrl != "")
{
uint32 id = (uint32)atoi(szId);
UserCore::Misc::NewsItem *temp = new UserCore::Misc::NewsItem(id, 0, szTitle.c_str(), szUrl.c_str());
itemList.push_back(temp);
}
}
pChild = pChild->NextSibling();
}
if (itemList.size() > 0)
onEvent(itemList);
safe_delete(itemList);
}
示例12: loadScene
Scene* SceneLoader::loadScene(Ogre::DataStreamPtr &data)
{
TiXmlDocument* doc = loadDocument(data);
TiXmlElement* root = doc->RootElement();
Scene* scene = new Scene(getAttributeValueAsString(root, "name"));
for (TiXmlNode* cur = root->FirstChild(); cur; cur = cur->NextSibling())
{
if (cur->Type() == TiXmlNode::ELEMENT)
{
TiXmlElement* elem = cur->ToElement();
if (hasNodeName(elem, "map"))
{
scene->addMap(getAttributeValueAsStdString(elem, "file"));
}
}
}
delete doc;
return scene;
}
示例13: init
bool WSWorld::init()
{
m_worldPopulation = 0;
if( !loadTerrain( WSApp::instance()->getSetting("/config/WorldCfg")) )
return false;
TiXmlDocument doc;
CLog::instance()->log(CLog::msgFlagResources, CLog::msgLvlInfo,__FUNCTION__, _("Loading mobs info..."));
doc.LoadFile("../data/zones/teeran/mobs.xml");
if (doc.Error())
{
CLog::instance()->log(CLog::msgFlagResources, CLog::msgLvlError,__FUNCTION__, _("XML parser returned an error: %s\n"), doc.ErrorDesc());
return false;
}
TiXmlElement* mobsxml = doc.FirstChildElement("mobs");
CWorldCharMob::setDefaults(mobsxml);
TiXmlNode* childNode;
for ( childNode = mobsxml->FirstChild(); childNode != 0; childNode = childNode->NextSibling() )
if (childNode->Type() == TiXmlNode::ELEMENT)
if (!strcmp(childNode->Value(), "mob"))
// {
insertEntity(WSEntityPtr(new CWorldCharMob(getNewEntityID(), childNode->ToElement())));
// CharMobPtr mob(new CWorldCharMob(childNode->ToElement()));
// insertCharMob(mob);
// }
else if (!strcmp(childNode->Value(), "flock"))
// {
insertEntity(WSEntityPtr(new CMobFlock(getNewEntityID(), childNode->ToElement())));
// MobFlockPtr flock(new CMobFlock(childNode->ToElement()));
// m_flocks.push_back(flock);
// }
CLog::instance()->log(CLog::msgFlagResources, CLog::msgLvlInfo,__FUNCTION__, _("WSWorld.init: Done."));
return true;
};
示例14: SetResPkgFindPath
void CLocalPathBrowser::SetResPkgFindPath()
{
char* aliasArray[] = {"cfg","gui","res","lan","shd"};
int num = sizeof(aliasArray)/sizeof(char*);
list<string> lstPath;
//载入配置文件
CEditorConfig::GetInst()->InitEditorConfig();
//加入PathBrowser里面设置的路径
TiXmlNode* pConfig_xml = CEditorConfig::GetInst()->GetEditorConfig(st_szCtrlType);
for( TiXmlNode* pNode = pConfig_xml->FirstChild("Path"); pNode; pNode = pNode->NextSibling("Path") )
{
TiXmlElement* pElem = pNode->ToElement();
if(pElem && pElem->GetText())
{
string strText = pElem->GetText();
lstPath.push_back(strText);
}
}
//lstPath.push_back("F:/company/ybtx/artist/resbin");
for ( list<string>::iterator iter = lstPath.begin(); iter != lstPath.end(); ++iter )
{
for (int i=0;i<num;++i)
{
string path = *iter;
string pathLan = *iter + "/lang";
string pathRes = *iter + "/res";
string strTemp = aliasArray[i];
wstring wstrTemp = gbk_to_utf16(strTemp);
CPkgFile::AddLoadPath(wstrTemp.c_str(), gbk_to_utf16(path).c_str());
CPkgFile::AddLoadPath(wstrTemp.c_str(), gbk_to_utf16(pathLan).c_str());
CPkgFile::AddLoadPath(wstrTemp.c_str(), gbk_to_utf16(pathRes).c_str());
}
}
}
示例15: 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();
}
}