11-14-2005 03:24 PM
11-14-2005 03:26 PM
11-14-2005 04:26 PM
here is the source code in VB to create a element :
Dim xmlDoc As New Msxml2.DOMDocument30
Dim root As IXMLDOMElement
Dim newElem As IXMLDOMElement
xmlDoc.async = False
xmlDoc.loadXML "<root><child/></root>"
If (xmlDoc.parseError.errorCode <> 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
MsgBox("You have error " & myErr.reason)
Else
Set root = xmlDoc.documentElement
Set newElem = xmlDoc.createElement("NEW")
root.childNodes.Item(0).appendChild newElem
root.childNodes.Item(0).lastChild.Text = "123"
MsgBox root.childNodes.Item(0).xml
End If
11-14-2005 07:48 PM
There are 2 ways to do this, The very easy way and the less easy (but not too hard way).
The easy way, treat it as a text file, read in the string, parse it splitting before the </sensor> token and concatenate the before match, new event and </sensor> strings, and overwrite the old .XML file (this works well but is not so extensible).
The better method is to use the MSXML com reference. Place a new refernence to the MSXML automation type, and follow the code from your VB script, replacing the set property and methods using property and method nodes under the activeX palet.
Hope this helps.
Paul
11-15-2005 07:58 AM
11-15-2005 09:39 AM
11-15-2005 09:50 AM
11-15-2005 08:27 PM
11-16-2005 12:57 PM - edited 11-16-2005 12:57 PM
Message Edited by PhilHip on 11-16-2005 03:05 PM
11-16-2005 03:51 PM