Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB XMLDocument.Item property equivalent in Csharp

Posted on 2011-03-12
3
Medium Priority
?
538 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 2000 total points
ID: 35156081
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

926 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