attribute and restriction under same roof

Hi all,
I have the following element inside a xsd:sequence.

<xsd:element name="RuleType">
<xsd:annotation>
	<xsd:documentation>The type of the rule that caused the
event.</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
	<xsd:restriction base="xsd:string">
		<xsd:enumeration value="Agent service control"/>
		<xsd:enumeration value="Application analyzer"/>
		<xsd:enumeration value="Application control"/>
		<xsd:enumeration value="Buffer overflow"/>
	</xsd:restriction>
</xsd:simpleType>
</xsd:element>

I would like to add an attribute to this element as shown below

<xsd:attribute name="RuleTypeNum" type="xsd:integer" use="required"/>

I have tried playing with all simpleType, complexType, simpleContent and
complexContent and cant seem to get it right. XMLSpy complains about one
thing or another. Whats a good element type under which xsd:restriction and
xsd:attribute can live together in harmony ?

I have even tried adding xsd:attribute under xsd:restriction. Priscilla
Walmsley's Definitive XML Schema (Appendix A, pg 486) says that restriction
can be a parent to attribute for a local attribute definition. But XML Spy
complains about it and says its unexpected.

I need your suggestions.

I want to be able to do this
<RuleType RuleTypeNum=4>Buffer overflow</RuleType>

Thanks,

Venkat

Received on Friday, 28 March 2003 17:13:42 UTC