On 20 Apr, 16:11, jlam...@googlemail.com wrote:
> I am in the process of creating a schema definition to validate some
> XML data that will look like the following:
Just don't. This isn't an appropriate concept to try and validate
with schema.
Sadly it's too difficult to spend the full time explaining, given
today's workload. Briefly though:
Schema / DTD validates XML _structure_ and not 'data' content. If you
follow your approach here, you're pushing 'data' items into the
structure by using them to generate element names. This would also
permit DTD / Schema validation ("permit", not "make it easy") of your
data rules. However this is also a use of XML that's usually a bad
idea -- you've implemented something that's changeable in practice
(product structure) and nailed it down with something that really
implies long-term stability (XML Schema).
A better approach would be a simple XML Schema based on just <Product>
as an element and keeping ProductA, ProductB etc. well away from this.
This does make Schema-based validation difficult though and starts to
look like a task for OWL instead. Even then, it's still easy to get to
a stage of complexity where it becomes impossible to validate
automatically. Better than fluid element names though.
|