"tying-down" a required attribute's value

Hello experts!

I'm trying to restrict a complexType which declares a required attribute
(use="required" on the base type).

Base Type:

<element name="baseElt" type="tns:baseType" />
<complexType name="baseType">
	<sequence>
		<element name="blah" type="any" />
	</sequence>
	<attribute name="type" use="required" type="string" />
</complexType>

In my restricted type I am trying to "fix" the value of that "type"
attribute in my derived type.  For example:

<element name="derivedElt" type="tns:derivedType" />
<complexType name="derivedType">
	<complexContent>
		<restriction base="tns:baseType">
			<sequence>
				<element name="blah" type="any" />
			</sequence>
			<attribute name="type" use="required" type="string"
fixed="derivedTypeType" />
		</restriction>
	</complexContent>
</complexType>

So far so good...my problem is that I don't want people to have to
explicitly DECLARE the type on my derived type.  I would like people to
be able to write the following:

<derivedElt>
	...derivedElt conten goes here...
</derivedElt>

and have the "type" attribute be inserted upon validation -> leading to
the following xml (post validation)

<derivedElt type="derivedType">
	...de content goes here
</derivedElt>

As far as I can tell, however, attributes are only "inserted" with
pre-defined values when their "use" attribute is declared "optional".  I
don't have control over the schema of the base type in this case (it's a
handed-down schema), and I'd like to allow my users to forgo the
explicit declaration of the "type" attribute on their <derivedElt>
instances.

Any ideas?

thanks!
--saul

Received on Monday, 9 September 2002 16:27:04 UTC