This week we where given the details for CW2 of CMT3315. We then went through a tutorial on XML syntax. We saw the advantages of using XML Schema Definition (XSD) over Document Type Definition (DTD) to validate and even control the way an XML document is displayed. XSD can define strict data types and even the sort order of an XML file.
We saw the difference between simple and complex types i.e. those that are text only and without any attributes or any other child types are simple. Anything NOT simple is complex.
Restricion on values:
We use <xs:restriction with a set of <xs:enumeration to define a list of possible values for a particular element.
Or use a <xs:patern value = "male/female" />
Or for a number between 1 & 100 inclusive
<xs:minInclusive value="1"/>
<xs:maxInclusive value="100"/>
or <xs:pattern value="[a-z]"/> or ="[0-9]"/>
or a password of 8 mixed characters <xs:pattern value="[a-zA-Z0-9]{8}"/>
Some Simple Types: xs:string, xs:decimal, xs:integer, xs:boolean, xs:date, xs:time, xs:dateTime
No comments:
Post a Comment