W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2002

extension element question

From: <David.Cantrell@Gunter.AF.mil>
Date: Fri, 25 Oct 2002 15:48:15 -0500
Message-ID: <092C0521BB49C34AB7DF7578B6D513E00142B04C@fsjubj09>
To: xmlschema-dev@frink.w3.org

Hello again schemers,

I am going through the XFront schema tutorial[0] and have hit a spot that I
don't quite understand.

Why are the simpleContent and extension elements required here:

	<xsd:complexType name="linkType">
		<xsd:simpleContent>
			<xsd:extension base="xsd:string">
				<xsd:attribute name="title"
type="xsd:string" use="required"/>
				<xsd:attribute name="action"
type="xsd:string" use="required"/>
			</xsd:extension>
		</xsd:simpleContent>
	</xsd:complexType>

I'm not extending any types, at least not intentionally, so I'm not sure why
it's required. The element I'm trying to create should look like this:

	<link title="foo" action="bar"/>

There are no child elements or character data, the element will always be
empty except for the two required attributes.

Also, I don't quite understand exactly what the simpleContent element really
does. The MSXML docs state:

	"Contains extensions or restrictions on a complexType element with
character data or a simpleType element as content and contains no elements."

I don't fully understand exactly what that means. Since there is no CDATA
and it is not a simpleType, and definitely does not contain any child
elements, I see no reason for this element to be required.

However, if I eliminate either the extension or the entire simpleContent
wrapper, the validation fails and reports I did not declare a root element
(not shown in the above schema snippet)... :(

Thanks,
-dave

[0] http://www.xfront.com/#schema
Received on Friday, 25 October 2002 16:48:32 GMT

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