Solved

VB XMLDocument.Item property equivalent in Csharp

Posted on 2011-03-12
3
527 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

13 Experts available now in Live!

Get 1:1 Help Now