- ¿Y se puede cargar un archivo xml local sin setearlo en un string?
Código
Imports System.Xml Imports System.Xml.Serialization Imports System.IO Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim rawXML As String = _ "<Company>" & _ " <Employee>" & _ " <name>John</name>" & _ " <Id>1</Id>" & _ " <email>John@xxxxxx.com</email>" & _ " </employee>" & _ " <employee>" & _ " <name>Sue</name>" & _ " <Id>2</Id>" & _ " <email>Sue@xxxxxx.com</email>" & _ " </employee>" & _ "</Company>" Dim xmlDoc As New XmlDocument Dim employeeNodes As XmlNodeList Dim employeeNode As XmlNode Dim baseDataNodes As XmlNodeList Dim bFirstInRow As Boolean MsgBox("A") xmlDoc.LoadXml(rawXML) ' Este msgbox no se llega a ver MsgBox("B") employeeNodes = xmlDoc.GetElementsByTagName("name") For Each employeeNode In employeeNodes baseDataNodes = employeeNode.ChildNodes bFirstInRow = True For Each baseDataNode As XmlNode In baseDataNodes If (bFirstInRow) Then bFirstInRow = False Else MsgBox(", ") End If MsgBox(baseDataNode.Name & ": " & baseDataNode.InnerText) Next Next End Sub End Class