XML Test Answers

XML Exam for INDE 498 A				                  Name: _Solution Set__

MY BEST ANSWERS ARE IN BLUE

1. To get you started: Place the letter for the best description in front of each term 
   (place each letter on the right once in front of the best term on the left).

__d__ XML Schema  a. a document validating language not following XML syntax
__a__ DTD         b. a methodology and syntax for generating new markup languages
__c__ XSLT        c. a document translating language that strictly follows XML syntax
__b__ XML         d. a document validating language that strictly follows XML syntax

Most of you got these correct. I would hope so as this answer is the minimum you should
know about XML and related technologies going forward in life.

2. Which of the following changes would you have to make to encode an HTML document according to 
   the XHTML specification? (circle the letter before all changes to be made)

a. add a <?xml ... ?> directive tag at the beginning of the document in place of the <HTML> tag
b. change each tag and attribute name, if necessary, to be consistent in case use
c. place a quotation mark (") before and after all attribute values that currently lack them
d. add forward slash characters ('/') before the ending > symbol of all img and br tags
e. convert all HTML 2 tags to HTML 4 tags

These should be obvious as you review Chapter 1 of our XML book (page 23). HTML 2 tags are
already HTML 4 tags as the HTML standard is backward compatible.

3. Which of the following are advantages of using XHTML instead of HTML for sharing presentation data over 
   the Web? (circle the letter before each correct answer)

a. XHTML is easier to validate because there is an available XML Schema that automates the process.
b. Human beings can write XHTML much easier than they can write HTML.
c. Applications that use XML documents are easier to write with a strict specification.
d. Languages built upon XML technology contain more specific subject matter than non-XML encodings.
e. XHTML has been available for use in popular Web browsers much longer than HTML

I threw out part d. of this question as I began to read it differently based on your answers.
My intent was to test your knowledge of whether XML had any built-in ability to specify the subject matter. The 
subject matter must be added to the document by a domain specialist just as is necessary with a non-XML
encoded document. The XML is intended to be just a mark-up of existing data. But, you could have thought I was
asking about the schema's ability to keep the data within a defined range (or enumeration). I wasn't but I bet
some of you were thinking that way when you answered. The other answers should be obvious based on lecture and
reading the book. Most of you got them correct.

4. Which of the following statements are true regarding DTD and XML-Schema:
   (circle the letter before all those that are true statements)

a. Both DTD and XML Schema exist to validate XML documents.
b. XML Schema is a more recent technology than DTD technology.
c. DTD includes native types and grouping elements that XML Schema does not.
d. DTD and XML Schema documents become more valuable as XML languages gain acceptance.
e. XML syntax rules apply to both DTD and XML Schema when determining document validity.

XML Schema includes the native types and grouping elements, not DTD.
There is no requirement that DTDs follow XML syntax rules (obvious by looking over the lack
of quotation marks around attribute values for example).

5. Which of the following does an XML Schema document give you that a DTD does not?
   (circle the letter in front of all XML Schema benefits)

a. the ability to verify the XML Schema document using the same XML validation techniques as the XML document itself
b. a useful distinction between local and global objects
c. a finer distinction between data types for element content and attribute values
d. the ability to parse (identify the keywords within) the document with standard XML parsing software
e. backward integration with documents written prior to the XML specification

Most of you got these correct. XML Schema follows the XML specification. DTD allows for
backward integration with other validated documents prior to XML, not XML Schema

6. XML Schema documents are usually declared externally (in a separate file on a Web server). Which
   of the following is the proper way to let an XML processing application know immediately there is 
   an external XML Schema document available for use? (circle the letter before the one best answer)

a. add a standalone="no" attribute to the opening <?xml directive.
b. add a standalone="yes" attribute to the opening <?xml directive.
c. add a public="no" attribute to the DOCTYPE element
d. add a public="yes" attribute to the DOCTYPE element
e. add a private="no" attribute to the DOCTYPE element

The DOCTYPE element is a DTD-related concept, not XML Schema. Most of you got this right.

7. Identify the significance of the following DTD element (place a letter from the right in the 
   blank before the best component on the left):

<!ELEMENT w x | (y, z)>

__b__  w  a. the name of a single element that can be nested inside this element
__a__  x  b. the name of a valid element for the XML document
__e__  |  c. one element name that can be nested inside this element before another required element
__c__  y  d. one element name that can be nested inside this element after another required element
__f__  ,  e. the declaration that a choice can be made
__d__  z  f. the identification of the sequencing within the document
          g. none of the above

An example of this would be <!ELEMENT circle center | (top, right)> for the definition
of the center of a circle.

8. Identify the significance of the following DTD element (place a letter from the right in 
   the blank before the best component on the left):

<!ATTLIST w x CDATA #IMPLIED>

__d__  w        a. declares that the attribute is required 
__c__  x        b. declares that the attribute is optional 
__e__  CDATA    c. the name of a valid attribute for the XML document
__b__  #IMPLIED d. the name of a valid element for the XML document
                e. declares that any stream of characters can be placed in the attribute value
                f. none of the above
                
An example of this would be <!ATTLIST circle radius CDATA #IMPLIED> for part of the
definition of a circle.

9. Which of the following is true of XSLT? (circle the letter before all true answers)

a. One XSLT document is used to convert an XML document into many different types of documents.
b. XSLT processors are embedded in most of the popular Web browsers used to browse Web content.
c. XSLT generates output through the use of templates that connect to elements in an XML document.
d. XSLT includes XSL-FO (for Formatting Objects) technology that is also managed by the W3C
e. XSLT is designed in order to be able to convert HTML documents into XHTML documents 

a. is incorrect because one XSLT document converts many different XML documents (all based on
the same schema) to one type of output document. b. is incorrect because you need an external application to
process XSLTs (such as SAXON mentioned in the book). d. is incorrect because XSL-FO is separate to XSLT and
explicitly split off from XSLT by the W3C. e. is incorrect because you can use XSLT to convert XHTML to HTML 
but not the other way around.

10. Given a future where XML thrives even well beyond today's successes, which of the following make
    sense as research directions for XML technology? (circle the letter before all correct answers)

a. Developing database technology where XML documents are stored in their raw XML format.
b. Developing document use analysis technologies that can help suggest proper schemas for XML-based languages.
c. Developing database technology where all Web database interaction is done via XML-based documents.
d. Developing better XML processing technologies that are made freely available to everyone
e. Developing Web services technology where all information passing and service interaction is done via XML-based documents.

XML is ripe to perform all these services and therefore these opportunities deserve continued research as 
long as XML is thriving.

11. What is the significance of the following XML Schema and XSLT element names to their related XML document? 
    (place one letter from the right in the blank before the best element on the left)

__d__ xsd:choice      a.  tells the XML document certain elements must be in a certain order
__a__ xsd:sequence    b.  processes an XML element there only if it meets a true/false condition
__b__ xsl:if          c.  processes a document by looping instructions for a set of elements
__c__ xsl:for-each    d.  tells the XML document only one of a set should be used in an element
__e__ xsd:group       e.  tells the XML document these elements should be considered together

The class did very well on this question.

12. When considering XHTML (or HTML) presentation formatting with tables, which of the following are 
    true statements (circle the letter before all correct answers):

a.	width attributes within td elements tend to define maximum width more so than minimum width.
b.	height attributes should never force a change of font size according to the XHTML specification.
c.	Tables automatically modify all visual elements equally to meet overall height and width requested.
d.	A td element may contain a table element between its  and  tags.
e.	The ratio attribute can be used to guarantee image resizing to maintain aspect ratio.

Tables do not modify images ever, no matter what height and width specifications. There is no
such thing as a ratio attribute. The ratio is calculated internally based upon accessing the image file referenced.

13. Which of the following statements are true regarding Uniform Resource Locator (URL) use in Web technologies 
    such as XML and XHTML? (circle the letter before all correct answers)

a. URLs that begin with a protocol (http://, ftp://, udp:// etc.) specification are all absolute.
b. Relative URLs can identify a parent directory via the use of two periods (..).
c. Relative URLs can identify a child directory via the use of two periods (..).
d. Generally you should always use relative URLs, when possible, for portability.
e. The URL specification allows for the use of forward (/) or backward (\) slashes in valid addresses.

The class did very well on this question.

14. Which of the following statements are true regarding XML and related technologies? (circle the letter 
    before all true answers)

a. XHTML can be written with a simple text editor as it discourages word processing meta characters.
b. XSLT allows you to translate multiple XML documents with the same XSLT document.
c. An XML Schema document might refer to another XML Schema document when processing XML.
d. XML documents become more valuable as data is reused in multiple applications.
e. Agreeing on XML tag keywords for an industry with many constituents is often much more difficult than 
   writing an XML Schema document for it.

These are all true statements, especially e. Agreement of vocabulary and relationships between concepts
is a very complex task. Humans do it better than computers, but humans are also more easily biased than
computers. The personal biases ( or experiences) make the process significantly more difficult.

15. Which of the following zodiac_sign elements could be valid according to the W3C XML 1.0 
    specification? (circle the letter before all those that are valid (proper))

a. <zodiac_sign type=animal>Leo</zodiac_sign>
b. <zodiac_sign type="animal">Aries</zodiac_sign>
c. <zodiac_sign type=animal name=Taurus/>
d. <zodiac_sign type="inanimate object">Libra</zodiac_sign>
e. <zodiac_sign "life class"="animal">Cancer<zodiac_sign>

The class did very well on this question. a. is incorrect because you
must have quotes around attribute values and animal does not. c. is incorrect for the same
reason. e. is incorrect because attribute names can not have spaces in them and life class
has such a space.

16. If you want to guarantee that there are only a limited number of possible values for a leaf 
    node element (meaning an element without children) to contain in a valid document based on 
    your markup language, which XML Schema feature can you take advantage of to document the only 
    valid values (circle the letter before the one best answer):

a. the xsd:enumeration element.
b. the xsd:validlist element
c. the ability to identify valid values in a list within parenthesis
d. the ability to redefine elements of the same name multiple times
e. XML Schema does not provide the ability to guarantee limited valid values within elements

See page 83 in our XML book

17. Which of the following is true about the relationship between XHTML elements and attributes? 
    (circle the letter before all true answers)

a. All elements must contain at least one attribute.
b. Attribute names can be reused within tags of different element types.
c. Attributes extend elements to make the element more specific in significance.
d. Elements can contain other elements.
e. Attributes can contain other attributes.

The class did very well on this question.

18. Which of the following is the best description of the relationship between HTML and XHTML 
    (circle the letter before the one best answer):

a. XHTML is a subset of HTML
b. HTML is a subset of XHTML
c. HTML is an XML encoding of XHTML
d. XHTML is an XML encoding of HTML
e. HTML the result of an XSLT application of XHTML

Say that over and over again like I did in class and in your Project 1 Requirements. All other
answers are quite false in comparison. HTML is not the result of anything to do with XML. It came first.

19. Which of the following is the best description of the use of the match attribute within the XSLT 
    language (circle the letter before the one best answer):

a. Often found in the xsl:stylesheet element, the match attribute identifies which version of the validating schema should be used in the XSLT process.
b. Often found in the xsl:stylesheet element, the match attribute identifies which version of XML is being used when considering the input document in the XSLT process.
c. Often found within xsl:template elements, the match attribute identifies which elements in the source document should be input during this piece of the XSLT process.
d. Often found within xsl:template elements, the match attribute identifies which elements in the target document should be output during this piece of the XSLT process.
e. Often found within XSLT processing directive elements such as xsl:sort or xsl:filter, the match attribute identifies further information in terms of how to match input and output documents.

See page 139 in our XML book
   
20. Your turn. Write an XML-related question and answer that shows off your knowledge on the subject (i.e.   
    something not covered by questions in the test above):