You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Michael Hanson <ha...@reactivity.com> on 2003/09/19 18:34:11 UTC
TraverseSchema doesn't handle xmlns attributes below the root?
(This is a resend; my first attempt didn't seem to reach the list;
apologies if it ends up duplicating)
Hello there -
I've encountered an interesting error in the XML Schema Validator while
running some tests. I was hoping that somebody could shed some light on
it, or confirm that it is a bug. I am using version 2.2.0 on Red Hat Linux
Advanced Server 2.1.
Broadly, the problem is this: namespace declaration attributes in an XML
schema document that are not attributes of the root element do not appear
to be respected.
I have attached a modified version of personal-schema.xml and personal.xsd
that exhibit this behavior. The changes in these files are:
1. the "personnel" element has a default namespace attribute, and an
xsi:schemaLocation attribute that points to the schema.
2. the xsd has a targetNamespace attribute and declares a matching prefix
3. the ref attributes in the schema use this prefix
4. but one of them uses a different prefix, bound to the same attribute,
which is declared on the subordinate xs:element element.
Invoking DOMPrint -n -s -v=always on the document returns an error:
"Prefix: 'q' can not be resolved to a URI". Changing this prefix to the
"p:" prefix defined on the document root causes the error to go
away. Moving the declaration of xmlns:q to the root (but not to any other
parent element) makes the error go away as well.
The problem appears to be that TraverseSchema calls
retrieveNamespaceMapping only once, in
traverseSchemaHeader. fNamespaceScope appears to be quite capable of
handling the namespace stack, but only pushes a new context in
preprocessSchema, preprocessInclude, and openRedefinedSchema -- that is,
once per document. So xmlns attributes defined on subordinate nodes are
never processed.
I looked at the cvs head for TraverseSchema.cpp and did not see any
significant changes to this behavior so I suspect that it is still present
in the latest build, but have not yet tested it against the head.
Changing this behavior to check every element would seem to require pushing
a namespace scope with each element, reapplying the
retrieveNamespaceMapping method, and then popping the scope off when we
exit. This seemed to be a fairly significant change so I thought I would
check to see if somebody else can give some advice.
Am I misinterpreting the correct behavior of xmlns? Or is this a bug?
Thanks.
mh