W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2003

Re: Some beginner's questions

From: Jeni Tennison <jeni@jenitennison.com>
Date: Fri, 10 Jan 2003 15:57:05 +0000
Message-ID: <18623934826.20030110155705@jenitennison.com>
To: "Santino Troiani" <santino.troiani@next.it>
CC: xmlschema-dev@w3.org

Hi Santino,

> 1. The layout of the variable part depends on some other information
> pertinent to XML elements of the document. How can I specify this
> constrain ?
>
> <Message id="19">
> ...
>     <Information>
>         <Text>...</Text>
>         <Data ...>...</Data>
>     </Information>
> ...
> </Message>
>
> Based on the value of the attribute "id" the layout of the element
> Data can vary.

You can't express this co-occurrence constraint using XML Schema. You
could use Schematron in conjunction with XML Schema to do it, or you
could switch to RELAX NG, which can express these kinds of
constraints.

> 2. Once I have the document I can validate some its elements against
> a XSD Schema. Can I *generate* an XML document or fragment from a
> XSD schema, with some external decisions provided by the application
> ? If yes how must the schema be structured ?

There are applications around that can do this. A Google search for
"generate instance schema" points to Sun's XML Instance Generator:

  http://wwws.sun.com/software/xml/developers/instancegenerator/

for example. I have an inkling that XML Spy supports something
similar. Any constraints on the structure of the schema are likely to
be implementation specific.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Friday, 10 January 2003 10:57:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:35 GMT