本文整理汇总了C++中TiXmlDocument::Row方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlDocument::Row方法的具体用法?C++ TiXmlDocument::Row怎么用?C++ TiXmlDocument::Row使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlDocument
的用法示例。
在下文中一共展示了TiXmlDocument::Row方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: yDebug
RobotInterface::Robot& RobotInterface::XMLReader::Private::readRobotFile(const std::string &fileName)
{
filename = fileName;
#ifdef WIN32
std::replace(filename.begin(), filename.end(), '/', '\\');
#endif
curr_filename = fileName;
#ifdef WIN32
path = filename.substr(0, filename.rfind("\\"));
#else // WIN32
path = filename.substr(0, filename.rfind("/"));
#endif //WIN32
yDebug() << "Reading file" << filename.c_str();
TiXmlDocument *doc = new TiXmlDocument(filename.c_str());
if (!doc->LoadFile()) {
SYNTAX_ERROR(doc->ErrorRow()) << doc->ErrorDesc();
}
if (!doc->RootElement()) {
SYNTAX_ERROR(doc->Row()) << "No root element.";
}
for (TiXmlNode* childNode = doc->FirstChild(); childNode != 0; childNode = childNode->NextSibling()) {
if (childNode->Type() == TiXmlNode::TINYXML_UNKNOWN) {
if(dtd.parse(childNode->ToUnknown(), curr_filename)) {
break;
}
}
}
if (!dtd.valid()) {
SYNTAX_WARNING(doc->Row()) << "No DTD found. Assuming version robotInterfaceV1.0";
dtd.setDefault();
dtd.type = RobotInterfaceDTD::DocTypeRobot;
}
if(dtd.type != RobotInterfaceDTD::DocTypeRobot) {
SYNTAX_WARNING(doc->Row()) << "Expected document of type" << DocTypeToString(RobotInterfaceDTD::DocTypeRobot)
<< ". Found" << DocTypeToString(dtd.type);
}
if(dtd.majorVersion != 1 || dtd.minorVersion != 0) {
SYNTAX_WARNING(doc->Row()) << "Only robotInterface DTD version 1.0 is supported";
}
readRobotTag(doc->RootElement());
delete doc;
// yDebug() << robot;
return robot;
}
示例2: LoadFavourites
bool CFavourites::LoadFavourites(CStdString& strPath, CFileItemList& items)
{
TiXmlDocument doc;
if (!doc.LoadFile(strPath))
{
CLog::Log(LOGERROR, "Unable to load %s (row %i column %i)", strPath.c_str(), doc.Row(), doc.Column());
return false;
}
TiXmlElement *root = doc.RootElement();
if (!root || strcmp(root->Value(), "favourites"))
{
CLog::Log(LOGERROR, "Favourites.xml doesn't contain the <favourites> root element");
return false;
}
TiXmlElement *favourite = root->FirstChildElement("favourite");
while (favourite)
{
// format:
// <favourite name="Cool Video" thumb="foo.jpg">PlayMedia(c:\videos\cool_video.avi)</favourite>
// <favourite name="My Album" thumb="bar.tbn">ActivateWindow(MyMusic,c:\music\my album)</favourite>
// <favourite name="Apple Movie Trailers" thumb="path_to_thumb.png">RunScript(special://xbmc/scripts/apple movie trailers/default.py)</favourite>
const char *name = favourite->Attribute("name");
const char *thumb = favourite->Attribute("thumb");
if (name && favourite->FirstChild())
{
if(!items.Contains(favourite->FirstChild()->Value()))
{
CFileItemPtr item(new CFileItem(name));
item->m_strPath = favourite->FirstChild()->Value();
if (thumb) item->SetThumbnailImage(thumb);
items.Add(item);
}
}
favourite = favourite->NextSiblingElement("favourite");
}
return true;
}