Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7733665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:03:32+00:00 2026-06-01T07:03:32+00:00

Can Any one help me reading this XML and Looping through <MedicationDispensed> I get

  • 0

Can Any one help me reading this XML and Looping through <MedicationDispensed>

I get this XML in XMLDocument xdoc (a dynamic Response)

    <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>

i need to read the Data in Loop for <MedicationDispensed>
I would like to do it through Linq-to-XML

Can any one give me a good start?

Solution

I got my solution using this link

@Flowerking gave me a good start.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:03:34+00:00Added an answer on June 1, 2026 at 7:03 am

    Try this

    XNamespace ns = "http://www.xxxx.org/schema/SCRIPT";
    
    foreach(var elms in xdoc.Descendants(ns + "MedicationDispensed").Elements())
    {
         Console.WriteLine(elms.Name + ":" + elms.Value.ToString());
    }
    

    If you have nested elements, then you need to iterate through them seperately,

    foreach(var elms in xdoc.Descendants("MedicationDispensed").Elements())
    {
        if(elms.HasElements)
        {
            foreach (var element in elms.Elements())
            {
                Console.WriteLine (element.Name + ":" + element.Value.ToString());
            }
        }
        else
        {
         Console.WriteLine(elms.Name + ":" + elms.Value.ToString());
         }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can any one please help me solve this. I am resizing some flash object/embed
Can any one help me convert the below code to LINQ? Select Catg,Count(*) From
can any one help me with code that subtract 1 from a digit stored
can any one help me in creating a regular expression for password validation. The
Can any one help me how to sort rows by relevance for the following
I am new in Pocket PC and Smart phone. so can any one help
I want to bound JVM with a fixed memory limit. Can any one help
Can any one of you help me in converting an windows dll file in
I need some logic/programming help with reading more than one record from a text
OK suppose I'm parsing some XML (the problem exists while reading any language but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.