Bug 3461 - Xerces does not validate namespace attributes
Summary: Xerces does not validate namespace attributes
Status: RESOLVED DUPLICATE of bug 1917
Alias: None
Product: Xerces-J
Classification: Unclassified
Component: DTD (show other bugs)
Version: 1.4.3
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Xerces-J Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-09-06 07:39 UTC by elharo
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description elharo 2001-09-06 07:39:46 UTC
The following document is not valid acording to XML 1.0. The xmlns attribute is
not properly declared. However, Xerces-J incorrectly reports it as valid. As
near as I can tell for the last several releases Xerces-J has not validated
xmlns and xmlns:prefix attributes. This is correct behavior for schemas but not
for DTDs. In order to be DTD-valid, all namespace declaration attributes used in
the document must be declared. They do not get any special exemptions from the
rules of XML 1.0:

<?xml version="1.0"?>
<!DOCTYPE test [
  <!ELEMENT test (#PCDATA)>
]>
<test xmlns="http://www.ibiblio.org/xml/">
  content
</test>

The example here just uses an xmlns attribute on the root element, but I've
noted this behavior with many different kinds of xmlns and xmlns:prefix
attributes in different places.
Comment 1 Neeraj Bajaj 2001-09-07 05:23:33 UTC
u have written
"In order to be DTD-valid, all namespace declaration attributes used in
the document must be declared. They do not get any special exemptions from the
rules of XML 1.0:"
i could not find such thing anywhere, can u give me pointers?
i feel this is correct behavior for DTD also and parser is behaving correctly.
Comment 2 Henry Zongaro 2001-09-07 05:42:03 UTC
Coincidentally, I noticed this same issue a couple of months ago, but never 
submitted a bug report for it.  The following in an excerpt from a note on the 
topic, with relevant pointers to the XML 1.0 (2nd Ed.) Recommendation.

I believe that if validation is requested, the parser should produce a 
validation error for the document, because the xmlns:ns attribute hasn't been 
declared in the DTD.  The definition of start-tags and empty-element tags [1] 
specifies that the attributes must satisfy validity constraint [2] - namely, 
that the attribute must have been declared, and that the value of the attribute 
must be of the correct type.

The Namespaces recommendation [3] indicates that a namespace is declared using 
the reserved family of attributes "xmlns" and those that begin with "xmlns:", 
but it doesn't indicate that such attributes are themselves "predeclared" in 
any sense.

[1] http://www.w3.org/TR/2000/REC-xml-20001006#sec-starttags
[2] http://www.w3.org/TR/2000/REC-xml-20001006#ValueType
[3] http://www.w3.org/TR/1999/REC-xml-names-19990114/#ns-decl
Comment 3 Pavani Mukthipudi 2001-09-07 09:25:02 UTC
The attribute name xmlns, which is used to declare the default namespace, is
associated with the namespace name
http://www.w3.org/2000/xmlns/

The above link gives you the information about xmlns.
Comment 4 Elena Litani 2001-10-30 13:43:55 UTC
You are right, however, we don't have time to fix this bug in Xerces1. If you 
provide a patch we will apply it. The behaviour is correct in the latest 
Xerces2 beta3 release
Comment 5 Henry Zongaro 2001-11-01 07:53:24 UTC
Re-opening so I can return it as a duplicate.
Comment 6 Henry Zongaro 2001-11-01 07:53:45 UTC

*** This bug has been marked as a duplicate of 1917 ***