IE Error: Reference to undeclared namespace prefix

R

Romeo Disca

Hello newsgroup,

i'm new to xml - what's wrong with this piece code here?

i have these two files:

test.xml
----
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE a SYSTEM "test.ent" [
<!ELEMENT a (ANY)>
<!ATTLIST a
xmlns:xxx CDATA #FIXED "hello"]>
<a xmlns:xxx="hello">
&hello;
</a>
====
test.ent
----
<?xml version="1.0" encoding="utf-8"?>
<!ENTITY % prefix "xxx:">
<!ENTITY hello "<%prefix;hello/>">
====

The IE6 throws the error 'Reference to undeclared namespace prefix'.

If i change the the prefix to '<!ENTITY % prefix "">' the output is
----
<a xmlns:xxx="hello">
<hello/>
</a>
====

What am I missing?

Thanks. romeo
 
D

Dennis E. Hamilton

Try this simpler example:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xxx:a [
<!ELEMENT xxx:a (#PCDATA)>
<!ATTLIST xxx:a xmlns:xxx CDATA #FIXED "hello">
] >
<xxx:a> Here are the goodies </xxx:a>

where it is easier to see that the XML is valid. See what IE gives you.

The XML Plug-in in jEdit has no problem with this.

The IE failure appears to be a bug in the way one of the Microsoft libraries
handles namespaces in conjunction with default attributes #FIXED by the DTD.
(I suspect a library because CookTop makes the same error when an xmlns
attribute is defaulted.)

I ran into this last week. I checked the namespace specification. It is
clear that it is necessary to deal with default attributes properly in a
validating XML processor that is namespace aware.

(Note that a namespace-unaware but validating processor will also accept the
document as I have defined it.)

The W3C Schema Validator at http://www.w3.org/2001/03/webdata/xsv processes
the above example and complains about not being able to find a schema at URI
"hello" but then it does lax validation and accepts the document.

-- orcmid

PS: Your use of ANY as a way to allow <hello> (or <xxx:hello>) elements is
incorrect. All elements in the document must be defined by <!ELEMENT >
definitions in a valid XML document. ANY does not extend to elements that
have no markup declaration in the DTD. -- dh

Romeo Disca said:
Hello newsgroup,

i'm new to xml - what's wrong with this piece code here?

i have these two files:

test.xml
----
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE a SYSTEM "test.ent" [
<!ELEMENT a (ANY)>
<!ATTLIST a
xmlns:xxx CDATA #FIXED "hello"]>
<a xmlns:xxx="hello">
&hello;
</a>
====
test.ent
----
<?xml version="1.0" encoding="utf-8"?>
<!ENTITY % prefix "xxx:">
<!ENTITY hello "<%prefix;hello/>">
====

The IE6 throws the error 'Reference to undeclared namespace prefix'.

If i change the the prefix to '<!ENTITY % prefix "">' the output is
----
<a xmlns:xxx="hello">
<hello/>
</a>
====

What am I missing?

Thanks. romeo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top