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.



Jeni Tennison
Received on Wednesday, 9 July 2003 05:07:19 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:02 UTC