XSD pattern validation

Discussion in 'XML' started by Per Skjondal, Feb 11, 2006.

  1. Per Skjondal

    Per Skjondal Guest

    Hi all.

    It might be a wild goose chase, but: I have a validation problem for a
    base-type in a xml shema definition. The
    type is :

    <xsd:simpleType name="Equipment_A_Base">
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="2"/>
    <xsd:maxLength value="15"/>
    <xsd:pattern value=""/>
    </xsd:restriction>
    </xsd:simpleType>

    This field can contain a string which consists o fthese characters:

    A,C,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,T,U,V,X,Y,Z

    Rule: The lenght of the field can be from 2-15 chars. Only 1 of each char
    and in whatever order. Example:

    NEFGACYXZ

    Is it at all possible to validate something like his? I begin to wonder. Any
    ideas?

    Per
     
    Per Skjondal, Feb 11, 2006
    #1
    1. Advertisements


  2. Length constraints should be possible, character set should be possible
    -- but the "at most once" is probably beyond Schema's RE capabilities.
    (See http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#dt-regex)

    I think it's up to the application, rather than the parser, deal with
    this level of data checking/interpretation.
     
    Joe Kesselman, Feb 11, 2006
    #2
    1. Advertisements

  3. Per Skjondal

    Per Skjondal Guest

    Thanx, that's what I thought .
    I had to check with the news groups first.

    Per
     
    Per Skjondal, Feb 12, 2006
    #3
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.