Solved

XML Get Node value

Posted on 2013-06-13
4
492 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

679 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