Solved

Changes in XML Schema

Posted on 2006-11-01
5
231 Views
Last Modified: 2013-11-19
Hi, for the application, we have a field for bank account number, in which we would apply new validation e.g. modulus 11 to check if it's valid. Does anyone know if such validation can be applied to .XSD file? If so, can I add those codes for working out the validation like those in XSLT?

Here below is part of the schema. The current max length is set as 13.

<xsd:element name="bankNumber" minOccurs="0">
      <xsd:simpleType>
            <xsd:restriction base="xsd:string">
                  <xsd:pattern value="(\d{0,13})"/>
            </xsd:restriction>
      </xsd:simpleType>
</xsd:element>
0
Comment
Question by:manfredino
5 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 63 total points
ID: 17848272
Hi manfredino,

There are just a limited number of facets that are applicable to simpleTypes in XSD
You have the pattern facet restricting the string type
That is about the most complex you can go
Typical facets are number of digits, maximum value, enumerations,...

If you can limit the set of allowed values eg 1, 12, 23, 34 etc. you can use enumeration

If you are more thinking of using XPath expressions such as "(substring-before(., '-') + substring-after(., '-')) mod 11 = 1"
for validating the checksum of your bank number
you have two options

- use XSLT for reporting wrong numbers
- use assertions in Schematron... that is a constraints schema language for XML, that can be used in combination with XSD
read about it here http://www.schematron.com/
and check if that is applicable in your situation

Cheers!

Geert
0
 

Author Comment

by:manfredino
ID: 17848559
Hi Geert,

Thanks for your help. I ll take a look of schematron and see if we can apply on our schema.

Cheers,
Manfred
0
 
LVL 8

Assisted Solution

by:redpipe
redpipe earned 62 total points
ID: 17862451
I am not a schematron specialist, but in spite of its vast possibilities I believe it is impossible (or at least not practical) to use xml-schema-validation for modulus 11. This is a process of calculating the weights of received numbers and adding a check digit. I would urge you to continue with your current format, and validate received messages against this schema first and proceed with checking the modulus 11 validation of the accountnumber (method in a class).
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question