Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.visual-basic > #19322
| From | "Sauro" <vicchi@crsscala.it> |
|---|---|
| Newsgroups | it.comp.lang.visual-basic |
| Subject | Re: File XML con VB6 |
| Date | 2018-03-14 09:29 +0100 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <p8amhi$pln$1@gioia.aioe.org> (permalink) |
| References | (3 earlier) <p7qf99$7fu$1@virtdiesel.mng.cu.mi.it> <p7qrk3$3l6$1@gioia.aioe.org> <p803gn$u71$1@virtdiesel.mng.cu.mi.it> <p85svn$k5i$1@gioia.aioe.org> <p85tp5$fbu$1@solani.org> |
> Se tu la potessi condividere qua....grazie :)
Ecco qua:
Public Sub FormatDocToFile(ByVal doc As MSXML2.DOMDocument, _
ByVal FileName As String)
'Nel progetto serve il riferimento a:
'Microsoft XML, version 2.0
'
'Reformats the DOMDocument "Doc" into an ADODB.Stream
'and writes it to the specified file.
'
'Note the UTF-8 output never gets a BOM. If we want one we
'have to write it here explicitly after opening the Stream.
Dim rdrDom As MSXML2.SAXXMLReader
Dim stmFormatted As ADODB.Stream
Dim wtrFormatted As MSXML2.MXXMLWriter
Set stmFormatted = New ADODB.Stream
With stmFormatted
.Open
.Type = adTypeBinary
Set wtrFormatted = New MSXML2.MXXMLWriter
With wtrFormatted
.omitXMLDeclaration = False
.standalone = True
.byteOrderMark = False 'If not set (even to False) then
'.encoding is ignored.
.encoding = "utf-8" 'Even if .byteOrderMark = True
'UTF-8 never gets a BOM.
.Indent = True
.Output = stmFormatted
Set rdrDom = New MSXML2.SAXXMLReader
With rdrDom
Set .contentHandler = wtrFormatted
Set .dtdHandler = wtrFormatted
Set .errorHandler = wtrFormatted
.putProperty
"http://xml.org/sax/properties/lexical-handler", _
wtrFormatted
.putProperty
"http://xml.org/sax/properties/declaration-handler", _
wtrFormatted
.parse doc
End With
End With
.SaveToFile FileName
.Close
End With
End Sub
Ciao Greg
Sauro
Back to it.comp.lang.visual-basic | Previous | Next — Previous in thread | Find similar
File XML con VB6 "Sauro" <vicchi@crsscala.it> - 2018-03-07 17:32 +0100
Re: File XML con VB6 Greg <greg@alicie.com> - 2018-03-07 18:45 +0100
Re: File XML con VB6 "Sauro" <vicchi@crsscala.it> - 2018-03-07 19:26 +0100
Re: File XML con VB6 Franz_aRTiglio <franzgol@N0SPAMtin.it> - 2018-03-07 21:24 +0100
Re: File XML con VB6 "Sauro" <vicchi@crsscala.it> - 2018-03-07 23:50 +0100
Re: File XML con VB6 Franz_aRTiglio <franzgol@N0SPAMtin.it> - 2018-03-08 00:09 +0100
Re: File XML con VB6 RobertoA <amorosik@tiscalinet.it> - 2018-03-08 06:02 +0100
Re: File XML con VB6 "Sauro" <vicchi@crsscala.it> - 2018-03-08 09:18 +0100
Re: File XML con VB6 RobertoA <amorosik@tiscalinet.it> - 2018-03-10 09:18 +0100
Re: File XML con VB6 "Sauro" <vicchi@crsscala.it> - 2018-03-12 13:48 +0100
Re: File XML con VB6 Greg <greg@alicie.com> - 2018-03-12 14:02 +0100
Re: File XML con VB6 "Sauro" <vicchi@crsscala.it> - 2018-03-14 09:29 +0100
csiph-web