XML Fundamentals

Pēdējais mainījis Administrator 2011-06-06 17:32

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

Jauns jautājums:

Prasmes

  1. XML Tools Understand XML specification's general requirements regarding compliant tools.
  2. XML Characters Write correct XML lexical constructs, represent special characters in XML source for various encodings.
  3. XML Entities Understand the behavior of various types of XML entities.
  4. XML Data Model Use namespaces correctly, recognize XML data serializations which are equivalent w.r.t. the XML data model.
  5. DTD and Validation Understand DTD grammars and restrictions imposed by them
  6. SAX Parsing Understand event-based parsing, common architectures and potential uses.
  7. 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

  • 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
  • 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
  • 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

  • 2001
    How do you represent a singe-quote (') in an XML document?
    1. <
    2. "
    3. '
    4. &squote;
  • 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. Ж
    3. Ž
    4. Ž
  • 2004
    <?xml version="1.0" encoding="UTF-8"?> 
    <library xmlns:book="http://www.mycompany.org/book"> 
        <book> 
        </book> 
    </library>
    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. <@title/>
    2. <book:title/>
    3. <#title/>
    4. <-title/>
    5. <5title/>

3. XML Entities

4. XML Data Model

  • 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.
  • 4002
    <contact xmlns:acmer="http://www.acmer.com"> 
    </contact>
    Which one of the following is a good example of a child for the node in the above example code?
    1. <acmer:name>Johnny</acmer:name>
    2. <xmlns:acmer>Johnny</acmer>
    3. <xmlns:name>Johnny</xmlns:name>
    4. <acmer:name>Johnny</name>
    5. <xmlns:acmer:name>Johnny</xmlns:acmer:name>
  • 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.
  • 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

  • 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. <!ELEMENT lunch (soup, maincourse, desert)>
    2. <!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;|%r3;)>
    3. <!ENTITY % seq "(soup|maincourse|desert)">
      <!ELEMENT lunch (%seq;, %seq;, %seq;)>
    4. <!ELEMENT lunch
        (soup?,(maincourse,desert),
        (desert,maincourse) , soup?>
  • 5003
    Which one of the following demonstrates a well-formed, valid XML document?
    1. <?xml version="1.0" encoding="UTF-8" ?> 
      <!DOCTYPE name [<!ELEMENT name (#PCDATA)>]> 
      <name>Fred</name>
    2. <?xml version="1.0" encoding="UTF-8" ?> 
      <!DOCTYPE greeting [<!ENTITY name (#PCDATA)>]> 
      <name>Fred</name>
    3. <?xml version="1.0" encoding="UTF-8" ?> 
      <!DOCTYPE greeting [<!ELEMENT name (#PCDATA)>]> 
      <name>Fred<name>
    4. <?xml version="1.0" encoding="UTF-8" ?> 
      <!DOCTYPE greeting [<!ELEMENT Fred (#PCDATA)>]> 
      <name>Fred</name>
    5. <!DOCTYPE name> 
      <name>Fred</name>

6. SAX Parsing

  • 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

  • 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 <script> 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 <br> tag from HTML.

Citi jautājumi

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