Wednesday, October 13, 2010

Week3

Today we discussed DTD which is used to validate/check xml files. It can be either part of it (inside xml file) or in a sparate .dtd file with a reference from the xml file to it. We saw different types (eg. CDATA etc), and the cardinality & optionality as in;
teacher      1 and only 1 (unary)
course+     1 or more (1..n)
assistant*    0 or more (0..n)
location?    0 or 1 (optional - boolean)
We also saw #IMPLIED (optional), #REQUIRED (NOT optional) & #FIXED (constant)

We also mentioned attributes and their types;
 CDATA – ENTITY – ENTITIES – ID – IDREF – IDREFS – NMTOKEN – NMTOKENS 

We also mentioned LaTeX scripting, AL & Intelligent Agents, and web services (UDDI, WSDL & SOAP)

CMT3315  –  Lab Session 03
Then I did the lab3 exercises:
  1. Write an XML document that contains the following information: your name. Your email address. Your student number. Your home town. Your date of birth. Choose appropriate tags. Use Attributes for the date of birth.
ANS:
<?xml version="1.0" encoding="UTF-8"?>
<!-- a comment -->
<student dob="03/06/1960">
  <name>Tony Montanaro</name>
  <email>tonimonti@gmail.com</email>
  <studentNumber>M00310803</studentNumber>
  <homeTown>Mosta</homeTown>
</student>




2. Have a look at the XML document below. Identify all the syntax errors.
ANS:
<!DOCTYPE countryCollection SYSTEM "countryList.dtd">
<CountryList>
Doctype declaration does not match root element

<!--Data from CIA --Year Book -->
Invalid characters in remarks

<Label>Common Names:</label> 
All tags mismatch on case 

<2ndCity cityNum=”2”>
Cannot start a tag with a number

<Capital>Tokyo</capital cityNum=”1”>
Invalid attribute in END tag

<BorderingBodyOfWater <!--Also Lake Victoria --> >
Invalid remark in opening tag

<MajorCity cityNum=’6’ cityNum=’7’>
Duplicate attribute name in same tag


            </country>     
Missing </CountryList> closing tag

Note  that many errors repeat many times.





No comments:

Post a Comment