Solved

What type of XML Node is this?

Posted on 2013-06-04
4
277 Views
Last Modified: 2013-06-05
I am getting the xml below returned from an HttpWebRequest
I want to ALWAYS read the first node below the <Result..." line.

How can I do that in VB?
In otherwords my variable would be

myVar = "MonitorStartResponse"


Screenprint
0
Comment
Question by:lrbrister
  • 2
  • 2
4 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39219615
Can you post the code you are attempting to use? I suspect you are probably having an issue with namespaces and prefixes.

You might also try using the FirstChild property against the XmlElement you have populated with the <Result> node.
0
 

Author Comment

by:lrbrister
ID: 39219658
kaufmed
I'm strying to get the first "Child" after the <Resul..." middle section.

It could be the csta:MonitorStartResponse
It could be csta:EstablishedEvent
It could be anything
But it will always be the very first one.

Here's the actual XML.

<org.m5.api.v1.Response xmlns:m5="http://www.m5net.com/org/m5/data/v2/cti" xmlns:csta="http://www.ecma-international.org/standards/ecma-323/csta/ed5">
  <ErrorCount>0</ErrorCount>
  <Id>1</Id>
  <Result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="org.m5.data.v2.cti.HostedConnectObject">
    csta:MonitorStartResponse>
      <csta:monitorCrossRefID>392</csta:monitorCrossRefID>
    </csta:MonitorStartResponse>
  </Result>
</org.m5.api.v1.Response>

Open in new window

0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39220800
As I mentioned...

Module Module1

    Sub Main()
        Dim xdoc As New Xml.XmlDocument()

        xdoc.Load("input.xml")

        Dim firstChildOfResult As Xml.XmlElement = xdoc.SelectSingleNode("//Result").FirstChild
    End Sub

End Module

Open in new window

0
 

Author Closing Comment

by:lrbrister
ID: 39223011
Thanks
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

Suggested Solutions

Title # Comments Views Activity
LINQ - C# to VB convertion 12 46
SlingPlayer alternatives 1 28
Error on link 14 36
VB.NET Repostiory Pattern 7 0
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

919 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

17 Experts available now in Live!

Get 1:1 Help Now