Wednesday, 31 March 2010

CMT3315 – Laboratory 06 – 4 November 09

Quick Questions

1. A DTD is used to describe a document. It is supposed to define the legal building blocks of an XML document. The document structure is defined with a list of legal elements and attributes.

2. You should do the following if you realise that the text contains some arabic characters:

Change the XML declaration to


<?xml version= “1.0” encoding=”ISO 8859-6”?>

3. Can you use a binary graphics file in an XML document?

Yes, you can use binary code in an XML document inside the tags however; the tags must specify that the data is binary.


Longer Questions


1.

a. <targLangPhrase> is used instead of < russianPhrase> because the targLang has already be given the attribute "Russian", therefore not needing <russionPhrase>

b.
The following is a suitable prologue for an xml document, and can be used for the XML document related to this question:


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>


c.

<?xml version="1.0"?>

<!DOCTYPE phrasebook [

<!ELEMENT phrasebook (section,phrasegroup)>

<!ELEMENT section (#PCDATA)>

<!ELEMENT phrasegroup (#PCDATA)>

]>




d. There are no differences in the XML declaration

2.
a. I was instructed to create the following document: -

<?xml version="1.0">



<!DOCTYPE bookproject SYSTEM "bookproject.dtd"><bookproject>

<titlepage>Toba:the worst volcanic eruption of all</titlepage>

<author>John Platts, Jack Brilliant, Jill Bright, Joe Clever</author>

<publisher>Middlesex Press </publisher>

<location>hendon</location>

<titlepageverso>

Copyright 2009 Middlesex press, Published by Middlesex press ltd, london NW4 4BT, ISBN:978-0-596-52722-0</titlepageverso>

<content>Chapter1,Chapter2,Chapter3</content>

</bookproject>



b. The following is the dtd file that validates the above xml code: -

<?xml version="1.0"?>

<!DOCTYPE bookproject[

<!ELEMENT bookproject(titlepage,author+,publisher,location,titlepageverso,content+)>



<!ELEMENT titlepage (#PCDATA)>

<!ELEMENT author (#PCDATA)>

<!ELEMENT publisher(#PCDATA)>

<!ELEMENT location (#PCDATA)>

<!ELEMENT titlepageverso(#PCDATA)>

<!ELEMENT content(#PCDATA)>

<!ELEMENT (#PCDATA)>

]>




Lecture Reflection-WEEK 6 – Name Spaces


In this week, we learnt about namespaces. Namespaces are used to remove the possibility of using the same element names for different purposes. Namespaces indicate the names the belong together and must have a unique name for the element. This is done by using a URI which looks like a web address by assigning it to a namespace element name. The element containing this URI now belongs to this the namespace and will not clash other namespaces.
I also learnt within the lecture that multiple namespaces can be used and had look at how namespaces are declared within a DTD.

http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main

No comments:

Post a Comment