Solved

VB XMLDocument.Item property equivalent in Csharp

Posted on 2011-03-12
3
530 Views
Last Modified: 2012-05-11
I am rewriting a publicly available Bing Maps API into CSharp for practice and I have run into a problem that I need help with.  the VB Code uses a .item property to read the XML nodes, but I am not sure what the CSharp equivalent is as .item does not show up in the available methods.  (I believe I have properly referenced all assemblies.)

VB Code is below.  Thanks for the help!
Dim myJobStatus As String = myXmlDocument.Item("Response").Item("ResourceSets").Item("ResourceSet").Item("Resources").Item("DataflowJob").Item("Status").InnerText

Open in new window

0
Comment
Question by:gwarcher
  • 2
3 Comments
 
LVL 6

Expert Comment

by:Webmonkey
ID: 35120154
Assuming you are using the XmlDocument class (reference below), it would look like this:

String myJobStatus = myXmlDocument.Item["Response"].Item["ResourceSets"].Item["ResourceSet"].Item["Resources"].Item["DataflowJob"].Item["Status"].InnerText

Open in new window



Ref: http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx
0
 

Author Comment

by:gwarcher
ID: 35125435
I am getting the following error:  'System.Xml.XmlDocument' does not contain a definition for 'Item' and no extension method 'Item' accepting a first argument of type 'System.Xml.XmlDocument' could be found (are you missing a using directive or an assembly reference?)

I have a reference to sytstem.xml at the top.
0
 
LVL 6

Accepted Solution

by:
Webmonkey earned 500 total points
ID: 35156081
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now