You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by James McCarthy <ja...@webxi.com> on 2000/01/28 16:42:10 UTC
Xerces Namespace problem
I have discovered what I believe is a bug in the Xerces parser. When you try
to use a default namespace declaration in the root tag it will fail. Even
worse, it tries to resolve the entity which I don't believe it should be
doing according to the namespace spec.
I have reproduced this problem and can provide three very similar examples,
two that work and one that fails. These examples came directly from the
namespace spec.
First Case: Qualified namespace declaration - Works As Expected
<?xml version="1.0"?>
<!-- all elements here are explicitly in the HTML namespace -->
<html xmlns:html='http://www.w3.org/TR/REC-html40'>
<html:head><html:title>Frobnostication</html:title></html:head>
<html:body><html:p>Moved to
<html:a href='http://frob.com'>here.</html:a></html:p></html:body>
</html>
Second Case: Default namespace declaration - Does not work and it tries to
resolve the entity (with a long delay if you are not able to contact the
entity or a file not found if it is not a URL).
<?xml version="1.0"?>
<!-- elements are in the HTML namespace, in this case by default -->
<html xmlns='http://www.w3.org/TR/REC-html40'>
<head><title>Frobnostication</title></head>
<body><p>Moved to
<a href='http://frob.com'>here</a>.</p></body>
</html>
Third Case: Same as above except that another attribute is declared before
the namespace declaration - Strangely, this example works as expected.
<?xml version="1.0"?>
<!-- elements are in the HTML namespace, in this case by default -->
<html anyAttribute="Attribute" xmlns='http://www.w3.org/TR/REC-html40'>
<head><title>Frobnostication</title></head>
<body><p>Moved to
<a href='http://frob.com'>here</a>.</p></body>
</html>
If I am doing something wrong in any of these examples please let me know.
If not I hope that the very re-creatable examples help resolve the problem.
I am using the 1.0.1 version of Xerces-J.
Thanks,
Jim McCarthy
WebXi, Inc.
jamesm@webxi.com
P.S. Keep up the great work. I persued this problem because I refuse to use
any other parser.