IBM 141

Author: Razvan MIHAIU (please remove '_rem' and 'rem_')
Date: 11/04/2005

Page 1: XML questions 1-15

Page 2: XML questions 16-27
  1. What is the return value for the function getParentNode() for a node of type attribute ?

    a. The node containing the attribute;

    b. null

    c. depends on the context;


    Answer: b.

    A node of type attribute has no parent node because he is not part of the DOM tree. In order to retrieve the owner element of the attribute the function getOwnerElement() must be used.

  2. Can Attr nodes be immediate children of a DocumentFragment ? Yes/No



    Attribute nodes are not part of the DOM tree, therefore they cannot be an immediate node of a DocumentFragment. They can be contained in a DocumentFragment only if they belong to an Element.

  3. What are the possible children of an attribute node ?

    a. Text;

    b. EntityReference;

    c. Element;

    d. Notation;


    Answer: a,b

  4. Does the node type Text has a member function named splitText() ? Yes/No


    Answer: yes.

  5. What kind of exception does the following code generates ?

    Element blockA = document.createElement("BlockA"); Node textA = document.createTextNode("nota 1000"); blockA.appendChild(textA); ((Text)textA).splitText(4); ((Text)textA).splitText(90);





    Answer: c

  6. For Document, DocumentFragment and Attr nodes, parentNode is always null. True/False


    Answer: true.

  7. One element can have 2 attributes of type ID. True/False


    Answer: false.

  8. Is the following element declaration the declaration of an empty element ? Yes/No
    <xsd:element name="EmptyElt"> <xsd:complexType> <xsd:attribute name="Year" type="xsd:string"/> </xsd:complexType> </xsd:element>


    Answer: yes.

  9. What are the fundamental data types in XPATH:

    a. boolean;

    b. node-set;

    c. number;

    d. string;


    Answer: a,b,c,d.

  10. Consider the following xml file:
    <?xml version="1.0" ?> <?xml-stylesheet type="text/xsl" href="document.xsl"?> <test:MyNode xmlns:test="//"> <test:foo>Node foo</test:foo> </test:MyNode>

    and the following XSL stylesheet:

    <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="//" version="1.0" xmlns:razvan="//"> <xsl:template match="/"> <html> <body> </body> </html> </xsl:template> <xsl:template match="razvan:MyNode"> <xsl:apply-templates/> </xsl:template> <xsl:template match="razvan:foo"> <h1>found</h1> </xsl:template> </xsl:stylesheet>

    Will you see any output of your browser after the transformation is applied ? Yes/No


    Answer: No.

    The result of the transformation will be:

    <html> <body> </body> </html>

    This html code will not print anything on screen.


    The root template (the one that matches "/") will not call any other templates. That means that the second and third template are never called.

  11. Are the following 2 lines of code equivalent ? Yes/No
    <xsl:element name="razvan:CoolCat" namespace="//"/> <xsl:element name="razvan:CoolCat" xmlns:razvan="//"/>

    Answer: yes.

  12. Each XSL:FO document has a "root" element which refers to the XSL-FO namespace, like in the next example: True/False

    <fo:root xmlns:fo="//">

    Answer: true.

I wish you success in your certification effort.

Best regards,

Razvan Mihaiu � 2000 - 2022