# How do I fix Invalid Moodle XML errors from NotebookLM quizzes?

Source: https://nlmexporter.com/guides/questions/how-to-fix-invalid-moodle-xml-from-notebooklm  
Section: Questions  
Last verified: 2026-11-18 (Extension v1.2.16, Desktop Chrome 131 on Windows 11 & macOS Sequoia with Gemini Notebook (English UI))  
Plan: Free

Moodle throws "Invalid xml file — string expected (use CDATA?)" when hand-edited scripts or unescaped exports leave raw `<`, `>`, `&`, or HTML tags inside `<text>` nodes. Export directly with Ultra Exporter’s free Moodle XML option, which automatically wraps question stems, answer feedback, and hints inside `<![CDATA[...]]>`.

## Who this is for & prerequisites

- **Target audience:** Moodle instructors seeing "Invalid xml file - string expected (use CDATA?)" or broken math symbols when importing quizzes
- **Prerequisites:** A NotebookLM Quiz open inside Studio; Moodle course Question Bank -> Import access

## Steps

1. Install [NotebookLM Ultra Exporter](https://chromewebstore.google.com/detail/notebooklm-ultra-exporter/afchokljnhhggkhedfbmkcmdagjmjchj) in desktop Chrome, then refresh any open NotebookLM (Gemini Notebook) tab.
2. Open the generated Quiz inside NotebookLM Studio.
3. In Ultra Exporter’s Quiz dialog, choose **Moodle XML** (recommended for math/formatting) or **Moodle GIFT** — both are free.
4. Upload the downloaded `.xml` directly into Moodle **Question bank -> Import -> Moodle XML format** without modifying tags in Word or Notepad.
5. Check the imported preview questions for `<` / `&` clarity and MathJax `\(...\)` rendering.

## What to know

- Inequalities in science/math quizzes (`[ATP] < 1 mM`, `x > 0`, `NAD+ & NADH`) break raw XML parsers unless CDATA-wrapped.
- Re-saving an XML file in Windows Notepad under non-UTF-8 encoding can also trigger Moodle character parse failures.
- GIFT (.txt) or Moodle XML via Ultra Exporter are both 100% free with zero daily quota.

![Moodle XML CDATA protection preventing Invalid xml file import errors](https://nlmexporter.com/assets/guides/moodle-xml-cdata-fix.png)

*Ultra Exporter wraps stems, rationales, and hints inside `<![CDATA[...]]>` and escapes math delimiters automatically.*

- [Valid CDATA Moodle XML sample (.moodle.xml) (XML · 4.5 KB)](https://nlmexporter.com/assets/samples/en/cellular-respiration-quiz.moodle.xml) — Contains real `<` and `&` biology expressions safely wrapped inside CDATA blocks.
- [Valid Moodle GIFT sample (.gift.txt) (GIFT · 1.9 KB)](https://nlmexporter.com/assets/samples/en/cellular-respiration-quiz.gift.txt) — Plain-text Moodle GIFT alternative with escaped special characters (`~`, `=`, `:`).

> Google changes these menus often. The item's own menu in your notebook shows what is built in today.

## Frequently asked questions

### Do equations in Moodle XML work after import?

Yes — Ultra Exporter converts `$...$` and `$$...$$` into standard Moodle TeX/MathJax delimiters (`\(...\)` and `\[...\]`) inside CDATA blocks.

### Should I choose Moodle XML or GIFT if my questions have lots of math?

Choose Moodle XML first so CDATA isolates formatting cleanly; use GIFT when you prefer quick plain-text bulk editing.

### Are multi-answer questions supported in Moodle XML?

Yes. Ultra Exporter computes fractional weights cleanly (`100 / correctCount`) for multi-select questions, whereas Aiken only accepts single-answer questions.

### Why did Canvas reject my Moodle XML file?

Canvas requires QTI 1.2 `.qti.zip`, not Moodle XML. Pick **Canvas QTI** for Canvas LMS.

## Verified sources & references

- [Moodle XML format — MoodleDocs](https://docs.moodle.org/en/Moodle_XML_format) (platform) — Specifies UTF-8 encoding and CDATA escaping for HTML/code inside questions.

## Complete workflow guide

- [How to Export NotebookLM Quizzes to Moodle XML, Canvas QTI 1.2, Google Forms, Kahoot & PDF](https://nlmexporter.com/guides/export-notebooklm-quiz-to-moodle-canvas-qti) — NotebookLM has no native quiz download button. Export single quizzes free in 19 formats—including Moodle XML, GIFT, Aiken, Canvas QTI 1.2 ZIP, Kahoot, Google Forms, Word & PDF—or build Teaching Packs with Pro.

## Related guides

- [How to Import NotebookLM Quizzes into Moodle](https://nlmexporter.com/guides/integrations/notebooklm-to-moodle)
- [Moodle GIFT vs Moodle XML for NotebookLM quizzes](https://nlmexporter.com/guides/compare/moodle-gift-vs-moodle-xml)
- [Moodle XML vs Canvas QTI for NotebookLM quizzes: LMS format guide](https://nlmexporter.com/guides/compare/moodle-xml-vs-canvas-qti-for-notebooklm-quizzes)
- [How do I export a NotebookLM quiz?](https://nlmexporter.com/guides/questions/how-to-export-a-notebooklm-quiz)
- [How do I combine multiple NotebookLM notes and reports into one PDF?](https://nlmexporter.com/guides/questions/how-to-combine-multiple-notebooklm-outputs-into-one-pdf)
- [How do I preserve math equations when exporting NotebookLM to Word?](https://nlmexporter.com/guides/questions/how-to-preserve-equations-when-exporting-notebooklm-to-word)
