XML Fundamentals

Last modified by superadmin on 2018-01-12 20:24

ItemSet: XML Fundamentals

Understanding of XML 1.0 Specification, DTD grammars, general issues of parsing (independent from language).

New item:


  1. XML Tools

    Understand XML specification's general requirements regarding compliant tools.

    1. XML Characters

    Write correct XML lexical constructs, represent special characters in XML source for various encodings.

    1. XML Entities

    Understand the behavior of various types of XML entities.

    1. XML Data Model

    Use namespaces correctly, recognize XML data serializations which are equivalent w.r.t. the XML data model.

    1. DTD and Validation

    Understand DTD grammars and restrictions imposed by them

    1. SAX Parsing

    Understand event-based parsing, common architectures and potential uses.

    1. Issues of XML Serialization

    Understand practical issues of XML data representation - when to use CDATA or entities, trade-offs between elements and attributes, whitespace and indentations, etc.

1. XML Tools

  1. BasicXML_1001: An XML processor (a well-behaving software module processing XML documents in some manner), when it encounters syntactically wrong XML (one that does not match the W3C specification):

    1. Recovers silently from the error and tries to continue document processing

    2. Uses application-specific method to report the error, tries to recover and continue processing

    3. XML processor should always fail and report the first location (line, column) of the syntax error

    4. XML processor can fail and stop immediately, or it can try to recover - but only to report more errors

  2. BasicXML_1002: The purpose of creating specification of XML in 1998 was to:

    1. Replace the existing HTML language with a new, improved markup

    2. Make SGML documents easier to serve, process and access in the Web

    3. Provide general methods for the visual representation of data

    4. Represent objects from object-oriented languages and their relationships in a human-readable format

  3. BasicXML_1003: Which MIME type is typically configured as the default "Content-Type" header, when a Web server sends XML content to a client browser?

    1. xml-markup 

    2. text/plain

    3. xml/data

    4. application/xml

    5. text/xml

2. XML Characters

  1. BasicXML_2001: How do you represent a singe-quote (') in an XML document?

    1. <tt>&amp;lt;</tt>

    2. <tt>&amp;quot;</tt>

    3. <tt>&amp;apos;</tt>

    4. <tt>&amp;squote;</tt>

  2. BasicXML_2002: How can you insert a letter "Ž" (capital letter "Z" with caron) in an "ISO-8859-1"-encoded XML document?

    1. Write it as "Ž" in a Unicode-enabled text editor

    2. <tt>&amp;#x0416;</tt>

    3. <tt>&amp;Zcaron;</tt>

    4. <tt>&amp;#381;</tt>

  3. BasicXML_2004: {code:xml} http://www.mycompany.org/book"> {code} Referring to the above XML sample code, which one of the following options is legal in line 4, between opening and closing "book" tags?

    1. <tt>&lt;@title/></tt>

    2. <tt>&lt;book:title/></tt>

    3. <tt>&lt;#title/></tt>

    4. <tt>&lt;-title/></tt>

    5. <tt>&lt;5title/></tt>

3. XML Entities

4. XML Data Model

  1. BasicXML_4001: Which one of the following statements is true regarding default namespaces?

    1. A default namespace cannot be bound to any specific URI.

    2. A default namespace requires each element to be use the "default:" prefix.

    3. A default namespace requires all elements that occur more than once in a document to be prefixed.

    4. A default namespace applies only to the element in which it is declared.

    5. A default namespace does not apply to attributes.

  2. BasicXML_4002: {code:xml} http://www.acmer.com"> {code} Which one of the following is a good example of a child for the node in the above example code?

    1. <tt>&lt;acmer:name>Johnny&lt;/acmer:name></tt>

    2. <tt>&lt;xmlns:acmer>Johnny&lt;/acmer></tt>

    3. <tt>&lt;xmlns:name>Johnny&lt;/xmlns:name></tt>

    4. <tt>&lt;acmer:name>Johnny&lt;/name></tt>

    5. <tt>&lt;xmlns:acmer:name>Johnny&lt;/xmlns:acmer:name></tt>

  3. BasicXML_4003: How do you determine whether or NOT an element is using a non-default namespace?

    1. The element starts with the prefix "xmlns:".

    2. The element's name starts with a prefix that has been mapped to a specific URI.

    3. The element's name ends with a colon (':')

    4. The element's name is prefixed by a fully-qualified URI.

    5. The element appears at least twice in the document.

  4. BasicXML_4004: A namespace-aware XML parser checks which one of the following when parsing an XML document?

    1. That each prefix is mapped to a specific URI

    2. That all elements contain colons (:) in their names

    3. That the document does not contain more elements than the namespace defines

    4. That each element makes valid use of its defined namespace URI

    5. That colons (:) are not used within the text value of any element

5. DTD and Validation

  1. BasicXML_5001: You want to express in a DTD grammar that a valid "lunch" element should contain "soup", "maincourse" and "desert" child elements - all 3 should be present, but their order within the lunch can be arbitrary. Which DTD grammar expression for "lunch" represents this rule?

    1. {code}
      <!ELEMENT lunch (soup, maincourse, desert)>

    2. {code}
      <!ENTITY % p12 "(soup,maincourse|maincourse,soup)">
      <!ENTITY % p13 "(soup,desert|desert,soup)">
      <!ENTITY % p23 "(maincourse,desert|desert,maincourse)">
      <!ENTITY % r1 "soup,%p23;">
      <!ENTITY % r2 "maincourse,%p13;">
      <!ENTITY % r3 "desert,%p12;">
      <!ELEMENT lunch (%r1;|%r2;|%r3emoticon_wink>

    3. {code}
      <!ENTITY % seq "(soup|maincourse|desert)">
      <!ELEMENT lunch (%seq;, %seq;, %seqemoticon_wink>

    4. {code}
      <!ELEMENT lunch
        (desert,maincourse) , soup?>

  2. BasicXML_5003: Which one of the following demonstrates a well-formed, valid XML document?

    1. {code:xml}
      <?xml version="1.0" encoding="UTF-8" ?>
      <!DOCTYPE name [<!ELEMENT name (#PCDATA)>]>

    2. {code:xml}
      <?xml version="1.0" encoding="UTF-8" ?>
      <!DOCTYPE greeting [<!ENTITY name (#PCDATA)>]>

    3. {code:xml}
      <?xml version="1.0" encoding="UTF-8" ?>
      <!DOCTYPE greeting [<!ELEMENT name (#PCDATA)>]>

    4. {code:xml}
      <?xml version="1.0" encoding="UTF-8" ?>
      <!DOCTYPE greeting [<!ELEMENT Fred (#PCDATA)>]>

    5. {code:xml}
      <!DOCTYPE name>

6. SAX Parsing

  1. BasicXML_6001: What is the purpose of an XML parser?

    1. It reads XML formatted text and prints it to the user's Web browser.

    2. It compiles XML source code into an XML executable.

    3. It converts XML formatted text into a programmatic data-structure.

    4. It reads XML formatted text and removes the tags so that only data remains.

    5. It converts XML formatted text into an HTML formatted Web page.

7. Issues of XML Serialization

  1. BasicXML_7001: Which one of the following statements is true regarding the specifications for well-formed XHTML?

    1. Attribute values must not be enclosed between quotation marks.

    2. Client-side script code (such as JavaScript) can be freely typed without any special escape characters as long as it resides within <tt>&lt;script></tt> tags.

    3. XHTML cannot be formatted with CSS.

    4. All elements and attributes must be typed in lower-case.

    5. The XHTML specification omits the <tt>&lt;br></tt> tag from HTML.

Unclassified Questions

Created by Kalvis Apsītis on 2007-12-26 17:21
This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 6.4 - Documentation