I am trying to design an XML schema for books where a unique ID needs to be specified for each book entry. However it just doesn\'t seem to work. Below is the XSD i am using
Do you specifically need to use digits as ID values? If not, one possibility is using xs:ID
as the id
attribute type instead of xs:string
:
That way only unique XML identifiers are allowed as values of the id
attribute. A valid XML identifier can't start with a digit, however, so you'll have to change your ID type to something like id-1
, for example.