CMT3315 – Lab Session 02
1. Have a look at the documents below. Some are XML documents, some are HTML documents, some may be neither. See if you can decide which are which.
ANS:
1-HTML, 2-XML, 3-HTML, 4-none (close to XML), 5-none, 6-none (close to XML), 7-HTML with JavaScript
2. Make a list of the distinctive characteristics of an XML document, in terms of things that you can spot when looking at the code.
ANS:
- There is an XML decleration at the top (<?xml version= “1.0” ?>)
- It must have a DOCTYPE declaration
- There is only one root element
- Each opening tag has an exact matching, corresponding closing tag
- Tags cannot be cross nested but yes can be nested
- XML is case sensitive
3. Assume that (with suitable changes) all these documents could become XML documents. Imagine, and describe, applications that could use these documents.
NB I’ve removed one or more lines from each document to stop it being too easy.
ANS:
- A web browser - it could display the values between opening and closing tags but not the tags themself
- Using XSLT some documents can be formated and displayed on a web browser
- Some XML files can be used as a data store (like a flat database file)
- Can be used to transmit data between machines and/or applications
No comments:
Post a Comment