help with saving from a class to an xml file
hello
I'm looking for help with saving from a class to an XML file example- name of class is "Contacts" and I'm having a hard time with the coding for a "Public function Save" I can create the file but cant save to it what I've been trying
just rewrites the information that was already there. I need to pull the information from a class to a save button.
If anyone could help me with the coding it would be great.
Thank you!
[471 byte] By [
clivng] at [2007-11-11 7:16:46]

# 1 Re: help with saving from a class to an xml file
hi
I actually didn't get your question. But I think that you want to update the Existing XML file with data. If that is the case
Take down my coding
Set xmldoc = CreateObject("MSXML.DomDocument")
If xmldoc.Load("F:\del\t5.xml") Then
Set root = xmldoc.documentElement
'Set e = IXMLDOMElement
'Set nd = IXMLDOMNode
'nd.BaseName = "india"
'nd.Text = "this is our country"
Set e = xmldoc.createElement("xml")
e.Text = "extensible markup language"
root.appendChild e
xmldoc.Save "F:\del\t5.xml"
MsgBox "over"
End If
# 2 Re: help with saving from a class to an xml file
If you want to serialise an object which is an instance of a class
XmlSerializer xs = new XmlSerializer(typeof(<NameSpace.ClassName>));
StreamWriter xw = new StreamWriter(<completefilenamewithpath>, false);
xs.Serialize(xw, <object>);
xw.Flush();
xw.Close();