W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2012

Re: What is the data type of a fixed element that has no type attribute?

From: G. Ken Holman <gkholman@CraneSoftwrights.com>
Date: Mon, 26 Mar 2012 14:03:19 -0400
Message-Id: <>
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
At 2012-03-26 17:45 +0000, Costello, Roger L. wrote:
>Hi Folks,
>What is the data type of this fixed element:
>       <element name="Aircraft" fixed="boeing:AC-747" />

A "simple ur-type definition" because you haven't said otherwise.

   W3C Schema Part 1 Section 3.2.2:
   "The default when no simple type definition is referenced or provided
    is the Ěsimple ur-type definitionĚ, which imposes no constraints at all."

>Can an XML instance document specify that its type is a QName, like so:
>       <Aircraft xsi:type="xs:QName">boeing:AC-747</Aircraft>
>That results in an error, why?

There are a bunch of errors there.  To make it well-formed you need:

<Aircraft xsi:type="xs:QName"

But you can't make it schema valid to your 
constraint of the value being a fixed string, 
because the value is a QName.  Lexically they may 
be the same, but the schema values are different types.

If you take out the fixed= from the schema then 
the above instance validates against it because 
there is no constraint on the schema value.

Now, if you change your schema to require the 
value to be a QName, then the above instance will validate against this:

<?xml version="1.0" encoding="US-ASCII"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"

  <xsd:documentation xml:lang="en">


<xsd:element name="Aircraft" fixed="boeing:AC-747" type="xsd:QName"/>


But it won't validate against:


... because the data type states the value is a 
QName and the prefix cannot be resolved.

I think you are mixing up the lexical expression 
and the schema value.  The fixed= constraint in 
the schema is on the schema value, not on the lexical expression.

For example, this validates against the QName schema above:

<Aircraft xmlns:roger="urn:X-MD">roger:AC-747</Aircraft>

... because the constraint is on the schema 
value, not on the lexical value.  In the schema 
value of a QName, the lexical prefix is 
irrelevant and used only to obtain the URI value.

   W3C Schema Part 1 Section 3.2.1:
   "Note that it is values that are supplied and/or checked, not strings."

I hope this helps.

. . . . . . . . . Ken

Contact us for world-wide XML consulting and instructor-led training
Free 5-hour video lecture: XSLT/XPath 1.0 & 2.0 http://ude.my/uoui9h
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/x/
G. Ken Holman                   mailto:gkholman@CraneSoftwrights.com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal
Received on Monday, 26 March 2012 18:08:14 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:16:01 UTC