Как вывести все дочерние элементы для каждого узла заряда (родительского)
Я хотел бы вывести все элементы заряда для всех зарядов, когда OffenseID/ID ID=PENDING.
Важно отметить, что элемент OffenseCite будет выводиться как
StatuteNumber
Пример вывода для каждого заряда должен выглядеть следующим образом. Я не включил все элементы в выходной образец
Входной xml-документ
<pre lang="xml"> <?xml version="1.0" encoding="UTF-8"?> <Envelope xmlns:NS1="http://www.w3.org/2003/05/soap-envelope"> <Body> <TabChargeDocument> <Charge> <ChargeSequenceID> <ID>1</ID> </ChargeSequenceID> <OffenseID> <ID>PENDING</ID> </OffenseID> <OffenseCite>169A.27.1</OffenseCite> <OffenseDescriptionText>TRAFFIC - DWI - FOURTH-DEGREE DRIVING WHILE IMPAIRED; DESCRIBED</OffenseDescriptionText> <OffenseDate>2016-09-18</OffenseDate> <OffenseTime>00:22:00</OffenseTime> <OffenseDatesOnOrAbout>false</OffenseDatesOnOrAbout> <SeverityLevelText>Misdemeanor</SeverityLevelText> <MinnesotaOffenseCode>NBR</MinnesotaOffenseCode> <Report> <ReportingAgencyORI> <ID>MNMHP0400</ID> </ReportingAgencyORI> <ReportingAgencyControlNumber> <ID>16510299</ID> </ReportingAgencyControlNumber> <ReportingOfficial> <OfficerBadgeNumber> <ID>176</ID> </OfficerBadgeNumber> <OfficerNameText>UTES</OfficerNameText> </ReportingOfficial> </Report> <CommunityOfOffenseText>Brooklyn Park</CommunityOfOffenseText> </Charge> <Charge> <ChargeSequenceID> <ID>2</ID> </ChargeSequenceID> <OffenseID> <ID>PENDING</ID> </OffenseID> <OffenseCite>169A.20.1(5)</OffenseCite> <OffenseDescriptionText>TRAFFIC - DWI - OPERATE MOTOR VEHICLE - ALCOHOL CONCENTRATION 0.08 WITHIN 2 HOURS</OffenseDescriptionText> <OffenseDate>2016-09-18</OffenseDate> <OffenseTime>00:22:00</OffenseTime> <OffenseDatesOnOrAbout>false</OffenseDatesOnOrAbout> <SeverityLevelText>Misdemeanor</SeverityLevelText> <Report> <ReportingAgencyORI> <ID>MNMHP0400</ID> </ReportingAgencyORI> <ReportingAgencyControlNumber> <ID>16510299</ID> </ReportingAgencyControlNumber> <ReportingOfficial> <OfficerBadgeNumber> <ID>176</ID> </OfficerBadgeNumber> <OfficerNameText>UTES</OfficerNameText> </ReportingOfficial> </Report> <CommunityOfOffenseText>Brooklyn Park</CommunityOfOffenseText> </Charge> <Charge> <ChargeSequenceID> <ID>3</ID> </ChargeSequenceID> <OffenseID> <ID>PENDING</ID>/Envelope/Body/TabChargeDocument/Charge[3]/OffenseID/ID </OffenseID> <OffenseCite>169A.20.1(1)</OffenseCite> <OffenseDescriptionText>TRAFFIC - DWI - OPERATE MOTOR VEHICLE UNDER INFLUENCE OF ALCOHOL</OffenseDescriptionText> <OffenseDate>2016-09-18</OffenseDate> <OffenseTime>00:22:00</OffenseTime> <OffenseDatesOnOrAbout>false</OffenseDatesOnOrAbout> <SeverityLevelText>Misdemeanor</SeverityLevelText> <Report> <ReportingAgencyORI> <ID>MNMHP0400</ID> </ReportingAgencyORI> <ReportingAgencyControlNumber> <ID>16510299</ID> </ReportingAgencyControlNumber> <ReportingOfficial> <OfficerBadgeNumber> <ID>176</ID> </OfficerBadgeNumber> <OfficerNameText>UTES</OfficerNameText> </ReportingOfficial> </Report> <CommunityOfOffenseText>Brooklyn Park</CommunityOfOffenseText> </Charge> </TabChargeDocument> </Body> </Envelope></pre>
Что я уже пробовал:
Я попробовал цикл for-each, чтобы проверить все обвинения на предмет OffenseID/ID = PENDING