Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I specify a constant attribute in XML Schema?

Tags:

xml

xsd

Reading over the XML Schema specification, I can't see an easy way to mark an attribute as being constant (e.g. in <foo bar="baz" /> the bar attribute must always be baz). The only method I have come up with so far is to use an enumeration with only one element. Is this the preferred method?

like image 518
Chas. Owens Avatar asked Jan 13 '11 14:01

Chas. Owens


1 Answers

<xs:attribute name="bar" type="xs:string" fixed="baz"/> will make the attribute to have the value baz as constant.

like image 118
programmer Avatar answered Nov 14 '22 21:11

programmer