Может ли кто-нибудь помочь мне с чтением этого XML и циклическим просмотром <MedicationDispensed>
Я получаю этот XML в XMLDocument xdoc (динамический ответ)
<Message xmlns="http://www.xxxx.org/schema/SCRIPT" version="008" release="001">
<Header>
<To Qualifier="ZZZ">T00000000021261</To>
<From Qualifier="ZZZ">T00000000001000</From>
<MessageID>1333375137258</MessageID>
<RelatesToMessageID>19553495</RelatesToMessageID>
<SentTime>2012-04-02T13:58:52</SentTime>
<Security>
<UsernameToken>
<Username />
</UsernameToken>
<Sender>
<SecondaryIdentification>JILITTQQPK</SecondaryIdentification>
<TertiaryIdentification>RXHUB</TertiaryIdentification>
</Sender>
<Receiver>
<SecondaryIdentification></SecondaryIdentification>
<TertiaryIdentification />
</Receiver>
</Security>
<Mailbox>
<DeliveredID></DeliveredID>
</Mailbox>
<TestMessage>1</TestMessage>
</Header>
<Body>
<RxHistoryResponse>
<RxReferenceNumber>POCDH1</RxReferenceNumber>
<PrescriberOrderNumber>POCDH1</PrescriberOrderNumber>
<Response>
<Approved />
</Response>
<Prescriber>
<Identification>
<NPI>xxxxxxxxx</NPI>
<DEANumber>xxxxxx</DEANumber>
</Identification>
<Name>
<LastName>xxxxxx</LastName>
<FirstName>xxxxxxx</FirstName>
</Name>
<PhoneNumbers>
<Phone>
<Number>xxxxx</Number>
<Qualifier>TE</Qualifier>
</Phone>
</PhoneNumbers>
</Prescriber>
<Patient>
<PatientRelationship>1</PatientRelationship>
<Name>
<LastName>Schnur</LastName>
<FirstName>Bert</FirstName>
<MiddleName>L</MiddleName>
</Name>
<Gender>M</Gender>
<DateOfBirth>1945-10-19</DateOfBirth>
</Patient>
<BenefitsCoordination>
<PayerIdentification>
<PayerID>PBM123</PayerID>
</PayerIdentification>
<PayerName>INSURANCE COMPANY NAME</PayerName>
<CardholderID>MEMBERID</CardholderID>
<CardholderName>PALTROW, BRUCE</CardholderName>
<GroupID>B000000</GroupID>
<Consent>Y</Consent>
<PBMMemberID>B000000%111111110%001</PBMMemberID>
</BenefitsCoordination>
<MedicationDispensed>
<DrugDescription>OXYCODONE W/APAP 5/325 TAB</DrugDescription>
<DrugCoded>
<ProductCode>00406051205</ProductCode>
<ProductCodeQualifier>ND</ProductCodeQualifier>
</DrugCoded>
<Quantity>
<Qualifier>00</Qualifier>
<Value>60.0</Value>
<CodeListQualifier>87</CodeListQualifier>
</Quantity>
<DaysSupply>15</DaysSupply>
<LastFillDate>2012-04-02</LastFillDate>
<Pharmacy>
<Identification>
<NCPDPID>1234567</NCPDPID>
</Identification>
<StoreName>WALGREENS #00000</StoreName>
<Address>
<AddressLine1>1 CENTRAL STREET</AddressLine1>
<City>INDIANAPOLIS</City>
<State>IN</State>
<ZipCode>46201</ZipCode>
</Address>
<PhoneNumbers>
<Phone>
<Number>8005551212</Number>
<Qualifier>TE</Qualifier>
</Phone>
</PhoneNumbers>
</Pharmacy>
<Prescriber>
<Identification>
<DEANumber>KR4184999</DEANumber>
</Identification>
<Name>
<LastName>SMITH</LastName>
<FirstName>JOHN</FirstName>
<MiddleName>E</MiddleName>
</Name>
<Address>
<AddressLine1>MERCY CLINIC</AddressLine1>
<City>ST. PAUL</City>
<State>MN</State>
<ZipCode>55101</ZipCode>
</Address>
</Prescriber>
</MedicationDispensed>
<MedicationDispensed>
<DrugDescription>HUMULIN 70/30 VIAL</DrugDescription>
<DrugCoded>
<ProductCode>00002871501</ProductCode>
<ProductCodeQualifier>ND</ProductCodeQualifier>
</DrugCoded>
<Quantity>
<Qualifier>00</Qualifier>
<Value>10.0</Value>
<CodeListQualifier>87</CodeListQualifier>
</Quantity>
<DaysSupply>30</DaysSupply>
<LastFillDate>2012-04-01</LastFillDate>
<Pharmacy>
<Identification>
<NCPDPID>1234567</NCPDPID>
</Identification>
<StoreName>WALGREENS #00000</StoreName>
<Address>
<AddressLine1>1 CENTRAL STREET</AddressLine1>
<City>INDIANAPOLIS</City>
<State>IN</State>
<ZipCode>46201</ZipCode>
</Address>
<PhoneNumbers>
<Phone>
<Number>8005551212</Number>
<Qualifier>TE</Qualifier>
</Phone>
</PhoneNumbers>
</Pharmacy>
<Prescriber>
<Identification>
<DEANumber>KR4184999</DEANumber>
</Identification>
<Name>
<LastName>SMITH</LastName>
<FirstName>JOHN</FirstName>
<MiddleName>E</MiddleName>
</Name>
<Address>
<AddressLine1>MERCY CLINIC</AddressLine1>
<City>ST. PAUL</City>
<State>MN</State>
<ZipCode>55101</ZipCode>
</Address>
</Prescriber>
</MedicationDispensed>
Loop Continues
<MedicationDispensed>
<DrugDescription>OXYCODONE W/APAP 5/325 TAB</DrugDescription>
<DrugCoded>
<ProductCode>00406051205</ProductCode>
<ProductCodeQualifier>ND</ProductCodeQualifier>
</DrugCoded>
<Quantity>
<Qualifier>00</Qualifier>
<Value>60.0</Value>
<CodeListQualifier>87</CodeListQualifier>
</Quantity>
<DaysSupply>15</DaysSupply>
<LastFillDate>2012-04-02</LastFillDate>
<Pharmacy>
....Pharmacy Details
</Pharmacy>
<Prescriber>
... Prescriber Details
</Prescriber>
</MedicationDispensed>
</RxHistoryResponse>
</Body>
Мне нужно прочитать данные в цикле для <MedicationDispensed>
Я хотел бы сделать это через Linq-to-XML
Может ли кто-нибудь дать мне хорошее начало?
Решение
Я получил свое решение по этой ссылке
@ Flowerking дал мне хорошее начало.