属性 在 ws02 的迭代器中介中获取所有具有相同名称的标签值
Property fetching all tag values with same name in iterator mediator in ws02
我无法使用迭代器从 XML 中读取具有相同标签名称的特定值。下面是我正在使用的XML
<soapenv:Body xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<agl_result>
<agl_service_headers>
<serviceId>CustSubReqRecordIDs</serviceId>
<messageProducer>agidmp</messageProducer>
<internalVersion>10381</internalVersion>
<uuid>91570fce-300b-4568-8481-161233b5fedc</uuid>
<dateFormat>yyyy-MM-dd H:mm:ss</dateFormat>
<generatedTimeStamp>2018-12-18 17:35:40</generatedTimeStamp>
<user>hemanth_t2</user>
</agl_service_headers>
<agl_pagination_details>
<start>0</start>
<limit>10</limit>
<totalRecordsCount>1</totalRecordsCount>
</agl_pagination_details>
<ChangeRequest>
<changeRequestName>CLCZ696A2201_Nov20</changeRequestName>
<recordId>39017</recordId>
<changeRequestResponsiblePersonList>
<ChangeRequestResposiblePerson>
<recordId>39018</recordId>
<person>
<Person>
<firstName>sahusub</firstName>
<recordId>38610</recordId>
</Person>
</person>
<respPersonRoleList>
<ChangeRequestResponsiblePersonRole>
<respPersonRole>
<CodeListCode>
<recordId>38659</recordId>
<codeListDecodes>
<CodeListDecode>
<decode>Project Owner</decode>
</CodeListDecode>
</codeListDecodes>
</CodeListCode>
</respPersonRole>
</ChangeRequestResponsiblePersonRole>
</respPersonRoleList>
</ChangeRequestResposiblePerson>
<ChangeRequestResposiblePerson>
<recordId>39019</recordId>
<person>
<Person>
<firstName>allusu1</firstName>
<recordId>38933</recordId>
</Person>
</person>
<respPersonRoleList>
<ChangeRequestResponsiblePersonRole>
<respPersonRole>
<CodeListCode>
<recordId>38660</recordId>
<codeListDecodes>
<CodeListDecode>
<decode>Program Owner</decode>
</CodeListDecode>
</codeListDecodes>
</CodeListCode>
</respPersonRole>
</ChangeRequestResponsiblePersonRole>
</respPersonRoleList>
</ChangeRequestResposiblePerson>
</changeRequestResponsiblePersonList>
</ChangeRequest>
</agl_result>
</soapenv:Body>
我需要读取 Xpath 中的值 /soapenv:Body/agl_result/ChangeRequest/changeRequestResponsiblePersonList/ChangeRequestResposiblePerson/recordId
,
即 39018 , 39019 .
我正在使用以下代码检索值:
<iterate continueParent="true" expression="//agl_result/ChangeRequest/changeRequestResponsiblePersonList/ChangeRequestResposiblePerson" id="RespPersonList" sequential="true">
<target>
<sequence>
<switch source="//respPersonRoleList/ChangeRequestResponsiblePersonRole/respPersonRole/CodeListCode/codeListDecodes/CodeListDecode/decode">
<case regex="Project Owner">
<property name="projectPersonID" expression="//person/Person/recordId" scope="operation" type="STRING"></property>
<property name="RespProjectPersonId" expression="//recordId/text()" scope="operation" type="STRING"></property>
</case>
<case regex="Program Owner">
<property name="programPersonId" expression="//person/Person/recordId" scope="operation" type="STRING"></property>
<property name="RespProgramPersonId" expression="//recordId/text()" scope="operation" type="STRING"></property>
</case>
</switch>
<log>
<property name="after the Switch projectPersonID" expression="get-property('operation','projectPersonID')"></property>
<property name="after the Switch programPersonId" expression="get-property('operation','programPersonId')"></property>
</log>
</sequence>
</target>
</iterate>
我从这段代码得到的实际输出是
after the Switch projectPersonID : 390183861038659
after the Switch programPersonId : 390193893338660
请帮我解决这个问题..
提前致谢
在循环阅读时 属性 的小变化
对于项目所有者
<property name="RespProjectPersonId" expression="//ChangeRequestResposiblePerson/recordId/text()" scope="operation" type="STRING"></property>
对于程序所有者
<property name="RespProgramPersonId" expression="//ChangeRequestResposiblePerson/recordId/text()" scope="operation" type="STRING"></property>
这工作正常。
谢谢
我无法使用迭代器从 XML 中读取具有相同标签名称的特定值。下面是我正在使用的XML
<soapenv:Body xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<agl_result>
<agl_service_headers>
<serviceId>CustSubReqRecordIDs</serviceId>
<messageProducer>agidmp</messageProducer>
<internalVersion>10381</internalVersion>
<uuid>91570fce-300b-4568-8481-161233b5fedc</uuid>
<dateFormat>yyyy-MM-dd H:mm:ss</dateFormat>
<generatedTimeStamp>2018-12-18 17:35:40</generatedTimeStamp>
<user>hemanth_t2</user>
</agl_service_headers>
<agl_pagination_details>
<start>0</start>
<limit>10</limit>
<totalRecordsCount>1</totalRecordsCount>
</agl_pagination_details>
<ChangeRequest>
<changeRequestName>CLCZ696A2201_Nov20</changeRequestName>
<recordId>39017</recordId>
<changeRequestResponsiblePersonList>
<ChangeRequestResposiblePerson>
<recordId>39018</recordId>
<person>
<Person>
<firstName>sahusub</firstName>
<recordId>38610</recordId>
</Person>
</person>
<respPersonRoleList>
<ChangeRequestResponsiblePersonRole>
<respPersonRole>
<CodeListCode>
<recordId>38659</recordId>
<codeListDecodes>
<CodeListDecode>
<decode>Project Owner</decode>
</CodeListDecode>
</codeListDecodes>
</CodeListCode>
</respPersonRole>
</ChangeRequestResponsiblePersonRole>
</respPersonRoleList>
</ChangeRequestResposiblePerson>
<ChangeRequestResposiblePerson>
<recordId>39019</recordId>
<person>
<Person>
<firstName>allusu1</firstName>
<recordId>38933</recordId>
</Person>
</person>
<respPersonRoleList>
<ChangeRequestResponsiblePersonRole>
<respPersonRole>
<CodeListCode>
<recordId>38660</recordId>
<codeListDecodes>
<CodeListDecode>
<decode>Program Owner</decode>
</CodeListDecode>
</codeListDecodes>
</CodeListCode>
</respPersonRole>
</ChangeRequestResponsiblePersonRole>
</respPersonRoleList>
</ChangeRequestResposiblePerson>
</changeRequestResponsiblePersonList>
</ChangeRequest>
</agl_result>
</soapenv:Body>
我需要读取 Xpath 中的值 /soapenv:Body/agl_result/ChangeRequest/changeRequestResponsiblePersonList/ChangeRequestResposiblePerson/recordId
,
即 39018 , 39019 .
我正在使用以下代码检索值:
<iterate continueParent="true" expression="//agl_result/ChangeRequest/changeRequestResponsiblePersonList/ChangeRequestResposiblePerson" id="RespPersonList" sequential="true">
<target>
<sequence>
<switch source="//respPersonRoleList/ChangeRequestResponsiblePersonRole/respPersonRole/CodeListCode/codeListDecodes/CodeListDecode/decode">
<case regex="Project Owner">
<property name="projectPersonID" expression="//person/Person/recordId" scope="operation" type="STRING"></property>
<property name="RespProjectPersonId" expression="//recordId/text()" scope="operation" type="STRING"></property>
</case>
<case regex="Program Owner">
<property name="programPersonId" expression="//person/Person/recordId" scope="operation" type="STRING"></property>
<property name="RespProgramPersonId" expression="//recordId/text()" scope="operation" type="STRING"></property>
</case>
</switch>
<log>
<property name="after the Switch projectPersonID" expression="get-property('operation','projectPersonID')"></property>
<property name="after the Switch programPersonId" expression="get-property('operation','programPersonId')"></property>
</log>
</sequence>
</target>
</iterate>
我从这段代码得到的实际输出是
after the Switch projectPersonID : 390183861038659
after the Switch programPersonId : 390193893338660
请帮我解决这个问题..
提前致谢
在循环阅读时 属性 的小变化 对于项目所有者
<property name="RespProjectPersonId" expression="//ChangeRequestResposiblePerson/recordId/text()" scope="operation" type="STRING"></property>
对于程序所有者
<property name="RespProgramPersonId" expression="//ChangeRequestResposiblePerson/recordId/text()" scope="operation" type="STRING"></property>
这工作正常。 谢谢