Update XML with imported data


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Update XML with imported data

Hybrid View

  1. #1
    Join Date
    Jan 2007
    Posts
    24

    Question Update XML with imported data

    Hi,
    I'm exploring XML for the first time with VB.NET 2005 Express, and I'm having trouble with something.
    The project is an Exchange Rate database, and the data I'm working with is the Country, Currency, Exchange Rate, From Date, To Date.
    I'm reading in a Word document containing the required data, extracting relevant data from it, putting it into a DataSet, and presenting it in a DataGridView, and saving the content to an XML file.
    This is fine.
    What I then want to do is read in a different Word document, extract similar data, put it into the same DataGridView as the first 'import' (i.e. clear any existing content), and when I press Save, add the newly imported data to the first XML file (also saving any modifications the user has made in the DataGridView)
    After this, I'll need to check the complete XML for duplicate entries and remove them (but I'll cross this bridge when I come to it).

  2. #2
    Join Date
    Mar 2007
    Posts
    5
    HI,
    here is an example, try like this

    'Xml Content
    'Name: File.xml
    <Country>
    <Currency>Existingdata</Currency>
    <ExchangeRate>Existingdata</ExchangeRate>
    <FromDate>Existingdata</FromDate>
    <ToDate>Existingdata</ToDate>
    </Country>


    "Code to retrieve or save data in xml fiile
    dim path as string = "C:\"
    Dim ProfXML As New Xml.XmlDocument()
    ProfXML.Load(path & "\File.xml")
    'Root Element - Country
    Dim Ref_Data As XmlElement = ProfXML.DocumentElement("Country")
    'Currencyvalue, ExchangeValue, FromDAtevalue, Todatevalue - Value from datagrid
    Ref_Data.Item("Curency").InnerText = currencyvalue
    Ref_Data.Item("ExchangeRate").InnerText = Exchangeratevalue
    Ref_Data.Item("FromDate").InnerText = FromDatevalue
    Ref_Data.Item("ToDate").InnerText = Todatevalue

    ProfXML.Save(path & "\file.xml")

    Regards,
    Nanda

Similar Threads

  1. Help Please with sorting XML data in datagrid
    By Cab_0001 in forum ASP.NET
    Replies: 7
    Last Post: 01-18-2007, 09:33 PM
  2. Why use XML?
    By Brian in forum XML
    Replies: 5
    Last Post: 01-10-2003, 09:39 PM
  3. XML Startkabel Updates
    By xmlstartkabel in forum XML
    Replies: 0
    Last Post: 10-10-2001, 05:07 AM
  4. Refreshing XML data islands
    By Rod Sanford in forum XML
    Replies: 2
    Last Post: 10-02-2001, 11:54 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