Re: XSD 1.1: not okay to have an xs:assert at the attribute level?
Mukul Gandhi <[email protected]> Mon, 24 Sep 2012 09:11:20 +0530
| Newsgroups | gmane.text.xml.schema.devel |
|---|---|
| Message-ID | <CABuuzNMucDryMvNMOfGxFJXGpYcNJ8BhzZOKpAj2ym2pjz_y3Q@mail.gmail.com> |
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. <[email protected]> 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