Google Answers Logo
View Question
 
Q: How to use asp.net (vb) to read a specific item's text in an XML file? ( No Answer,   0 Comments )
Question  
Subject: How to use asp.net (vb) to read a specific item's text in an XML file?
Category: Computers > Programming
Asked by: joeyjojojnrshabadoo-ga
List Price: $15.00
Posted: 24 Oct 2004 12:37 PDT
Expires: 24 Oct 2004 17:57 PDT
Question ID: 419411
I'm a in a little over my head in XMl syntax and ASP.net xpathnavigator methods.

I need to figure out how to grab the text of a specific node in an xml
file based on one of this particular nodes descendants.

Here's some of the sample XML:

<?xml version="1.0"?>
<!--Created on 10/16/2004 8:05:57 PM-->
<menuItems>
   <menuItem>
      <pageID>1</pageID>
      <pageName>Home</pageName>
      <menuCategory />
   </menuItem>
   <menuItem>
      <pageID>2</pageID>
      <pageName>Tax and Accounting</pageName>
      <menuCategory>tax</menuCategory>
      <menuItem>
         <pageID>3</pageID>
         <pageName>Services and Rates</pageName>
         <menuCategory />
      </menuItem>
      
So, for example, let's say the current page is '3'. I want to dive
into this XML file, look for the menuItem who has pageID of 3, and
then find the first ancestor-or-self that also hase a menuCategory
that contains a value. If there is a value, read it.

Initially, I was just using an xpathnavigator and an apath call, but
then realized I also need to use some logic, since I need to read each
menuCategory to first see if it has a value (since I'm only assigning
an actual value to the root level items.

My question is to ask if someone can provide sample ASP.net code to
get me there (I'm using vb.net)

I think I need to use an xpathnavigator to first grab the child node,
and then apathiterator, to iterate up the tree looking for the first
menucategory that has a stored value, and then grab it.

(This is my first question, so if my price is out of line, please let me know!)

Also, I can post my current sample code if that is of value.
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy