1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| REM On initialise le bousin.
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = "false"
xmlDoc.Load("D:\SIO\Dev\TP\test\CoordinateCatalogConfiguration.xml")
REM On vient parcourir les noeuds pour sélectionner celui qui nous intéresse.
dim catalogElement
For Each catalogElement in xmlDoc.selectNodes("/CatalogConfiguration/Catalog[name='UserdefinedExtensionCatalog']/value")
catalogElement.InnerText = "D:\SIO\Dev\TP\test"
Next
REM on met en forme tout le document
set rdr = CreateObject("MSXML2.SAXXMLReader")
set wrt = CreateObject("MSXML2.MXXMLWriter")
Set oStream = CreateObject("ADODB.STREAM")
oStream.Open
oStream.Charset = "ISO-8859-1"
wrt.indent = True
wrt.encoding = "ISO-8859-1"
wrt.output = oStream
Set rdr.contentHandler = wrt
Set rdr.errorHandler = wrt
rdr.Parse xmlDoc
wrt.flush
REM on vient sauvegarder le document à l'endroit voulu.
oStream.SaveToFile "D:\SIO\Dev\TP\test\CoordinateCatalogConfiguration.xml", 2
Set rdr = Nothing
Set wrt = Nothing
Set xmlDoc = Nothing |
Partager