Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > paterns for phones' numbers

Reply
Thread Tools

paterns for phones' numbers

 
 
Ruthless
Guest
Posts: n/a
 
      12-24-2003
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


 
Reply With Quote
 
 
 
 
Janwillem Borleffs
Guest
Posts: n/a
 
      12-24-2003

"Ruthless" <ruthless@NO_SPAM.poczta.onet.pl> schreef in bericht
news:bsc3hl$4c8$(E-Mail Removed)...
> 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">
<xsattern 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



 
Reply With Quote
 
 
 
 
Ruthless
Guest
Posts: n/a
 
      12-26-2003
thnx very much

greetings R

Użytkownik "Janwillem Borleffs" <(E-Mail Removed)> napisał w wiadomości
news:3fe9f4a8$0$158$(E-Mail Removed)...
>
> "Ruthless" <ruthless@NO_SPAM.poczta.onet.pl> schreef in bericht
> news:bsc3hl$4c8$(E-Mail Removed)...
> > 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">
> <xsattern 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


 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      12-27-2003
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.
 
Reply With Quote
 
Gargamil
Guest
Posts: n/a
 
      01-23-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.



 
Reply With Quote
 
Ed Beroset
Guest
Posts: n/a
 
      01-23-2004
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

 
Reply With Quote
 
Peter Flynn
Guest
Posts: n/a
 
      01-24-2004
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 , 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

 
Reply With Quote
 
Julian Reschke
Guest
Posts: n/a
 
      01-24-2004
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
 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      01-24-2004
(Oops, I think I just contrived to send a reply to this to xml-dev by mistake.)

In article <buskcv$glu94$(E-Mail Removed)-berlin.de>,
Peter Flynn <(E-Mail Removed)> 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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
win32com ppt embedded object numbers reverting back to original numbers Lance Hoffmeyer Python 2 07-26-2007 01:45 AM
Fibonacci Numbers and Lucas Numbers Andrew Tatum C++ 6 05-27-2007 12:47 AM
Finding 1000 largest numbers from a file having some billion numbers Subra C Programming 25 03-08-2007 01:31 AM
Applying multiple design paterns to a single class Orgun C++ 6 09-26-2006 10:11 PM
Frame Numbers vs. JPEG Numbers With CF Cards mort Digital Photography 3 02-16-2005 01:43 AM



Advertisments