Re: fixed attribute in a xsd mapping schema?

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 UTC