我收到如下回應:如何使用腳本斷言提取CDATA?
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetUKLocationByPostCodeResponse xmlns="http://www.webserviceX.NET">
<GetUKLocationByPostCodeResult><![CDATA[<NewDataSet>
<Table>
<Town>Grangetown</Town>
<County>Cardiff</County>
<PostCode>CF1</PostCode>
</Table>
<Table>
<Town>Leckwith</Town>
<County>Vale of Glamorgan</County>
<PostCode>CF1</PostCode>
</Table>
<Table>
<Town>Canton</Town>
<County>Cardiff</County>
<PostCode>CF1</PostCode>
</Table>
<Table>
<Town>Cardiff</Town>
<County>Cardiff</County>
<PostCode>CF1</PostCode>
</Table>
</NewDataSet>]]></GetUKLocationByPostCodeResult>
</GetUKLocationByPostCodeResponse>
</soap:Body>
</soap:Envelope>
我能夠提取的鎮,縣,郵編使用屬性轉移..
但是,如何提取使用相同的腳本斷言..
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context);
log.info(groovyUtils)
def holder = groovyUtils.getXmlHolder("GetUKLocationByPostCode#ResponseAsXml")
log.info(holder)
def num = holder.getNodeValue("//Town")
log.info(num)
它返回意外的元素cdata ..如何解決這個..?
你嘗試的文件? http://www.soapui.org/Functional-Testing/working-with-cdata.html – SiKing