13,825
社区成员
发帖
与我相关
我的任务
分享
TStringList *Request = new TStringList();
TXMLDocument *XMLReader=new TXMLDocument("");
TStringStream* stream=new TStringStream("");
Request->Text= "<config><user mobile-no=\"13877124588\" /><client type=\"PC\" version=\"3.3.0370\" platform=\"W5.1\" /><servers version=\"0\" /><service-no version=\"37\" /></config>";
IdHTTP1->Post("http://nav.fetion.com.cn/nav/getsystemconfig.aspx", Request,stream);
XMLReader->LoadFromStream(stream);//能正确取到xml文件
XMLReader->Active = True;
ExploreNode(XMLReader->Node);//遍历xml所有节点,报内存错,
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1:: ExploreNode(IXMLNode *aNode)
{
String FSIPCServer,FSIPCPort,FSSISignInURL,FGetUriURL;
if(aNode->NodeName ==(WideString) "sipc-proxy")
if(aNode->IsTextElement)
{
if(!aNode->Text.Pos(":"))
FSIPCServer=aNode->Text;
else
{
FSIPCServer =aNode->Text.SubString(1,aNode->Text.Pos(":")-1);
FSIPCPort = StrToIntDef(aNode->Text.SubString(aNode->Text.Pos(":")+1,aNode->Text.Length()),9090);
}
}
if(aNode->NodeName==(WideString)"ssi-app-sign-in")
if(aNode->IsTextElement)
FSSISignInURL= aNode->Text;
if(aNode->NodeName==(WideString)"get-uri")
if(aNode->IsTextElement)
FGetUriURL= aNode->Text;
for(int i=0;i<aNode->ChildNodes->Count;i++)
ExploreNode(aNode->ChildNodes->Nodes[i]);
}
for(int i=0;i<aNode->ChildNodes->Count;i++)
ExploreNode(aNode->ChildNodes->Nodes[i]);
//改为下面试试
for ( I = 0 ;I< aNode->ChildNodes->Count ;I++ )
{
ExploreNode(aNode->ChildNodes->Get(I));
}