tags:

views:

137

answers:

3

I have XML data like this:

<search ver="3.0">
  <loc>Birmingham, AL</loc> 
  <loc>Gulf Shores, AL</loc> 
  <loc>Alabama, NY</loc> 
  <loc>Abbeville, AL</loc> 
  <loc>Abernant, AL</loc> 
</search>

I would like to return the name of the places. How may I extract this data using Visual Basic?

A: 

Not sure why you don't do this in your XML, but maybe you have a good reason:

<loc>
    <city>Birmingham</city>
    <state>AL</state>
</loc>

But anyway, if you get the loc elements in your original XML, you can use the Split method to pull it apart.

John at CashCommons
A: 
hubby
A: 

// Easy way:

Dim docxml As New DOMDocument30
Dim element As IXMLDOMElement

Dim Node As IXMLDOMNode

docxml.Load app.path & "configiw.xml"
text1.text = docxml.getElementsByTagName("loc").Item(0).Text 
'Zero is the number of the line, you can use a while or a for
Paulo