I can't seem to loop through my xml results. Here is what I have so far. I did testing by replacing the namespace (xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://domain.com/folder") from the xml and can get to work but not when it's included.
It's something with how I am using the xmlnamespacemanager.
DataCode:Private Sub btn2kImages_Click(sender As System.Object, e As System.EventArgs) Handles btn2kImages.Click Dim xdoc As XmlDocument = New XmlDocument xdoc.LoadXml(txtXml.Text) Dim nsMgr As XmlNamespaceManager = New XmlNamespaceManager(xdoc.NameTable) nsMgr.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance") nsMgr.AddNamespace("xsd", "http://www.w3.org/2001/XMLSchema") nsMgr.AddNamespace("ns", "http://domain.com/folder") Dim xNodesList = xdoc.SelectNodes("/ArrayOfAsfSku/asfSku/SkuVal", nsMgr) Dim sTemp As String = "" For Each xChildNode As XmlNode In xNodesList If Not (xChildNode Is Nothing) Then sTemp &= xChildNode.InnerText & "," End If Next MessageBox.Show(sTemp) End Sub
HTML Code:<?xml version="1.0" encoding="utf-8"?> <ArrayOfAsfSku xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://domain.com/folder"> <asfSku> <SkuVal>AA0625-PEA</SkuVal> </asfSku> <asfSku> <SkuVal>AA2800-NA</SkuVal> </asfSku> <asfSku> <SkuVal>AA2803-NA</SkuVal> </asfSku> <asfSku> <SkuVal>AA2813-NA</SkuVal> </asfSku> <asfSku> <SkuVal>AA2815-NA</SkuVal> </asfSku> <asfSku> <SkuVal>AA4268-IN</SkuVal> </asfSku> <asfSku> <SkuVal>AA4270-IN</SkuVal> </asfSku> <asfSku> <SkuVal>AA4272-IN</SkuVal> </asfSku> </ArrayOfAsfSku>


Reply With Quote