【发布时间】:2020-09-23 14:57:45
【问题描述】:
Progress4GL 开发人员您好,
在对 UPS 进行成功的 SOAP 调用后,我将以下 XML 响应存储在名为 cBody 的 longchar 变量中:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<trk:TrackResponse xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:trk="http://www.ups.com/XMLSchema/XOLTWS/Track/v2.0">
<common:Response xmlns:common="http://www.ups.com/XMLSchema/XOLTWS/Common/v1.0">
<common:ResponseStatus>
<common:Code>1</common:Code>
<common:Description>Success</common:Description>
</common:ResponseStatus>
<common:TransactionReference/>
</common:Response>
<trk:Shipment>
<trk:InquiryNumber>
<trk:Code>01</trk:Code>
<trk:Description>ShipmentIdentificationNumber</trk:Description>
<trk:Value>MYTRACKERNUMBER</trk:Value>
</trk:InquiryNumber>
...
我现在使用以下代码行将其存储为 X-DOCUMENT:
hDoc:LOAD("longchar",cBody2,FALSE).
现在我想检查我的回复是否有跟踪号,如果有,我想将跟踪号存储为变量。看来这是可能的: https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/dvxml/examples-of-reading-an-input-xml-file.html
但是,这是我到目前为止所拥有的,而且它似乎不起作用。什么都没有输出,但没有运行时错误:
....
hDoc:LOAD("longchar",cBody,FALSE).
DEFINE variable hNodeRef as HANDLE NO-UNDO.
CREATE X-NODEREF hNodeRef.
hDoc:GET-DOCUMENT-ELEMENT(hNodeRef).
IF hNodeRef:NAME = "trk:value" THEN
message hNoderef:GET-ATTRIBUTE("id") hNoderef:ATTRIBUTE-NAMES.
....
【问题讨论】:
标签: xml openedge progress-4gl