Solved

XML Get Node value

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

831 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