i have the following function which brings a nodelist and i need to add it to the following xml
Public Function Salida(ByVal est As String, ByVal err As String, Optional node As Object = Nothing) As String
Dim m_xmld = New XmlDocument
Try
m_xmld.LoadXml("<tx><estado></estado><info></info></tx>")
m_xmld.SelectSingleNode("tx/estado").InnerText = est
m_xmld.SelectSingleNode("tx/info").InnerText = err
If Not node Is Nothing Then
m_xmld.AppendChild(node)
End If
Catch ex As Exception
m_xmld.InnerText = "Error"
End Try
Return m_xmld.InnerXml
End Function
but when I try to add it, I get the following error "{"Unable to convert an object of type 'System.Xml.XmlElementList' to type 'System.Xml.XmlNode'."}"
how to name the function and obtain the node:
mvarXmlSalida = Util.Salida("0", "", xmldoc.GetElementsByTagName("file"))
<Transport>
<file>
<name>test.txt</name>
<size>1,52 Kb</size>
<type>.txt</type>
<data>test data</data>
<option>ExactName</option>
</file>
<Transport>