Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9314141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T02:03:46+00:00 2026-06-19T02:03:46+00:00

I have a timer application that I am working on that uses two separate

  • 0

I have a timer application that I am working on that uses two separate XML files to store data. XML File 1 stores summary data for the time allotted and the name of the game. XML File 2 stores the contents of a dataset which is more of a narrative of events. This allows the user to load saved data and basically start from where they left off. I am using serialize/deserialize for XML File 1 and loading the values into variables and dataset.XMLReader(xml file path) to load the dataset.

I would like to combine the two XML files, but after a couple of hours of searching around and trying bits of different code I have hit an impasse. Is what I am attempting to do even possible?

One of my thoughts was instead of using serialization/deserialization for XML File 1, retool my application (ugh) to load these variables into a dataset as well, then populate the variables from there. But then I still have the problem with dataset.XMLReader(xml file path) running into issues with either multiple root nodes or inconsistent node structures.

Questions, comments or holy grail solution that makes my life easier in 3 lines of code much appreciated.

Code for XML File 1:

    static public void SerializeToXML(TimeData times, String filename)
    {
        XmlSerializer serializer = new XmlSerializer(typeof(TimeData));
        TextWriter textWriter = new StreamWriter(filename);
        serializer.Serialize(textWriter, times);
        textWriter.Close();
    }

    private void DeSerializeFromXML(string filename)
    {
        XmlSerializer serializer = new
        XmlSerializer(typeof(TimeData));

        FileStream fs = new FileStream(filename, FileMode.Open);
        XmlReader reader = XmlReader.Create(fs);

        TimeData i;
        i = (TimeData)serializer.Deserialize(reader);            

        [bunch of code to convert ticks to readable time values and whatnot]

        fs.Close();
    }


XML File 1:

<?xml version="1.0" encoding="utf-8"?>
<TimeData>
  <Name>Test</Name>
  <TimeAllotted>76000000</TimeAllotted>
  <CumulativeTime>0</CumulativeTime>
  <TimeRemaining>76000000</TimeRemaining>
</TimeData>

Code for XML File 2:

Essentially it is just ds.ReadXml(xmlFileName); and ds.WriteXml(newFilename);

XML File 2:
<?xml version="1.0" encoding="utf-8"?>
<Detail>
  <Timer>
    <ID>1</ID>
    <Segment>1</Segment>
    <Event>Start</Event>
    <Value>00:00:00</Value>
    <Notes>Some Text</Notes>
  </Timer>
    <Timer>
      <ID>2</ID>
      <Segment>1</Segment>
      <Event>Start</Event>
      <Value>00:00:00</Value>
      <Notes>Some More Text</Notes>
  </Timer>
</Detail>

What I would like the resulting XML file to look like, or at least something similar containing all the data from above:

XML File 1:
<?xml version="1.0" encoding="utf-8"?>
<TimeApp>
  <TimeData>
    <Name>Test</Name>
    <TimeAllotted>76000000</TimeAllotted>
    <CumulativeTime>0</CumulativeTime>
    <TimeRemaining>76000000</TimeRemaining>
  </TimeData>
  <Detail>
    <Timer>
      <ID>1</ID>
      <Segment>1</Segment>
      <Event>Start</Event>
      <Value>00:00:00</Value>
      <Notes>Some Text</Notes>
    </Timer>
      <Timer>
        <ID>2</ID>
        <Segment>1</Segment>
        <Event>Stop</Event>
        <Value>00:00:00</Value>
        <Notes>Some More Text</Notes>
    </Timer>
  </Detail>
</TimeApp>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T02:03:47+00:00Added an answer on June 19, 2026 at 2:03 am

    The problem is solved and I did it by utilizing the age old “one step back, two steps forward” method.

    Instead of housing the data I want to save in the XML file in a data table and a group of class variables, I am putting both in separate data tables within the same dataset. At this point all that needs to be done is a dataset.GetXML, which is then saved out to an extremal file. To reload, simply use dataset.ReadXML(xmlFilename).

    Problem solved. Hope that this helps someone in a similar pickle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that uses SQLite(version 3.7.2) to store data. I have a
I have a log file in SqlServer that stores the time an application started,
I am currently working on rails3 application that uses jQuery. I have a javascript
I currently have an application that uses location services and is working great on
I have a web application that I am currently working on that uses a
I have an application that uses several configuration files (let just consider appli.properties here).
I am working on an application that uses Swing. I have a JTabbedPane, and
We have an n-tier web application that pulls data from SQL Server. Our Data
I have a ASP.NET MVC3 application that handles time-consuming processes (copying a large file
I am working on a rails application that uses big javascript libraries (e.g. jquery

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.