iBooks Author: Creating Review questions with XML

iBooks Author can import XML files to create a Review widget.

In a plain text editor, such as TextEdit, you can create an XML document containing questions and answers for a Review widget in iBooks Author.

Use these elements to create your document:






Enter the elements of your Review widget in this element.



Enter the elements of your question. These values are supported for this attribute:

  • multiple-choice
  • multiple-choice-top-image
  • multiple-choice-right-image
  • multiple-choice-images
  • drag-label-to-target
  • drag-image-to-target



Enter the text of your question in this element. Optional: Use alt to specify accessibility text, if different from the regular text.




Specify the filename of the main image in your question. Not used for multiple-choice or multiple-choice-images. Optional: Use alt to specify accessibility text.









Enter the attributes and text (or image) of the answer.
  • Use correct-answer="yes" to specify the correct answers in a multiple-choice Review question.
  • For text-based answers, the text of the answer should be contained within this element.
  • For image-based answers, use the src attribute to specify the filename of the image. This element does not have any content for image-based answers, so empty-element syntax is recommended.
  • For drag-label-to-target and drag-image-to-target questions, use the target-x and target-y attributes to specify the coordinates of the target. The target-x attribute defines the target's position on a horizontal axis, whereas target-y controls the vertical axis. The range for the coordinates is .01 to .99. The larger the number on the x-axis, the further to the right the point will be; the larger the number on the y-axis, the closer to the bottom the point will be.
  • Optional: For all answer types, use alt to specify accessibility text.
  • Optional: For drag-label-to-target and drag-image-to-target questions, use target-alt to specify accessibility text for the target.



This element does not have any content, so empty-element syntax is recommended. It specifies a line break in your question or answer text.

For example, a Review with a multiple-choice-images question, a drag-label-to-target question, and a multiple-choice question may look like this:

<question type="multiple-choice-images">
	<text>Which of the following do <line-break />all living things need to survive?</text>
	<choice image-src="oxygen.gif" alt="Oxygen" />
	<choice image-src="water.jpg" alt="Water" correct-answer="yes" />
	<choice image-src="carbondioxide.jpeg" alt="Carbon Dioxide" />
<question type="drag-label-to-target">
	<text>Drag the labels to the appropriate area of the atom</text>
	<main-image src="atom.jpg" alt="Picture of an atom" />
	<choice target-x="0.23" target-y="0.34">Neutron</choice>
	<choice target-x="0.61" target-y="0.75">Electron</choice>
	<choice target-x="0.12" target-y="0.34">Proton</choice>
<question type="multiple-choice">
	<text>What is the world’s largest body of water?</text>
	<choice> The Arctic Ocean </choice>
	<choice> The Mediterranean Sea </choice>
	<choice correct-answer="yes"> The Pacific Ocean </choice>
	<choice> The Atlantic Ocean </choice>

Once you've created your XML document:

  1. Save the file as a plain-text document with a .review filename extension. Save it or move it to a folder.
  2. Then, copy each image you used in your Review widget to the same folder that contains the .review file.
  3. Drag just the .review file into your iBooks Author book where you want the review to appear. iBooks Author will create the Review widget where the you dropped the XML file.

You can also continue editing your Review widget with the Widget inspector in iBooks Author.

Information about products not manufactured by Apple, or independent websites not controlled or tested by Apple, is provided without recommendation or endorsement. Apple assumes no responsibility with regard to the selection, performance, or use of third-party websites or products. Apple makes no representations regarding third-party website accuracy or reliability. Risks are inherent in the use of the Internet. Contact the vendor for additional information. Other company and product names may be trademarks of their respective owners.

Published Date: