Pulling Inner Text of Nodes in vb.net -


i have simple xml file looks like:

<reshelving> <location>loc1</location> <location>loc2</location> </reshelving> 

i have vb.net form want display location text in list box in using following code:

 public function loadfile(byref filename string) boolean     try         reshelvingdocument.load(filename)         dim mynodes xmlnodelist         dim name xmlnode         mynodes = reshelvingdocument.selectnodes("reshelving")         lsthomelocations.items.clear()         each location xmlnode in mynodes             name = location.selectsinglenode("location")             if name nothing                 continue             end if             lsthomelocations.items.add(name.innertext)         next         if lsthomelocations.items.count = 0             return false         end if         lsthomelocations.selectedindex = 0         reshelvingfile = filename         me.text = "reshelving settings - " & reshelvingfile         return true     catch ex exception         dim message string = ex.message         return false     end try end function  sub lsthomelocationsselectedindexchanged(sender object, e eventargs)     dim homelocation xmlnode, homelocationdata xmlnode     homelocation = reshelvingdocument.selectsinglenode("reshelving[location=""" & lsthomelocations.selecteditem & """]") end sub 

the form show first node (loc1) not display additional ones.

i think need 1 more loop. mynodes contain 1 node example, have 2 child nodes, each inner text. maybe more like:

for each location xmlnode in mynodes  each n xmlnode in location.selectnodes("location")      lsthomelocations.items.add(n.innertext)  next next 

Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -