XMLDocument.SaveXML
From Xojo Documentation
Method
Saves the XML to the passed FolderItem.
Example
The following XML, stored in a constant called kXMLTest, is saved to a file selected by the user:
<?xml version="1.0" encoding="UTF-8"?> <League> <Team name="Seagulls"> <Player name="Bob" position="1B" /> <Player name="Tom" position="2B" /> </Team> <Team name="Pigeons"> <Player name="Bill" position="1B" /> <Player name="Tim" position="2B" /> </Team> <Team name="Crows"> <Player name="Ben" position="1B" /> <Player name="Ty" position="2B" /> </Team> </League>
Var saveFile As FolderItem
saveFile = FolderItem.ShowSaveFileDialog("", "Test.xml")
If saveFile <> Nil Then
Var xml As New XmlDocument
Try
xml.LoadXml(kTestXml)
xml.SaveXml(saveFile)
Catch fileError As IOException
MessageBox("Save error: " + FileError.Message)
Catch XMLError As XmlException
MessageBox("XML error: " + XMLError.Message)
End Try
End If
saveFile = FolderItem.ShowSaveFileDialog("", "Test.xml")
If saveFile <> Nil Then
Var xml As New XmlDocument
Try
xml.LoadXml(kTestXml)
xml.SaveXml(saveFile)
Catch fileError As IOException
MessageBox("Save error: " + FileError.Message)
Catch XMLError As XmlException
MessageBox("XML error: " + XMLError.Message)
End Try
End If