By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,070 Members | 1,238 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,070 IT Pros & Developers. It's quick & easy.

IE Error: Reference to undeclared namespace prefix

P: n/a
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

--
Romeo Disca
Email: ro*********@t-online.de
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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" <ro*********@t-online.de> wrote in message
news:bi*************@news.t-online.com...
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

--
Romeo Disca
Email: ro*********@t-online.de

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.