本文整理汇总了C++中TiXmlNode::ToUnknown方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlNode::ToUnknown方法的具体用法?C++ TiXmlNode::ToUnknown怎么用?C++ TiXmlNode::ToUnknown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlNode
的用法示例。
在下文中一共展示了TiXmlNode::ToUnknown方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}