Solved

What type of XML Node is this?

Posted on 2013-06-04
4
275 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 74

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 74

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

759 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

23 Experts available now in Live!

Get 1:1 Help Now