Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML Schema - only one element should have attribute set to true

How can i define an boolean attribute that can be set "true" only in one element. Following snippet must be invalid.

<products>
  <product featured="yes">Prod 1</product>
  <product featured="yes">Prod 2</product>
</products>
like image 656
Jozef Avatar asked Dec 18 '09 08:12

Jozef


1 Answers

You can't do that with XML Schemas.

You can define attributes on an element, but not limit them to one instance of the element.

like image 121
Oded Avatar answered Sep 28 '22 15:09

Oded