由于需要熟悉mirth,其中JavaScript部分是非常重要的,特别是其XML解析部分,不知道
var getPatientByMayIDResponseXML = new XML(getPatientByMayIDResponse);
.*
实例HL7中的XML类
var temp1 = getPatientByMayIDResponseXML.*.toString();
<soap:Header xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"/>
<soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<ns2:getPatientByMapIDResponse xmlns:ns2="http://services.cxf.shengjy.vico.com/">
<return>
<objectList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:patient">
<id>321</id>
<name>bbb</name>
<sex>f</sex>
<mapToID>11</mapToID>
</objectList>
</return>
</ns2:getPatientByMapIDResponse>
</soap:Body>
<span style="font-family:Arial;BACKGROUND-COLOR: #ffffff"></span>
.*表示该XML文本本身,返回的temp1会显示该节点下的XML文本,如果是最初的XML文本则会去掉申明
var temp2 = getPatientByMayIDResponseXML..*toString();
<soap:Header xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"/>
<soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<ns2:getPatientByMapIDResponse xmlns:ns2="http://services.cxf.shengjy.vico.com/">
<return>
<objectList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:patient">
<id>321</id>
<name>bbb</name>
<sex>f</sex>
<mapToID>11</mapToID>
</objectList>
</return>
</ns2:getPatientByMapIDResponse>
</soap:Body>
<ns2:getPatientByMapIDResponse xmlns:ns2="http://services.cxf.shengjy.vico.com/">
<return>
<objectList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:patient">
<id>321</id>
<name>bbb</name>
<sex>f</sex>
<mapToID>11</mapToID>
</objectList>
</return>
</ns2:getPatientByMapIDResponse>
<return>
<objectList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:patient">
<id>321</id>
<name>bbb</name>
<sex>f</sex>
<mapToID>11</mapToID>
</objectList>
</return>
<objectList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:patient">
<id>321</id>
<name>bbb</name>
<sex>f</sex>
<mapToID>11</mapToID>
</objectList>
<id>321</id>
321
<name>bbb</name>
bbb
<sex>f</sex>
f
<mapToID>11</mapToID>
11
..*将会一级一级的解析其所有的子节点并返回
var aa = getPatientByMayIDResponseXML..*::['name'].toString();
::['']的写法与..*连用
bbb
var aa = getPatientByMayIDResponseXML..*['name'].toString();
bbb
返回值相同,都正确解析了最底层的节点
那么两者有什么不同之处呢?
var aa = getPatientByMayIDResponseXML.*['name'].toString();
var aa = getPatientByMayIDResponseXML.*::['name'].toString();
两个都返回空值,所以没搞清楚.*有什么用处,写和没写效果没什么区别的样子