paterns for phones' numbers

Discussion in 'XML' started by Ruthless, Dec 24, 2003.

  1. Ruthless

    Ruthless Guest

    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
     
    Ruthless, Dec 24, 2003
    #1
    1. Advertising

  2. "Ruthless" <ruthless@NO_SPAM.poczta.onet.pl> schreef in bericht
    news:bsc3hl$4c8$...
    > 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
     
    Janwillem Borleffs, Dec 24, 2003
    #2
    1. Advertising

  3. Ruthless

    Ruthless Guest

    thnx very much

    greetings R

    U¿ytkownik "Janwillem Borleffs" <> napisa³ w wiadomo¶ci
    news:3fe9f4a8$0$158$...
    >
    > "Ruthless" <ruthless@NO_SPAM.poczta.onet.pl> schreef in bericht
    > news:bsc3hl$4c8$...
    > > 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
     
    Ruthless, Dec 26, 2003
    #3
  4. Ruthless

    Andy Dingley Guest

    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.
     
    Andy Dingley, Dec 27, 2003
    #4
  5. Ruthless

    Gargamil Guest

    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" <> wrote in message
    news:...
    > 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.
     
    Gargamil, Jan 23, 2004
    #5
  6. Ruthless

    Ed Beroset Guest

    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
     
    Ed Beroset, Jan 23, 2004
    #6
  7. Ruthless

    Peter Flynn Guest

    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
     
    Peter Flynn, Jan 24, 2004
    #7
  8. 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
     
    Julian Reschke, Jan 24, 2004
    #8
  9. (Oops, I think I just contrived to send a reply to this to xml-dev by mistake.)

    In article <buskcv$glu94$-berlin.de>,
    Peter Flynn <> 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!
     
    Richard Tobin, Jan 24, 2004
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ssgg

    GET FREE CELL PHONES and CAMERA PHONES!

    ssgg, Feb 13, 2006, in forum: C Programming
    Replies:
    0
    Views:
    333
  2. Orgun
    Replies:
    6
    Views:
    361
    H. S. Lahman
    Sep 26, 2006
  3. Subra
    Replies:
    25
    Views:
    1,257
    user923005
    Mar 8, 2007
  4. Andrew Tatum

    Fibonacci Numbers and Lucas Numbers

    Andrew Tatum, May 26, 2007, in forum: C++
    Replies:
    6
    Views:
    608
    Howard
    May 27, 2007
  5. Lance Hoffmeyer
    Replies:
    2
    Views:
    549
    Lance Hoffmeyer
    Jul 26, 2007
Loading...

Share This Page