Newbie: Schema to XML to Schema

This should cover W3C XML Schema, Relax NG and DTD related problems.
Michael
Posts: 1
Joined: Tue Apr 08, 2008 11:28 am

Newbie: Schema to XML to Schema

Post by Michael » Tue Apr 08, 2008 6:24 pm

Hi,

I have created TEMPLATE.XSD for designing environmental surveys. The survey is made up of questions that are categorised via a hierarchy of criteria.

The three element types are:
<template> the top-level container,
<classify> a node for classifying the questions, nested to some arbitrary depth,
<evaluate> a node for the question, the data format of the answer, and how it can be obtained (eg. calculation, scientific model...) For example:

<template>
<classify level="1">
<title>Atmosphere</title>
<classify level="2">
<title>Composition</title>
<classify level="3">
<title>Inputs</title>
<evaluate>
<title>PM10 emission</title>
<author>Me</author>
<quantitative>
<units>g/km</units>
<method>simulator</method>
<tool>LCA_ware</tool>
</quantitative>
</evaluate>
</classify>

From TEMPLATE.XSD the next step is to create TEMPLATE.XML — the schema/design for the survey details (the actual questions grouped by nested criteria, and the elements+format for each response).

What I can't work out is how to generate SURVEY.XSD from the content of TEMPLATE.XML (via an XSLT, but that's not the problem part). SURVEY.XSD is the schema for SURVEY.XML which will contain the responses collected each time the survey is conducted. There needs to be one and only one answer to each question specified in TEMPLATE.XML.

<assessments>
<assessment>
<classify level="1" title="Atmosphere">
<classify level="2" title="Composition">
<classify level="3" title="Emissions">
<evaluate title="PM10">
<author>Me</author>
<result type="quantitative">
<value>1.5</value>
<range>
<upper>1.8</upper>
<lower>1.2</lower>
</range>
<inputs>http://www.mysite.com/Test1/q1.1.1_inputs.htm</inputs>
<outputs> ...free-form content in here for key outputs... </outputs>
<networkDiagram>http://www.somelinktoresult...</networkDiagram>
<error>Low</error>
...
</assessment>
<assessment id="2">
...
</assessment>
</assessments>

I feel that I'm probably well wide of the mark. My other idea is that the second XML document, SURVEY.XML, contains only <assessment> and <evaluation> elements, and each <evaluation> element uses key and/or keyref to link to the corresponding <evaluation> in TEMPLATE.XML.

Any thoughts gratefully received,

Michael

Dan
Posts: 484
Joined: Mon Feb 03, 2003 10:56 am

Re: Newbie: Schema to XML to Schema

Post by Dan » Mon Apr 28, 2008 3:01 pm

Hello Michael,

Can you give us some real samples? It's hard to see the big picture.

Regards,
Dan

Post Reply