Re: [xml] XML Schema QNames

[ Seems my answer from yesterday didn't appear in the mailing-list, reposting ]

On Fri, Mar 05, 2004 at 12:20:37AM +0100, Adam Dickmeiss wrote:
I've seen what appears to be a bug in the handling of type names in XML
schema handler of libxml2. These type names are referred to as QNames in 
the XML
schema standard.


The issue can be illustrated with the schema:

<schema xmlns=''
<element name='my' type='string'/>

Here, the omitted prefix in 'string' is treated as NS http://my.ns/, 
when it should really be

  Oh, okay.... my head did hurt each time I have tried to really understand
from the spec the expected behaviour about namespace propagation and
composition in the context of XML Schemas.

Attached is a patch.ns + 2 new tests which modifies 
xmlschemas.c:xmlGetQNameProp so that it returns default namespace if 
prefix is omitted for Qname. The patch also _removes_ 'fallback' to 
targetNamespace, which IMHO is not to be used.


Removing this fallback made test po1_0.xsd fail. It turned out that this 
schema had two bad type references with omitted prefixes (when that was 
not allowed). Patch for po1_0.xsd is part of patch.ns.

  Hum, I think I copied po1_0.xsd directly from the XML Schemas Primer,
maybe I made a mistake doing that copy or I missed something else...

  I applied the patch, maybe this will fix the problem that the xmlbench
author reported about QName when running the benchmark suite.
In general I very much welcome fixes you and others can provide w.r.t. XML
Schemas implementation and cleanup. There is a large test suite a W3C but
when I looked at it nearly 2 years ago libxml2 Schemas was really too
incomplete to even start trying running against it. Maybe this would make
more sense now, though there is still a parts which are not implemented
like identity constraints.

  Thanks a lot, this was just commited in CVS,


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]