473,322 Members | 1,241 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

paterns for phones' numbers

Hello.

I've got a question how to make a patern in XML Schema for e.g. phones'
numbers like this: 111-222-333 etc.

thanx in advance
greetings R
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.554 / Virus Database: 346 - Release Date: 03-12-20
Jul 20 '05 #1
8 2083

"Ruthless" <ruthless@NO_SPAM.poczta.onet.pl> schreef in bericht
news:bs**********@atlantis.news.tpi.pl...
Hello.

I've got a question how to make a patern in XML Schema for e.g. phones'
numbers like this: 111-222-333 etc.


<!-- matches 111-222-333 formatted phone numbers -->
<xs:simpleType name="phoneType">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{3}(-[0-9]{3}){2}" />
</xs:restriction>
</xs:simpleType>

You will have to re-specify the pattern with other formats.
HTH,
JW

Jul 20 '05 #2
thnx very much

greetings R

U¿ytkownik "Janwillem Borleffs" <jw@jwscripts.com> napisa³ w wiadomo¶ci
news:3f*********************@news.wanadoo.nl...

"Ruthless" <ruthless@NO_SPAM.poczta.onet.pl> schreef in bericht
news:bs**********@atlantis.news.tpi.pl...
Hello.

I've got a question how to make a patern in XML Schema for e.g. phones'
numbers like this: 111-222-333 etc.


<!-- matches 111-222-333 formatted phone numbers -->
<xs:simpleType name="phoneType">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{3}(-[0-9]{3}){2}" />
</xs:restriction>
</xs:simpleType>

You will have to re-specify the pattern with other formats.
HTH,
JW

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.554 / Virus Database: 346 - Release Date: 03-12-20
Jul 20 '05 #3
On Wed, 24 Dec 2003 14:15:17 +0100, "Ruthless"
<ruthless@NO_SPAM.poczta.onet.pl> wrote:
I've got a question how to make a patern in XML Schema for e.g. phones'
numbers like this: 111-222-333 etc.


Don't ! Phone numbers don't need structure - you just dial them and
they work. Trying to impose a structure like this causes no end of
problems (I used to write commercial desktop apps - I learned this
_years_ ago).

There's also the problem that different countries use different
format, and that one country may often change an existing format. If
you really must have formatted numbers, just do it at the display
stage.
--
Klein bottle for rent. Apply within.
Jul 20 '05 #4
Take for example Australia where landline phones are now 01 2345 6789 and
mobiles phones are 0412 345 678. The list could be endless. Content
yourself with formatting the field as text and checking if there are enough
characters to create a meaningful phone number.

Gargamil

"Andy Dingley" <di*****@codesmiths.com> wrote in message
news:4i********************************@4ax.com...
On Wed, 24 Dec 2003 14:15:17 +0100, "Ruthless"
<ruthless@NO_SPAM.poczta.onet.pl> wrote:
I've got a question how to make a patern in XML Schema for e.g. phones'
numbers like this: 111-222-333 etc.


Don't ! Phone numbers don't need structure - you just dial them and
they work. Trying to impose a structure like this causes no end of
problems (I used to write commercial desktop apps - I learned this
_years_ ago).

There's also the problem that different countries use different
format, and that one country may often change an existing format. If
you really must have formatted numbers, just do it at the display
stage.
--
Klein bottle for rent. Apply within.

Jul 20 '05 #5
Gargamil wrote:
Take for example Australia where landline phones are now 01 2345 6789 and
mobiles phones are 0412 345 678. The list could be endless. Content
yourself with formatting the field as text and checking if there are enough
characters to create a meaningful phone number.


Recently, I purchased international plane tickets via the web. Several
minutes later, I got an email from the travel agent complaining of an
invalid number. Their software evidently was looking for a number with
the typical US format of 987-654-3210, but I had put a "1" in front of
my US number out of habit because that's the country code. The effect
is that the software incorrectly rejected my valid number. That's bad
design.

Ed

Jul 20 '05 #6
Andy Dingley wrote:
On Wed, 24 Dec 2003 14:15:17 +0100, "Ruthless"
<ruthless@NO_SPAM.poczta.onet.pl> wrote:

I've got a question how to make a patern in XML Schema for e.g. phones'
numbers like this: 111-222-333 etc.

Don't ! Phone numbers don't need structure - you just dial them and
they work. Trying to impose a structure like this causes no end of
problems (I used to write commercial desktop apps - I learned this
_years_ ago).


Right. But *do* allow the user to type non-digits:

a. optional + at the start to symbolize your international access code
b. spaces between groups of digits
c. hyphens (dashes) between groups of digits
d. slashes...
e. parentheses...
f. periods...
g. etc

I believe the maximum length of a phone number is currently 18 digits
(max 4 for country code, max 6 for area code, max 8 for number) plus
up to 6 more for direct in-dial extensions, and whatever you consider
reasonable for punctuation (say 8), giving a total for your overall
length of 32.

Formatting is tempting, because at least 15% of respondents will get
their own phone number wrong, IMHE. But it's too complex to model in
a Schema: the ITU will supply you with the standard formats for each
country if you really want them, but you'll spend the next year making
them work as patterns.

///Peter

Jul 20 '05 #7
Peter Flynn wrote:
...

a. optional + at the start to symbolize your international access code
...


So any number that doesn't start with a "+" is in which country?

Julian
Jul 20 '05 #8
(Oops, I think I just contrived to send a reply to this to xml-dev by mistake.)

In article <bu************@ID-163087.news.uni-berlin.de>,
Peter Flynn <pe***@silmaril.ie> wrote:
Don't ! Phone numbers don't need structure - you just dial them and
they work. Trying to impose a structure like this causes no end of
problems (I used to write commercial desktop apps - I learned this
_years_ ago).
Right.


Really? It used to be the case that in Britain that dialling the full
"long-distance" version of a local number *didn't* work; you had to
extract the local part. I think it now generally works, but I wouldn't
bet on that being the case everywhere.

-- Richard
--
Spam filter: to mail me from a .com/.net site, put my surname in the headers.

FreeBSD rules!
Jul 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Thomas Weholt | last post by:
Hi, Is it at all possible to use python to make apps on cellular/mobile phones, using something like Jython etc. ? Hm ... ?? Thomas
0
by: Carlos Eduardo Peralta | last post by:
Hello dotnet frineds: I make a decision in the 2001 year: i want to be a dotnet guru. I want to consume all my learning hours just learning this applications plataforms and NOT THE JAVA ONE. ...
22
by: ineedyourluvin1 | last post by:
Hello all! I've been looking for a way to strip characters from strings such as a comma. This would be great for using a comma as a delimiter. I show you what I have right now. ...
2
by: HateSpam | last post by:
Can I develop cell phone apps with VB .NET? What would you suggest as a target phone for testing, and would I need any other special equipment? Are there any good books for developing for this...
3
by: squash | last post by:
I have a client who wants to be able to automatically send a text message to a cell phone after a user submits a form with a valid cell phone number. Is this possible? Which websites provide this...
4
by: JCR | last post by:
Hi, Programing for smart phones/pda/pocket PC... can be difficult because of the number of operating systems and the variety of devices. Is anyone aware of a cross-operating system/cross-device...
2
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you for any and all assistance in finding information on this, it is greatly appreciated. I have a client that wishes to integrate into a desktop application three things from an Access...
5
by: Stefano Peduzzi | last post by:
Hi, I'm building an application where I've defined a custom class Customer. Customer can have many phones (defined by phoneType and phoneNumber). I want to check that a phoneNumber is not already...
1
by: rote | last post by:
I'm out for a regex expression to validate mobile phones like +61408777888 or 61405673777 and not letters allowed Thanks in advance
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.