?
Solved

XML Get Node value

Posted on 2013-06-13
4
Medium Priority
?
511 Views
Last Modified: 2013-06-13
I have vb code that's reading XML

Dim XmlDoc As New XmlDocument()
XmlDoc.LoadXml(myXmlData)

How would I find this particular node's value (null)  using VB Code?
I THINK I need a NameSpaceManager but don;t know how to go about this.

<csta:localConnectionInfo>null</csta:localConnectionInfo>
0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 2000 total points
ID: 39245377
Basically u use System.Xml.XmlNamespaceManager xmlnsManager = new System.Xml.XmlNamespaceManager(xmldoc.NameTable);
xmlnsManager.AddNamespace("csta", "...");

But i need to see the namespace declared in the xml. Can u post it?
0
 

Author Comment

by:lrbrister
ID: 39245454
Sedgwick
Will post in an hour
0
 

Author Comment

by:lrbrister
ID: 39245606
Sedgewick,
  Here is the full XML
Only the phone numbers are ### out

remember...I'm trying to get
<csta:localConnectionInfo>null</csta:localConnectionInfo>

<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:ServiceInitiatedEvent>
      <csta:monitorCrossRefID>149</csta:monitorCrossRefID>
      <csta:initiatedConnection>
        <csta:callID>1007400000023952633</csta:callID>
        <csta:deviceID>##########.70269674</csta:deviceID>
      </csta:initiatedConnection>
      <csta:initiatingDevice>
        <csta:deviceIdentifier>##########</csta:deviceIdentifier>
      </csta:initiatingDevice>
      <csta:calledDevice>
        <csta:deviceIdentifier>##########</csta:deviceIdentifier>
      </csta:calledDevice>
      <csta:localConnectionInfo>initiated</csta:localConnectionInfo>
      <csta:cause>normal</csta:cause>
      <csta:extensions>
        <csta:privateData>
          <csta:private>
            <m5:deviceSpecifiers>
              <m5:endpoint>001BD5851263</m5:endpoint>
              <m5:line>1</m5:line>
            </m5:deviceSpecifiers>
            <m5:phoneUIDisplay>
              <csta:callerId />
              <csta:extraDisplay />
            </m5:phoneUIDisplay>
          </csta:private>
        </csta:privateData>
      </csta:extensions>
    </csta:ServiceInitiatedEvent>
  </Result>
</org.m5.api.v1.Response>

Open in new window

0
 

Author Closing Comment

by:lrbrister
ID: 39245761
After I spent some time in though I used your solution and this is the working set

Dim namespaceManager As New XmlNamespaceManager(XmlDoc.NameTable)
namespaceManager.AddNamespace("csta", "http://www.ecma-international.org/standards/ecma-323/csta/ed5")
Dim ddd = XmlDoc.SelectSingleNode("//csta:localConnectionInfo", namespaceManager)
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

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.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

762 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