Solved

XML Get Node value

Posted on 2013-06-13
4
468 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
  • 3
4 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
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…

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

12 Experts available now in Live!

Get 1:1 Help Now