schema and default xml

I

inquirydog

Hi-

I am using xml to hold configuration data for a project, and
using
schema to define what the configuration file should look like. I
wanted to
get some advice on an intelligant way to specify and create a default
config
file. In other words, when the developer puts a new element in the
schema
(ie, backgroundColor), (s)he should also specify the default value
(ie- green). This could be done in the same file as the schema (I
could for certain circumstances use the xsl:default attribute for
simpletypes), or in another file (we could just specify the actual
default value). Then I would like to be able to do the following:

1). Autogenerate the default file from however it is
specified.

2). In the case of a version upgrade in the schema
(configuration file), automatically add in the default values to the
actual configuration file for elements that are added. In other
words, if version 1 only has a "backgroundColor" element, which in the
config file is "rose", and in version 2 the schema adds a
"forgroundColor" with default value "white", a new default file will
be generated by merging the actual config file with the default of the
new version (bgcolor=rose, fgcolor=white- the default fgcolor is taken
since that element is new, the bgcolor default is not set since that
was already specified in the old config file.

In theory this can be done the following way.

1). Encode defaults in the xsd file. For simpleType there is
a xsd:default attribute which would work, for lists something else
would need to be done.

2). Use xslt to translate the data in the xsd file described
in 1). to an xml file.

3). Use some sort of xmldiff program to diff the config file
from the default.

4). Apply the result to the version n+1 default file to build
the new default.

I am unaware of what good xmldiff and xmlmerge style programs
exist to do this. Suggestiong on any of this idea?

thanks
-Inquirydog
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top