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

attribute and restriction under same roof

From: Venkat Raghavan <venkat@okena.com>
Date: Fri, 28 Mar 2003 17:19:40 -0500
To: xmlschema-dev@w3.org

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

<xsd:element name="RuleType">
	<xsd:documentation>The type of the rule that caused the
	<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"/>

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>


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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:00 UTC