Xml doesn't validate -
below xml has dtd schema, doesn't validate, why? checked in eclipse , http://www.xmlvalidation.com/index.php?id=1&l=0:
<?xml version="1.0"?> <!doctype person-list [ <!element person-list (person*)> <!element person (first-name,second-name?,last-name,index-no,birth-date)> <!element first-name (#pcdata)> <!element second-name (#pcdata)> <!element last-name (#pcdata)> <!element index-no (#pcdata)> <!element birth-date (#pcdata)> <!attlist person id id #required> ]> <person-list> <person id="1"> <first-name>ds</first-name> <second-name>asd</second-name> <last-name>asd</last-name> <index-no>34</index-no> <birth-date>1915-01-01</birth-date> </person> <person id="2"> <first-name>dfswsf</first-name> <last-name>sdfsdf</last-name> <index-no>23</index-no> <birth-date>1916-02-02</birth-date> </person> </person-list>
by defining id attribute of student id, cannot start number since "must match name production". can "s1" , "s2", not "1" , "2".
validity constraint: id
values of type id must match name production. name must not appear more once in xml document value of type; i.e., id values must uniquely identify elements bear them.
link:
- attribute type: http://www.w3.org/tr/xml/#sec-attribute-types
- name: http://www.w3.org/tr/xml/#nt-name
Comments
Post a Comment