1
I’m new to Delphi and I’m having trouble loading an XML document from a string. There is no mistake, just does not load, it makes me think I must be making some very silly mistake.
My code is this:
var
lHTTP: TIdHTTP;
Result: String;
doc: TXMLDocument;
alipay: IXMLNodeList;
begin
lHTTP := TIdHTTP.Create;
doc := TXMLDocument.Create(nil);
try
Result := lHTTP.Get('https://mapi.alipay.com/gateway.do? service=notify_verify&partner=002153¬ify_id=589654');
doc.LoadFromXML(Result);
doc.Active := True;
alipay := doc.ChildNodes;
finally
lHTTP.Free;
end;
end;
end.
Inside var Result returns XML:
<?xml version="1.0" encoding="GBK"?>'#$A'<alipay><is_success>F</is_success>
<error>ILLEGAL_PARTNER</error></alipay>
Does anyone know what’s going on?
Result:<? xml version="1.0" encoding="GBK"? >'#$A'<Alipay><is_success>F</is_success><error>ILLEGAL_PARTNER</error></Alipay>
– Debs
There is an extra space inside the URL here:
gateway.do? service=notify_verify
. I don’t think this space should be there.– Victor Stafusa