SYMPTOMS

Validating an XML Document with MSXML gives the following error message:

0xC00CE01D. Reference to undeclared namespace prefix: 'xlink'.

STEPS TO REPRODUCE BEHAVIOR

1 - Start XMLBlueprint.

2 - Paste the following code into a new text document, and save the file as book.xml:

<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE book SYSTEM "book.dtd">

<book>

<chapter xlink:href="http://www.xmlblueprint.com"/>

</book>

3 - Paste the following code into a new text document, and save the file as book.dtd in the same folder as book.xml:

<!ELEMENT book (chapter)*>

<!ATTLIST book xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink">

<!ELEMENT chapter (#PCDATA)>

<!ATTLIST chapter xlink:href CDATA #IMPLIED>

4 - Open file book.xml and validate by clicking XML > Validate. The error message will appear in the Output Window.

SOLUTION

To avoid this error, change <book> to <book xmlns:xlink="http://www.w3.org/1999/xlink">:

<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE book SYSTEM "book.dtd">

<book xmlns:xlink="http://www.w3.org/1999/xlink">

<chapter xlink:href="http://www.xmlblueprint.com"/>

</book>