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" />
</Test>

(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:complexType>
              <xsd:sequence>
                   <xsd:element name="Rule" maxOccurs="unbounded">
                       <xsd:complexType>
                           <xsd:attribute name="name"
type="xsd:string" use="required"/>
                       </xsd:complexType>
                  </xsd:element>
              </xsd:sequence>
	      <xsd:attribute name="xsdNs" type="xsd:anyURI"/>
	      <xsd:assert test="every $rule in Rule satisfies (QName(@xsdNs,
$rule/@name) eq xsd:QName('xsd:element'))"/>
         </xsd:complexType>
     </xsd:element>

</xsd:schema>

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



-- 
Regards,
Mukul Gandhi
Received on Monday, 24 September 2012 03:42:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 24 September 2012 03:42:09 GMT