Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Changes in XML Schema

Posted on 2006-11-01
5
Medium Priority
?
245 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 252 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 248 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

885 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