ItemSet: XML Fundamentals
Understanding of XML 1.0 Specification, DTD grammars, general issues of parsing (independent from language).Skills
- XML Tools
Understand XML specification's general requirements regarding compliant tools. - XML Characters
Write correct XML lexical constructs, represent special characters in XML source for various encodings. - XML Entities
Understand the behavior of various types of XML entities. - XML Data Model
Use namespaces correctly, recognize XML data serializations which are equivalent w.r.t. the XML data model. - DTD and Validation
Understand DTD grammars and restrictions imposed by them - SAX Parsing
Understand event-based parsing, common architectures and potential uses. - 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
- 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):
- Recovers silently from the error and tries to continue document processing
- Uses application-specific method to report the error, tries to recover and continue processing
- XML processor should always fail and report the first location (line, column) of the syntax error
- XML processor can fail and stop immediately, or it can try to recover - but only to report more errors
- 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):
- Recovers silently from the error and tries to continue document processing
- Uses application-specific method to report the error, tries to recover and continue processing
- XML processor should always fail and report the first location (line, column) of the syntax error
- XML processor can fail and stop immediately, or it can try to recover - but only to report more errors
- BasicXML_1002: The purpose of creating specification of XML in 1998 was to:
- Replace the existing HTML language with a new, improved markup
- Make SGML documents easier to serve, process and access in the Web
- Provide general methods for the visual representation of data
- Represent objects from object-oriented languages and their relationships in a human-readable format
- 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?
- xml-markup
- text/plain
- xml/data
- application/xml
- text/xml
2. XML Characters
- BasicXML_2001: How do you represent a singe-quote (') in an XML document?
- <
- "
- '
- &squote;
- BasicXML_2002: How can you insert a letter "Ž" (capital letter "Z" with caron) in an "ISO-8859-1"-encoded XML document?
- Write it as "Ž" in a Unicode-enabled text editor
- Ж
- Ž
- Ž
- BasicXML_2004: Referring to the above XML sample code, which one of the following options is legal in line 4, between opening and closing "book" tags?
<?xml version="1.0" encoding="UTF-8"?> <library xmlns:book="http://www.mycompany.org/book"> <book> </book> </library>
- <@title/>
- <book:title/>
- <#title/>
- <-title/>
- <5title/>
3. XML Entities
4. XML Data Model
- BasicXML_4001: Which one of the following statements is true regarding default namespaces?
- A default namespace cannot be bound to any specific URI.
- A default namespace requires each element to be use the "default:" prefix.
- A default namespace requires all elements that occur more than once in a document to be prefixed.
- A default namespace applies only to the element in which it is declared.
- A default namespace does not apply to attributes.
- BasicXML_4002: Which one of the following is a good example of a child for the
<contact xmlns:acmer="http://www.acmer.com"> </contact>
node in the above example code? - <acmer:name>Johnny</acmer:name>
- <xmlns:acmer>Johnny</acmer>
- <xmlns:name>Johnny</xmlns:name>
- <acmer:name>Johnny</name>
- <xmlns:acmer:name>Johnny</xmlns:acmer:name>
- BasicXML_4003: How do you determine whether or NOT an element is using a non-default namespace?
- The element starts with the prefix "xmlns:".
- The element's name starts with a prefix that has been mapped to a specific URI.
- The element's name ends with a colon (':')
- The element's name is prefixed by a fully-qualified URI.
- The element appears at least twice in the document.
- BasicXML_4004: A namespace-aware XML parser checks which one of the following when parsing an XML document?
- That each prefix is mapped to a specific URI
- That all elements contain colons (:) in their names
- That the document does not contain more elements than the namespace defines
- That each element makes valid use of its defined namespace URI
- That colons (:) are not used within the text value of any element
5. DTD and Validation
- 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?
<!ELEMENT lunch (soup, maincourse, desert)>
<!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;)>
<!ENTITY % seq "(soup|maincourse|desert)"> <!ELEMENT lunch (%seq;, %seq;, %seq;)><!ELEMENT lunch (soup?,(maincourse,desert), (desert,maincourse) , soup?>
- BasicXML_5003: Which one of the following demonstrates a well-formed, valid XML document?
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE name [<!ELEMENT name (#PCDATA)>]> <name>Fred</name>
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE greeting [<!ENTITY name (#PCDATA)>]> <name>Fred</name>
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE greeting [<!ELEMENT name (#PCDATA)>]> <name>Fred<name>
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE greeting [<!ELEMENT Fred (#PCDATA)>]> <name>Fred</name>
<!DOCTYPE name> <name>Fred</name>
6. SAX Parsing
- BasicXML_6001: What is the purpose of an XML parser?
- It reads XML formatted text and prints it to the user's Web browser.
- It compiles XML source code into an XML executable.
- It converts XML formatted text into a programmatic data-structure.
- It reads XML formatted text and removes the tags so that only data remains.
- It converts XML formatted text into an HTML formatted Web page.
7. Issues of XML Serialization
- BasicXML_7001: Which one of the following statements is true regarding the specifications for well-formed XHTML?
- Attribute values must not be enclosed between quotation marks.
- Client-side script code (such as JavaScript) can be freely typed without any special escape characters as long as it resides within <script> tags.
- XHTML cannot be formatted with CSS.
- All elements and attributes must be typed in lower-case.
- The XHTML specification omits the <br> tag from HTML.
Unclassified Questions
on 2008/01/02 23:21