W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2002

Content-restriction

From: Kai Ojansuu <clapu@pori.tut.fi>
Date: Wed, 13 Mar 2002 10:24:07 -0500 (EST)
To: xmlschema-dev@w3.org
Message-id: <Pine.GSO.4.05.10203131653350.22712-100000@frodo.pori.tut.fi>
Hi!
Is there a way of implementing a xpath-like content-checking in XMLSchema?
I have an application that produces this kind of xml:
...
<request-params xsi:type="showstudent">
 <param name="foo" value="bar"/>
 <param name="id" value="234" />
 <param name="..." value="..."/>
</request-params>
...

For example this doc is valid only if it has one param-element with
name-attribute valued 'id'
 
I first created an abstract request-params element which can contain
{0-unbounded} param elements in sequence. Then I created a showstudent
-type element by extension from 'request-params' element and tried to
'fix' only one 'param'-element's name to 'id'. The validator (Xerces)
notifies that every param's name-attribute should be 'id'.

xpath-check would be something like this: "count(param[@name='id']) = 1"
 
Cheers
Kai Ojansuu
Received on Thursday, 14 March 2002 12:40:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:30 GMT