I have a ASP.NET app, and something weird is happening
I have a xmldocument that has more than 10 nodes, I create an instance of a
XMLNode and assign one node to it from the xmldocument.
One line later I start a Loop with a for or a for each
(If I use the For then the xmlnode instance is created inside the structure,
if I use a for each then the xmlnode is instantiated at the beginning of the
for each statement)
well, then inside the loop I use a Select Case statement and at the first
case the XMLNode instance is null !!!
here's the snippet: Hope smbdy could help!! :s cause I'm just baffled
Dim xmldoc As XmlDocument = New XmlDocument
Dim nl As XmlNodeList
Dim nd As Integer
Try
Dim Pagina As Integer = CInt(txtPagina. Text)
Dim iNodes As Integer = 1
Dim iCarpeta As Integer = 1
'we load the xml which is stored on a hidden textbox
xmldoc.LoadXml( txtxml.Text)
'get the number of nodes the xml has
nl = xmldoc.SelectNo des("NewDataSet/Table")
lblPaginaActual .Text = Pagina
lblPaginaActual U.Text = Pagina
'start the loop through all the xml nodes named "Table"
'At this point "XMLDOC" has more that 10 nodes.
For nd = 0 To xmldoc.SelectNo des("NewDataSet/Table").Count - 1
Dim n As XmlNode =
xmldoc.SelectNo des("NewDataSet/Table").Item(nd )
'At this point the XMLNODE has a "Table" node stored.
Select Case iCarpeta
Case 1
'At this point the XMLNODE doesnt has any value, although 3 lines
above we saw
'that XMLNODE has a value
'Here happens the error
Call LlenaCarpeta1(n )
I have a xmldocument that has more than 10 nodes, I create an instance of a
XMLNode and assign one node to it from the xmldocument.
One line later I start a Loop with a for or a for each
(If I use the For then the xmlnode instance is created inside the structure,
if I use a for each then the xmlnode is instantiated at the beginning of the
for each statement)
well, then inside the loop I use a Select Case statement and at the first
case the XMLNode instance is null !!!
here's the snippet: Hope smbdy could help!! :s cause I'm just baffled
Dim xmldoc As XmlDocument = New XmlDocument
Dim nl As XmlNodeList
Dim nd As Integer
Try
Dim Pagina As Integer = CInt(txtPagina. Text)
Dim iNodes As Integer = 1
Dim iCarpeta As Integer = 1
'we load the xml which is stored on a hidden textbox
xmldoc.LoadXml( txtxml.Text)
'get the number of nodes the xml has
nl = xmldoc.SelectNo des("NewDataSet/Table")
lblPaginaActual .Text = Pagina
lblPaginaActual U.Text = Pagina
'start the loop through all the xml nodes named "Table"
'At this point "XMLDOC" has more that 10 nodes.
For nd = 0 To xmldoc.SelectNo des("NewDataSet/Table").Count - 1
Dim n As XmlNode =
xmldoc.SelectNo des("NewDataSet/Table").Item(nd )
'At this point the XMLNODE has a "Table" node stored.
Select Case iCarpeta
Case 1
'At this point the XMLNODE doesnt has any value, although 3 lines
above we saw
'that XMLNODE has a value
'Here happens the error
Call LlenaCarpeta1(n )