Ciao a tutti.
Ho bisogno del vs aiuto.
Utilizzo questo codice per trasformare un file XML in formato TXT.
Il codice non dà errori, ma il file generato come testme.txt è sempre vuoto (0 kb).
Cosa sbaglio?
Grazie
codice:<% '---------- Dim xmlSource Dim xmlXForm Dim strErr Dim strResult Dim fso , file Dim strPath Const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8 Set xmlSource = CreateObject("MSXML2.DOMDocument.4.0") Set xmlXForm = CreateObject("MSXML2.DOMDocument.4.0") xmlSource.validateOnParse = True xmlXForm.validateOnParse = True xmlSource.async = False xmlXForm.async = False xmlSource.Load Server.Mappath("\xml\titty.xml") If Err.Number <> 0 Then strErr = Err.Description & vbCrLf strErr = strErr & xmlSource.parseError.reason & " line: " & xmlSource.parseError.Line & " col: " & xmlSource.parseError.linepos & " text: " & xmlSource.parseError.srcText Response.write strErr & " " End If xmlXForm.Load Server.Mappath("\xml\testme.xsl") If Err.Number <> 0 Then strErr = Err.Description & vbCrLf strErr = strErr & xmlSource.parseError.reason & " line: " & xmlSource.parseError.Line & " col: " & xmlSource.parseError.linepos & " text: " & xmlSource.parseError.srcText Response.write strErr & " " End If strResult = xmlSource.transformNode(xmlXForm) If Err.Number <> 0 Then strErr = Err.Description & vbCrLf strErr = strErr & xmlSource.parseError.reason & " line: " & xmlSource.parseError.Line & " col: " & xmlSource.parseError.linepos & " text: " & xmlSource.parseError.srcText Response.write strErr & " " End If Set fso = CreateObject("Scripting.FileSystemObject") strPath = Server.Mappath("\xml\testme.txt") Set file = fso.opentextfile(strPath, ForWriting, True) file.write strResult file.Close Set file = Nothing Set fso = Nothing Set xmlSource = Nothing Set xmlXForm = Nothing '---------- %>

Rispondi quotando