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

  • Home
  • SEARCH
  • 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 1026969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:09:58+00:00 2026-05-16T12:09:58+00:00

This question concerns XML schemas and files. Suppose I am developing a desktop application

  • 0

This question concerns XML schemas and files.

Suppose I am developing a desktop application with a file-based interface, i.e. the user stores their progress in a file on disk – pretty standard for the vast majority of productivity applications and many more besides. The file is fundamentally XML, whose schema is stored by some means or another within the application.

It is acknowledged that the schema is very likely to change as new features are added. Therefore, for rigorous compatibility management, I’d like to make sure that the program can tell by inspecting the file which exact schema version it was last saved under, and automatically pipeline the file through one or more transforms to express it as the working file format i.e. the most recent schema revision.

What is the best-practice way to implement this kind of functionality? The simplest method seems to me to use a different schema namespace for each revision and ensure that at least the document element of the file references the correct namespace. The trouble with this approach is that, to my mind, it breaks the relationship of file structures to one another – i.e. the document element of a file saved under revision x is the same type as the corresponding element under revision y, but as far as the application knows, they’re unrelated unless I explicitly tell it otherwise. However, I dare say that this sort of logic is part of the reason for the existence of XML namespaces, so I’m honestly not sure. What say you, SO?

edit #1:

It appears upon further inspection that XML Schema provides a ‘version’ attribute natively. This is presumably the source of the string property “Version” for the XmlSchema type in .Net, which is my intended platform. This is all well and good, but getting i) my files and ii) my application to respect this value is another matter. It would be trivial, as kbrimington suggests, to mandate a ‘schema version’ attribute in application files. Then I simply match the version attribute from a loaded xml file to a schema, run validation, and have the application throw a fit/politely chide the user/bravely struggle on as appropriate.

edit #2:

In case anyone is interested, I have gone with using the ‘version’ attribute on the Schema, and matching this to a custom Attribute which is applied to a wrapper. The wrapper retrieves a string from a project Resources file representing the schema (there will be a check to ensure that the version of the schema and the version specified by the attribute matches). The first thing that main() does is build a lookup table of schemas to use, indexed by version, using Reflection to examine the available version wrapper types. This sounds like an overengineered way of doing things, but I’m trying to think ahead and build redundancy and flexibility in by using several arbitrary steps into which new functionality could be inserted. Possible improvements include implementing a custom resource manager type to sidestep some of the Heath-Robinson functionality described here.

  • 1 1 Answer
  • 3 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-05-16T12:09:59+00:00Added an answer on May 16, 2026 at 12:09 pm

    Many file formats, XML and otherwise, put some thought toward forward compatibility. Even the bitmap format has elements in the header that define how large the header is so that new bitmap formats can be defined with a different header structure.

    I would recommend defining at least some invariant rules about your file format. A version indicator could be a namespace, as you suggested, a file extension, or even just an element in a known position in the document.

    If you can say “There will always be a <version> element here, regardless of schema, which I can use to determine which version of the schema to use when validating…”, then the problem is solved. The point is to have something you can depend on to determine the version, regardless of what else might change.

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

Sidebar

Related Questions

This question concerns a Tomcat 7 web application, which is connected to a MySQL
This question concerns running python files in terminal that are not stored in the
I am using Sqlite3 with Flask microframework, but this question concerns only the Sqlite
This question concerns the reflection mechanisms of the java programming language. I have an
This question concerns generics and types as well as datatables. The following snippet is
This question concerns memory in Android. My method: I have two activites, A and
While this question concerns the formatting of LaTeX within Emacs (and maybe Auctex), I
Although this question concerns EhCache primarily, it really applies to caching frameworks (and plain
My question concerns using aidl.exe (on a Windows system) from the command line. This
This question has come out of another , which concerns the behaviour of console.dir

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.