Custom error messages when XSD validation fails?

Discussion in 'XML' started by Artie, Apr 21, 2008.

  1. Artie

    Artie Guest

    Hi,

    Is there any way to tell an XSD Schema that you want custom error
    codes for particular validation failures in an XML document?

    To show what I mean, here's an example:

    XSD excerpt

    <xs:element name = "EmployeeID">
    <xs:simpleType>
    <xs:restriction base = "xs:string" >
    <xs:length value = "3"/>
    <xs:pattern value = "[0-9]{3}"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>

    XML excerpt

    <EmployeeID>1234</EmployeeID>

    When the XML fails to validate against its XSD element, I want, say,
    error code 1000 to be returned from the validator - can this be done
    easily?

    (I'm thinking along the lines of having an element like
    <xs:customErrorCode = 1000> along side each restriction.)

    Any help very much appreciated

    Artie
     
    Artie, Apr 21, 2008
    #1
    1. Advertisements

  2. Artie wrote:

    > When the XML fails to validate against its XSD element, I want, say,
    > error code 1000 to be returned from the validator - can this be done
    > easily?
    >
    > (I'm thinking along the lines of having an element like
    > <xs:customErrorCode = 1000> along side each restriction.)


    I don't think the schema language has any construct to define custom
    error messages. Nor have I have heard that a particular schema validator
    supports that. You might want to ask on a mailing list or forum or
    newsgroup for the particular schema validator you use or want to use.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Apr 21, 2008
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thomas Connolly

    Validation Summary not showing error messages

    Thomas Connolly, Jul 9, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    830
    Thomas Connolly
    Jul 9, 2003
  2. Lucas Tam
    Replies:
    0
    Views:
    632
    Lucas Tam
    Feb 26, 2004
  3. Markus
    Replies:
    1
    Views:
    1,698
    Markus
    Nov 22, 2005
  4. Replies:
    2
    Views:
    575
  5. Rushi
    Replies:
    1
    Views:
    718
  6. Brett Ossman

    Custom Membership Provider - Custom Error Messages

    Brett Ossman, Mar 11, 2009, in forum: ASP .Net Security
    Replies:
    0
    Views:
    942
    Brett Ossman
    Mar 11, 2009
  7. Chris Rumsey via .NET 247

    Validation Summary - controlling order that error messages are listed

    Chris Rumsey via .NET 247, Sep 15, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    268
    Chris Rumsey via .NET 247
    Sep 15, 2004
  8. Praveen Bengeri
    Replies:
    1
    Views:
    537
    Tom Kaminski [MVP]
    Apr 19, 2004
Loading...