Re: [xml] XML Schema QNames

Daniel Veillard wrote:

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.
I understand why that hurt.

I saw problem with mixed content and QNames due to the use of DTD to XSD converters. Then looked at literature and tested with Xerces as well.

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...
You are referring to the primer on I assume.

Looking at the primer today, in section
"4.1 A Schema in Multiple Documents"
at least the reference to SKU/Items looks OK, i.e. it reads:

<element name="items"      type="ipo:Items"/>
<attribute name="partNum" type="ipo:SKU" use="required"/>

with the ipo: in place. So either the cut-n-paste went wrong or the primer was fixed. We don't know, and it 
doesn't matter :)

 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.
I won't promise to do more work for now. libxml2 WRT schemas does what I need now. Have never looked at the test suite from w3c.. It's tempting to see how things are now, admitted.

 Thanks a lot, this was just commited in CVS,
Thanks. Still can't see my first patch yet in anoncvs. I'll bug you, if it doesn't show up next week.

-- Adam


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