Newbie: Schema to XML to Schema

This should cover W3C XML Schema, Relax NG and DTD related problems.
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


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:

<classify level="1">
<classify level="2">
<classify level="3">
<title>PM10 emission</title>

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.

<classify level="1" title="Atmosphere">
<classify level="2" title="Composition">
<classify level="3" title="Emissions">
<evaluate title="PM10">
<result type="quantitative">
<outputs> content in here for key outputs... </outputs>
<assessment id="2">

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,


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.


Post Reply