Solved

Changes in XML Schema

Posted on 2006-11-01
5
230 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

Suggested Solutions

Title # Comments Views Activity
Custom Ribbon doesn't refresh 7 80
Swiper slider stops between pages 11 45
Re-position sub-options beneath the TAB 7 79
Facebook React and SyntheticEvents 6 50
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

863 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now