XML Master Professional Application Developer: Sample Questions

Here are some sample questions.

Section 1   DOM / SAX

Question 1.

Which of the following DOM (Level 2) nodes is not a child node of an element node (Element) in DOM trees?

A. Element
B. Entity
C. EntityReference
D. Text

Click here for the correct answer

>> Return to Sample Questions Index

Section 2   DOM / SAX Programming

Question 2.

When processing the following "XML Document" according to the method shown by "SAX Processing," which of the following correctly describes the output results (print method output)?

[XML Document]
<!DOCTYPE doc [
<!ELEMENT doc (#PCDATA | content)*>
<!ELEMENT content (#PCDATA)>
<!ENTITY title "&option;Wine Brand">
<!ENTITY option "Red ">
]>
<doc><content>The Title is "&title;"</content></doc>

[SAX Processing]
Use the following "ContentHandlerImpl" class, and parse the XML Document using SAX.
The SAX parser is a non-validating parser.
Assume no execution errors.

class ContentHandlerImpl extends DefaultHandler {
  public void characters(char[] ch, int start, int length) throws SAXException {
    System.out.print( new String(ch, start, length) );
  }
}

A. The Title is ""
B. The Title is "&option;Wine Brand"
C. The Title is "Red Wine Brand"
D. The Title is "&title;"

Click here for the correct answer

>> Return to Sample Questions Index

Section 3   XSLT

Question 3.


Push the Exhibit Button to load the referenced "XSLT Style Sheet". Perform XSLT transformation on the following "XML Document" using the "XSLT Style Sheet".

Select which of the following correctly describes what should be written in "XSLT Style Sheet" document (1) in order to output "234" as the result.
Note that the XSLT processor can output transformation results as a document.

[XML Document]
<dummy/>

[XSLT Style Sheet]
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
  <xsl:template match="/">
    <xsl:call-template name="COUNT">
      <xsl:with-param name="NUM" select="2" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template name="COUNT">
    <xsl:param name="NUM" select="0" />
      --------(1)--------
  </xsl:template>
</xsl:stylesheet>

A.
<xsl:choose>
  <xsl:when test="$NUM &lt; 5">
    <xsl:value-of select="$NUM" />
    <xsl:call-template name="COUNT">
      <xsl:with-param name="NUM" select="$NUM+1" />
    </xsl:call-template>
  </xsl:when>
</xsl:choose>

B.
  <xsl:when test="$NUM &lt; 5">
    <xsl:value-of select="$NUM" />
    <xsl:call-template name="COUNT">
      <xsl:with-param name="NUM" select="$NUM+1" />
    </xsl:call-template>
  </xsl:when>

C.
<xsl:choose>
  <xsl:when test="$NUM &lt; 5">
    <xsl:value-of select="$NUM" />
    <xsl:param name="NUM" select="$NUM+1" />
  </xsl:when>
</xsl:choose>

D.
<xsl:when test="$NUM &lt; 5">
  <xsl:value-of select="$NUM" />
  <xsl:param name="NUM" select="$NUM+1" />
</xsl:when>

Click here for the correct answer

>> Return to Sample Questions Index

Section 4   XML Schema

Question 4.

Select which of the following correctly describes the results of performing a validation check on "XML Document".

Assume that the XML parser correctly processes the XML Schema noNamespaceSchemaLocation attribute and the schemaLocation attribute.

[XML Document]
<document xmlns:sec="urn:xmlmaster:document:sec"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="document.xsd"
    xsi:schemaLocation="urn:xmlmaster:document:sec section.xsd">
  <sec:section number="1" name="section1" />
  <sec:section number="2" name="section2" />
</document>

[document.xsd]
<xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:sec="urn:xmlmaster:document:sec">
  <xs:element name="document" type="documentType" />
  <xs:complexType name="documentType">
    <xs:sequence>
      <xs:element ref="sec:section" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
</xs:schema>

[section.xsd]
<xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="urn:xmlmaster:document:sec"
    xmlns:tns="urn:xmlmaster:document:sec">
  <xs:element name="section" type="tns:sectionType" />
  <xs:complexType name="sectionType">
    <xs:attribute name="number" type="xs:int" />
    <xs:attribute name="name" type="xs:string" />
  </xs:complexType>
</xs:schema>

A. Valid
B. The coding for the XML Document is not appropriate; therefore, an error is thrown (initial error) when processing the XML Document [xsi:schemaLocation="urn:xmlmaster:document:sec section.xsd"]
C. The coding for the XML Schema Document is not appropriate; therefore, an error is thrown (initial error) when processing the "document.xsd" [<xs:element ref="sec:section" maxOccurs="unbounded" />]
D. No processing error, but is not valid

Click here for the correct answer

>> Return to Sample Questions Index

Section 5   XML Processing System Design Technology

Question 5.

Which of the following attributes is not defined in SOAP specification 1.1?

A. actor attribute
B. binding attribute
C. encodingStyle attribute
D. mustUnderstand attribute

Click here for the correct answer

>> Return to Sample Questions Index

Section 6   Utilizing XML

Question 6.

Push the Exhibit Button to load the referenced "XML Document". When processing the "XML Document" according to the method shown by "DOM Processing," which of the following is the most appropriate expression of the results under XML 1.0. Line feeds and/or indents are not reflected in the results?

Assume that the processed XML Document has no indents (ignorable white space such as line feeds, tabs, etc.).

[XML Document]
<ContactXML xmlns="http://www.xmlns.org/2002/ContactXML" version="1.1"
      creator="http://www.foo.com/bar/meishi-app/1.1">
  <ContactXMLItem>
    <PersonName>
      <PersonNameItem>
        <FullName>John Smith</FullName>
        <FirstName>John</FirstName>
        <LastName>Smith</LastName>
      </PersonNameItem>
    </PersonName>
  </ContactXMLItem>
  <ContactXMLItem>
    <PersonName>
      <PersonNameItem>
        <FullName>Ken Jones</FullName>
        <FirstName>Ken</FirstName>
        <LastName>Jones</LastName>
      </PersonNameItem>
    </PersonName>
  </ContactXMLItem>
</ContactXML>

[DOM Processing]
Create XML using the following method.
Document output = createXML( doc, impl );
The variable doc here references the Document instance of the loaded XML document.
The variable impl here references the DOMImplementation instance.
The DOM parser is namespace aware.
Assume no execution errors.

public static Document createXML( Document doc, DOMImplementation impl ) {
  String DOCNS = "http://www.xmlns.org/2002/ContactXML";
  String OUTNS = "urn:xmlmaster:GROUP";

  Document output = impl.createDocument( OUTNS, "group", null );
  Element root = output.getDocumentElement();

  NodeList nlist = doc.getElementsByTagNameNS( DOCNS, "PersonNameItem" );
  Element current;
  Element target;
  Element element;

  for (int i = 0; i < nlist.getLength(); i++) {
    current = (Element)nlist.item(i);
    target = (Element)current.getFirstChild();
    element = output.createElementNS( OUTNS, "member" );
    element.appendChild( output.importNode(target, true) );
    root.appendChild( element );
  }

  return output;
}

A.
<group xmlns="urn:xmlmaster:GROUP">
  <member>
    <FullName>Ken Jones</FullName>
    <FullName>John Smith</FullName>
  </member>
</group>

B.
<group xmlns="urn:xmlmaster:GROUP">
  <member>
    <FullName xmlns="http://www.xmlns.org/2002/ContactXML">John Smith</FullName>
  </member>
  <member>
    <FullName xmlns="http://www.xmlns.org/2002/ContactXML">Ken Jones</FullName>
  </member>
</group>

C.
<group xmlns="urn:xmlmaster:GROUP">
  <member>
    <PersonNameItem>
      <FullName>Ken Jones</FullName>
      <FirstName>Ken</FirstName>
      <LastName>Jones</LastName>
    </PersonNameItem>
    <PersonNameItem>
      <FullName>John Smith</FullName>
      <FirstName>John</FirstName>
      <LastName>Smith</LastName>
    </PersonNameItem>
  </member>
</group>

D.
<group xmlns="urn:xmlmaster:GROUP">
  <member>
    <PersonNameItem>
      <FullName>John Smith</FullName>
      <FirstName>John</FirstName>
      <LastName>Smith</LastName>
    </PersonNameItem>
  </member>
  <member>
    <PersonNameItem>
      <FullName>Ken Jones</FullName>
      <FirstName>Ken</FirstName>
      <LastName>Jones</LastName>
    </PersonNameItem>
  </member>
</group>

Click here for the correct answer

>> Return to Sample Questions Index

Go To HOME