Save() |
Top Previous Next |
NOTE: If the file passed in <strFileName> already exists then the CommandoXML object will overwrite it (or return False if it cannot be overwritten).
Example VBScript Code
Private Sub DemoXML()
Dim oXML, ndRoot, ndChild Dim sBuff, i
'Create the object Set oXML = oUTILITIES.NewCommandoXMLObject()
'Using the With / End With statements make for easy shortcuts With oXML sBuff = "<ROOT></ROOT>" .OpenFromString sBuff Set ndRoot = .GetRootElement() .SetAttribute ndRoot, "DATE", oUTILITIES.VBFormat(Now, "dd mmm yyyy") 'Add Some Child Nodes sBuff = "<CHILD></CHILD>" For i = 1 To 10 Set ndChild = .XMLAddNode(ndRoot, sBuff) .SetAttribute ndChild, "INDEX", i Next 'save the XML If Not .Save(oUTILITIES.Outputfolder & "MyFileName.XML") Then SMEvent.Raise "ERROR", "XML Save Failed" End If End With 'Clean up the objects Set ndRoot = Nothing Set ndChild = Nothing Set oXML = Nothing
End Sub
See Also: oUTILITIES.NewCommandoXMLObject() |