Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/124.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ XML解析器不显示信息C++;_C++_Xml_Parsing_Tinyxml2 - Fatal编程技术网

C++ XML解析器不显示信息C++;

C++ XML解析器不显示信息C++;,c++,xml,parsing,tinyxml2,C++,Xml,Parsing,Tinyxml2,我正在使用TinyXML2,我遇到了一些奇怪的问题。所以这似乎是可行的,因为我没有任何崩溃,但当我想输出我得到的一个值时,我什么都没有,如果有人知道为什么? 我已经使用了tinyxml2,它可以正常工作,但是这里的XML可能很奇怪 #include <iostream> #include "tinyxml2/tinyxml2.cpp" #include "../Inc/classConfigCtx.h" #include "../In

我正在使用TinyXML2,我遇到了一些奇怪的问题。所以这似乎是可行的,因为我没有任何崩溃,但当我想输出我得到的一个值时,我什么都没有,如果有人知道为什么? 我已经使用了tinyxml2,它可以正常工作,但是这里的XML可能很奇怪

#include <iostream>
#include "tinyxml2/tinyxml2.cpp"
#include "../Inc/classConfigCtx.h"
#include "../Inc/globalDefine.h"


using namespace tinyxml2;
int main() {
    std::cout << "Hello World!";
    XMLDocument doc;
    doc.LoadFile( "NetworkConfig.xml" );
    int AppliMsgPort_;
    const char * portAppli;
    const char * IPtemp;

    XMLElement * pRootElement =doc.RootElement()->FirstChildElement();
    portAppli=pRootElement->FirstChildElement()->GetText();

    std::cout<<portAppli;

    return 0;
}
#包括
#包括“tinyxml2/tinyxml2.cpp”
#包括“./Inc/classConfigCtx.h”
#包括“./Inc/globalDefine.h”
使用名称空间tinyxml2;
int main(){
std::cout FirstChildElement();
portAppli=ProoteElement->FirstChildElement()->GetText();

std::cout该代码工作正常-您的示例XML文件中没有文本!您到底想访问什么?Hello@KenY-N谢谢您的回答,我想获取两行的端口和ip:)但我的代码工作正常,但我不能显示任何内容当我运行此代码时,我只获取Hello Words,然后您需要API。是的,您真是个杀手呃,谢谢@KenY-N,我该如何结束这个话题?@KenY-N你为什么不把你的评论充实起来,作为一个实际的答案呢?这会让我们更清楚地知道找到了解决方案。
<configuration>

<operational_00001000><name value="100.CBD" /><radio_1><type value="Net" /><ip value="10.36.1.1" /><port_s value="50010" /><port_r value="50100" /><radioID value="10040" /></radio_1></operational_00001000>

<operational_00001005><name value="100.LOG" /><radio_1><type value="Net" /><ip value="10.26.2.1" /><port_s value="50000" /><port_r value="50000" /><radioID value="1000005" /></radio_1></operational_00001005>
</configuration>