Unable to get value of element... code and XML attached

Here is the XML I am working with...
 
<ItemLookupResponse>
<Items>
<Request>
<IsValid>True</IsValid>
<ItemLookupRequest>
<IdType>UPC</IdType>
<MerchantId>All</MerchantId>
<ItemId>096741144127</ItemId>
<ResponseGroup>Medium</ResponseGroup>
<SearchIndex>Music</SearchIndex>
</ItemLookupRequest>
</Request>
<Item>
<ASIN>B000WGWWB2</ASIN>
<DetailPageURL>

Open in new window


This is my code that I am trying to access the value of the ASIN element.
 
br.Read();
                br.MoveToFirstAttribute();

                br.MoveToAttribute("Items");
                br.MoveToAttribute("Item");
                br.MoveToAttribute("ASIN");
                br.Read();
                mtbASIN.Text = br.Value;  //  move ASIN

Open in new window


It's not working... what do I need to do to get the value of the ASIN element?
rmmarshAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

käµfm³d 👽Commented:
Those are not attributes--they are elements. You are using the wrong function to navigate your document. Try using MoveToElement instead.

br.Read();
br.MoveToFirstAttribute();

br.MoveToElement("Items");
br.MoveToElement("Item");
br.MoveToElement("ASIN");
br.Read();
mtbASIN.Text = br.Value;  //  move ASIN

Open in new window

0
rmmarshAuthor Commented:
Hi Kenneth... there is NO method MoveToElement that takes a parameter.  So I guess the next question is:  how do I get to the specific element "ASIN"?
0
käµfm³d 👽Commented:
Heheh, my mistake. I guess I should have read the docs before trying to quote them  = )

Try using ReadToFollowing instead:

br.Read();
br.MoveToFirstAttribute();

br.ReadToFollowing("Items");
br.ReadToFollowing("Item");
br.ReadToFollowing("ASIN");
br.Read();
mtbASIN.Text = br.Value;  //  move ASIN

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rmmarshAuthor Commented:
As usual, you came through!  You're the man!

Spokane-Dude
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.