XML schema still allowing duplicate id's with unique

后端 未结 2 1766
心在旅途
心在旅途 2021-01-18 14:40

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

2条回答
  •  星月不相逢
    2021-01-18 15:16

    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.

提交回复
热议问题