Свойство, извлекающее все значения тегов с одинаковыми именами в посреднике итератора в ws02 - PullRequest
0 голосов
/ 18 декабря 2018

Я не могу прочитать конкретные значения с тем же именем тега из XML, используя Iterator.Ниже приведен 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>

Фактический вывод, который я получаю из этого кода:

после проекта SwitchPersonID: 390183861038659

после программы SwitchPersonId: 390193893338660

Пожалуйста, помогите мне исправить это ..

Заранее спасибо

1 Ответ

0 голосов
/ 20 декабря 2018

Небольшое изменение свойства при чтении в цикле для владельца проекта

<property name="RespProjectPersonId" expression="//ChangeRequestResposiblePerson/recordId/text()" scope="operation" type="STRING"></property>

Для владельца программы

<property name="RespProgramPersonId" expression="//ChangeRequestResposiblePerson/recordId/text()" scope="operation" type="STRING"></property>

Работает отлично.Спасибо

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...