Ho il seguente codice:
codice:Private Sub LoadTreeViewFromXmlFile(ByVal file_name As String, ByVal trv As TreeView) Dim xml_doc As DOMDocument ' Load the XML file into the DOMDocument. Set xml_doc = New DOMDocument xml_doc.Load file_name ' Add the root node's children to the TreeView. TreeView1.Nodes.Clear AddChildrenToTreeView trv, Nothing, xml_doc.documentElement End Sub
Quando l'XML è fatto così tutto OK:codice:Private Sub AddChildrenToTreeView(ByVal trv As TreeView, ByVal treeview_parent As Node, ByVal xml_node As IXMLDOMElement) Dim xml_child As IXMLDOMElement Dim new_node As Node Dim myNodeName As String On Error Resume Next ' Examine each XML child. For Each xml_child In xml_node.childNodes myNodeName = xml_child.nodeName MsgBox myNodeName ' Add the child to the TreeView. ' [...] Next xml_child End Sub
Mentre quando un elemento qualsiasi inizia con un numero:codice:<Items> <Cassetti> <man01.manuali_vers_standard.org /> <RASSEGNA_STAMPA.esempio.ACME /> </Cassetti> </Items>
iniziano i problemi e il comando di MsgBox myNodeName sopra dà solo stringhe nulle. Perchè?codice:<Items> <Cassetti> <man01.manuali_vers_standard.org /> <22RASSEGNA_STAMPA.esempio.ACME /> </Cassetti> </Items>

Rispondi quotando