W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2012

Re: XSD 1.1: not okay to have an xs:assert at the attribute level?

From: Mukul Gandhi <gandhi.mukul@gmail.com>
Date: Mon, 24 Sep 2012 09:11:20 +0530
Message-ID: <CABuuzNMucDryMvNMOfGxFJXGpYcNJ8BhzZOKpAj2ym2pjz_y3Q@mail.gmail.com>
To: "Costello, Roger L." <costello@mitre.org>
Cc: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Hi Roger,
   I was using Xerces.

If you model the schema little differently, it can be more correct
than what I posted last. Here's the modified schema design that I
would propose, for this use case:

New XML document:

<Test xsdNs="http://www.w3.org/2001/XMLSchema">
   <Rule name="element" />

(with this content model we assume that, a combination of attribute
values for @name and @xsdNs can be formed into a QName value which
needs to be xsd:element in the XSD namespace)

New XSD document:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

     <xsd:element name="Test">
                   <xsd:element name="Rule" maxOccurs="unbounded">
                           <xsd:attribute name="name"
type="xsd:string" use="required"/>
	      <xsd:attribute name="xsdNs" type="xsd:anyURI"/>
	      <xsd:assert test="every $rule in Rule satisfies (QName(@xsdNs,
$rule/@name) eq xsd:QName('xsd:element'))"/>


This modified content model, I think would take care of namespace
issues correctly.

On Mon, Sep 24, 2012 at 3:09 AM, Costello, Roger L. <costello@mitre.org> wrote:
>> <xsd:assert test="QName('http://www.w3.org/2001/XMLSchema',
>> string(@name)) eq xsd:QName('xsd:element')"/>
> Nice work Mukul.
> You used XERCES, right?
> I tried that with SAXON and got errors.
> So either XERCES is accepting as valid something that it shouldn't or SAXON is not accepting as valid something that it should.
> XML Schema Working Group: what is the truth?
> /Roger

Mukul Gandhi
Received on Monday, 24 September 2012 03:42:08 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:16:02 UTC