Altova Mailing List Archives

attribute and restriction under same roof

From: Venkat Raghavan <venkat@-----.--->
To: xmlschema-dev@--.---
Date: 3/28/2003 12:20:00 PM

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 XMLSpy">XMLSpy
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>



From xmlschema-dev-request@t... Fri Mar 28 19:23:27 2003
Received: from 


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.