DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  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

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links