Week 7 Flashcards
What were the main design goals of XML?
The design goals of the XML mark up language are:
- XML is easy to use over the internet
- XML can support a wide variety of applications
- XML is compatible with SGML
- XML has minimal features
- XML source documents are reasonably clear and legible to humans
- XML has a formal and concise design
- It is easy to write programs to process XML documents
- It is easy to create XML documents
- Terseness in XML mark up is not important
Outline the structure of a standard XML document.
- The Prolog - beginning of an XML document is called the prolog. It contains the special
PI call the XML Processing Instructions, may contain encoding and standalone information.
“Standalone=”no” mean all Document Type Declaration (DTD), if any, is within the xml
document. Example is
The above declaration it may then be followed by a Document Type Declaration
declaration (DOCTYPE) which refers to the “root element” and the DTD file. Example is
- The body of the xml document must start with the “root” element. The “root” element
may contain one or more subelements. Consider the following example. Here root element
is “address” which contains four other subelements. Also note that the DOCTYPE
declaration also refers to “address” element.
<address>
170 Lygon St.
Melbourne
Victoria
3000
</address>
What is meant by a document element? Give a simple example
For an XML document to be well-formed, the root element is the single element that
encloses all the other elements. For an XML document, the root element is the document
element. See the example in Q.2.
Explain what is meant by a document type definition.
Document Type Definition is the particular rules to which the document must conform. The
rules is defined by the document type declarations, attribute list declarations, entity
declarations and other components that are declared together.
Explain the difference between a valid and a well formed XML document.
A well formed XML document is the one that conforms to XML’s basic syntax while a valid
XML document is well formed as well as conforms to the rules that are predefined in the
corresponding DTD file. All valid XML documents are well formed, but NOT all well
formed documents are valid XML documents.
Construct a basic telephone directory as a simple XML document. The root element in the
document should be the phone list. The other elements should be names and telephone
numbers.
There can be many different solution to this problem. The following can be one.
James Cooper
6139999999
Nancy
613000000
Nancy Stern
613000000
Rober Stern
678888888
Identify the syntax errors in the following XML document.
Joe’s Instant Antique Factory
The Correct version is
Joe’s Instant Antique Factory
You may still get an error message for the 2nd line. Syntactically it is
correct. The error message comes as the parser can not find
“catalogue.dtd” file in your machine.