Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can you edit xml using VBscript?
Message
 
À
22/08/2004 13:10:01
Information générale
Forum:
Visual Basic
Catégorie:
VBScript
Divers
Thread ID:
00935346
Message ID:
00935617
Vues:
18
Yes you can. Here's an example that edits an XML document.
Dim doc
Dim node

Set doc = CreateObject("MSXML2.DOMDocument.3.0")
doc.async = False
doc.Load "c:\books.xml"

If doc.documentElement.hasChildNodes Then
    Set node = doc.documentElement.childNodes(0)
    Set node = node.selectSingleNode("./price")
    MsgBox node.Text
    node.Text = "100.00"
    MsgBox node.Text
    doc.save "c:\books2.xml"
End If

<?xml version='1.0'?>
<bookstore>
  <book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
    <title>The Autobiography of Benjamin Franklin</title>
    <author>
      <first-name>Benjamin</first-name>
      <last-name>Franklin</last-name>
    </author>
    <price>8.99</price>
  </book>
</bookstore>
---
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
http://www.msmvps.com/windsor
http://www.g6consulting.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform