Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Changes in XML Schema

Posted on 2006-11-01
5
Medium Priority
?
242 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: 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 This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logiā€¦
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to count occurrences of each item in an array.

722 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