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

Re: fixed attribute in a xsd mapping schema?

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 9 Jul 2003 10:07:09 +0100
Message-ID: <192168287424.20030709100709@jenitennison.com>
To: Tomas.Oberg@partnertech.se
CC: xmlschema-dev@w3.org

Hi Tomas,

> Hi! I would like to have a fixed attribute in an element of my xsd
> schema which maps to a SQL Server 2000 database. Is that possible?

You can have a fixed attribute (an attribute with a fixed value)
easily enough, using the 'fixed' attribute on the attribute
declaration. For example:

  <xs:attribute name="foo" fixed="bar" />

means that if the foo attribute appears in the document then it must
have the value 'bar'.

> What I'm trying to solve is: to have different datatypes depending
> on what the contents of an element is. Is there a workaround?

I'm not sure exactly what you mean by having different datatypes
depending on the content of an element, but it sounds as though it
might be a co-occurrence constraint of some kind, in which case you
might be out of luck. If you provide some examples of what you're
trying to achieve (some valid and invalid elements) then we might be
able to help, or at least tell you whether it can or can't be done.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Wednesday, 9 July 2003 05:07:19 GMT

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