W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2011

I propose the XML Schema 1.1 <assert> element support user-friendly diagnostic messages via the XPath trace() function

From: Costello, Roger L. <costello@mitre.org>
Date: Tue, 26 Apr 2011 06:35:58 -0400
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-ID: <9E51F88D5247B648908850C35A3BBB50053922EFAD@IMCMBX3.MITRE.ORG>
Hi Folks,

The <assert> element in here checks that the meeting start time is before its end time:


    <xs:element name="meeting">

        <xs:complexType>

            <xs:sequence>

                <xs:element name="start" type="xs:time" />

                <xs:element name="end" type="xs:time" />

            </xs:sequence>

            <xs:assert test="if (xs:time(start) lt xs:time(end)) then

                                                     true()

                                               else

                                                      trace(false(), 'Hey, the meeting ends before it begins!')" />

        </xs:complexType>

    </xs:element>

Notice that I am using the XPath trace() function. It the assertion fails, I would like the XML Schema validator to output this user-friendly diagnostic message:

    Hey, the meeting ends before it begins!


I propose that the XPath trace() function be overloaded in an XSD context to generate user-friendly error messages.



/Roger
Received on Tuesday, 26 April 2011 10:36:26 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 26 April 2011 10:36:27 GMT