Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.visual-basic > #19651
| From | "Sauro" <vicchi@crsscala.it> |
|---|---|
| Newsgroups | it.comp.lang.visual-basic |
| Subject | Re: Importare dati da file xml con VB6 |
| Date | 2019-10-11 11:10 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <qnpgus$m8e$1@gioia.aioe.org> (permalink) |
| References | <41c31c38-00c4-44d0-bd3e-e3a2367aec90@googlegroups.com> |
[cut]
Ciao Lorenzo
Non rispondo alla tua domanda ma ti offro un'altra possibilità
utilizzando la Sub che segue (non è farina del mio sacco) che forse,
con le opportune modifiche, puà fare al caso tuo.
La sub utilizza la variabile Stringa_DATI per memorizzare in modo
descrittivo i nomi dei nomi coi relativi valori o attributi.
Tu puoi utilizzare un altro sistema.
Se vuoi limitare la ricerca puoi usare istruzioni come le seguenti:
If xNode.nodeName = "DettaglioLinee" Then
If xNode.parentNode.nodeName = "NumeroLinea" Then
Nota che la Sub richiama se stessa per seguire tutti i nodi
Public Sub DisplayNode(ByRef Nodes As MSXML2.IXMLDOMNodeList, ByVal Indent
As Integer)
'Public Stringa_DATI as String ' Memorizza Nomi nodi e relativi valori o
attributi
'Public Con_Attrubuti as Boolean ' Mettere = True se si vogliono anche gli
attributi
'Public Con_Text as Boolean ' Mettere = True se si vogliono anche i
testi
Dim xNode As MSXML2.IXMLDOMNode
Indent = Indent + 2
For Each xNode In Nodes
If xNode.nodeType = NODE_ELEMENT And Con_Attributi Then ' NODE_ELEMENT
= 1
Attributo = ""
For Each Attrib In xNode.Attributes
Stringa_DATI = Stringa_DATI & Space$(Indent) & "Attrib: " &
xNode.nodeName & ":" & Attrib.nodeName & "=" & Attrib.Value & vbCrLf
Next Attrib
End If
If xNode.nodeType = NODE_TEXT And Con_Text Then ' NODE_TEXT =
3
Stringa_DATI = Stringa_DATI & Space$(Indent) &
xNode.parentNode.nodeName & ":" & xNode.nodeValue & vbCrLf
End If
If xNode.hasChildNodes Then
DisplayNode xNode.childNodes, Indent
End If
Next xNode
End Sub
Ciao, Sauro
Back to it.comp.lang.visual-basic | Previous | Next — Previous in thread | Next in thread | Find similar
Importare dati da file xml con VB6 Lorenzo Bonetto <bezvero@gmail.com> - 2019-09-30 03:25 -0700 Re: Importare dati da file xml con VB6 "Sauro" <vicchi@crsscala.it> - 2019-10-11 11:10 +0200 Re: Importare dati da file xml con VB6 "Sauro" <vicchi@crsscala.it> - 2019-10-11 11:30 +0200
csiph-web