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 8366179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:51:06+00:00 2026-06-09T12:51:06+00:00

I’m working with an application that needs to compare data in a database to

  • 0

I’m working with an application that needs to compare data in a database to data in an XML file. The problem is that when it compares, there is a failure when missing elements in the XML file are treated as empty strings and thus are not matched correctly to the data in the database.

The application itself creates the XML file, so I have control over that. What I’d like to do is set the default for all elements in the XML file so that missing elements in the XML file are converted to NULL when that XML file is later read into a dataset.

The source data is a dataset — the data could come from different tables or views in a different database. The only solution I’ve been able to find for this type of problem has been using something like [XmlElement("object1"), DefaultValue(NULL)] before the object when setting up the class. How could this be accomplished for a dataset when the columns in the table(s) would be different for different source tables?

Here is the current code that does the serializing to an XML file:

            TextWriter tw = new StreamWriter(fileNameAndPath);
            XmlSerializer xs = new XmlSerializer(typeof(DataCopy));
            xs.Serialize(tw, DataCopyLog1);

Here is the class definition of the DataCopy:

public class DataCopy
{
    public DateTime LastCopy { get; set; }
    public DataSet Data { get; set; }

    public DataCopy() 
    {
        Data = new DataSet();
        LastCopy = DateTime.Now;
    }
}
  • 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-09T12:51:08+00:00Added an answer on June 9, 2026 at 12:51 pm

    Since no one ever commented, I thought I’d leave how this was resolved: it wasn’t. I couldn’t find a way to properly get nulls into the XML and read back out as nulls when loaded into the DataTable; every time it would be loaded as an empty string.

    The underlying problem was attacked in a different way instead. The project now requires primary keys on the tables it is working with, so that way there are no nulls in the actual data that is being compared for if it is a new row, deleted row, etc.

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

Sidebar

Related Questions

I'm working with an upstream system that sometimes sends me text destined for HTML/XML
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I know there's a lot of other questions out there that deal with this
I have a reasonable size flat file database of text documents mostly saved in
I'm parsing an XML file, the creators of it stuck in a bunch social
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.