help with saving from a class to an xml file


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: help with saving from a class to an xml file

  1. #1
    Join Date
    Nov 2005
    Posts
    1

    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!

  2. #2
    Join Date
    Nov 2005
    Posts
    7
    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

  3. #3
    Join Date
    May 2005
    Location
    UK
    Posts
    278
    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();
    Sri

Similar Threads

  1. XML from Mainframe flat file
    By Gee in forum XML
    Replies: 11
    Last Post: 08-23-2001, 04:47 PM
  2. file name==class name. why?
    By siva in forum Java
    Replies: 2
    Last Post: 01-03-2001, 10:40 AM
  3. Display xml file
    By rana in forum XML
    Replies: 5
    Last Post: 12-09-2000, 11:50 PM
  4. Problem Converting ADO Recordset to XML
    By CHRISTOS STAVRINOU in forum Database
    Replies: 0
    Last Post: 11-16-2000, 04:56 PM
  5. class outside of its source file
    By haagen in forum Java
    Replies: 1
    Last Post: 08-18-2000, 11:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center