good day all I have a little issue with reading xml which i have not done before
Im trying to read an xml and load it into a list view(easy and done)
what i want to do is count wheather a category field says "cms" or says "php" thats it. what im trying to do is with the list view add the category once with the the count. looking like
application
------cms(15)
------php(5)
------blog(25)
here is a portion of my xml
what i have so farCode:<?xml version="1.0" encoding="UTF-8"?> <product> <application> <packageid>PHPnuke</packageid> <packageType>CMS</packageType> <version>[1.0.40959.2]</version> <feedURL>file://%ProgramFiles%\test\templates\</feedURL> <image>http://phpnuke.org/images/logo.png</image> </application> <application> <packageid>PHPCurcuit</packageid> <packageType>blog</packageType> <version>[1.0.40959.2]</version> <feedURL>file://%ProgramFiles%\test\templates\</feedURL> <image>http://phpnuke.org/images/logo.png</image> </application> <application> <packageid>PHPCurcuit</packageid> <packageType>php</packageType> <version>[1.0.40959.2]</version> <feedURL>file://%ProgramFiles%\test\templates\t</feedURL> <image>http://phpnuke.org/images/logo.png</image> </application> </product>
Code:Dim lv As ListViewItem Dim xd As XDocument = XDocument.Load(pathToMain & "Recources\SitesGallery.xml") Dim appinfo = From info In xd.Descendants("application") _ Select New With _ { _ .packageid = info.Element("packageid").Value, _ .packageType = info.Element("packageType").Value, _ .version = info.Element("version").Value, _ .feedURL = info.Element("feedURL").Value, _ .image = info.Element("image").Value _ } lv = New ListViewItem() lv.Text = "All(" & xd.Elements("application").Nodes.Count & ")" Me.LVCategories.Items.Add(lv) For Each node In appinfo lv = New ListViewItem() lv.Text = node.category Me.LVCategories.Items.Add(lv) Next
please help if you can
thanks in advance




Reply With Quote
