Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSD alphanumerical, reg_exp

Reply
Thread Tools

XSD alphanumerical, reg_exp

 
 
Ruthless
Guest
Posts: n/a
 
      12-27-2003
Hello.

As a greenhorn i've got some new questions...

Is there any type in XSD for alphanumerical strings?
if not:
What is XSD pattern for alphanumerical strings?
E.g. password: alphanumerical and lenght=6(at least)

And second thing(sorry ;D)

how can i write pattern for e-mail addres. pseudocode like this:
[alpha_num]'@'[alpha_num]'.com.pl'

thanks in advance
and once again sorry

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
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      12-28-2003


Ruthless wrote:


> Is there any type in XSD for alphanumerical strings?
> if not:
> What is XSD pattern for alphanumerical strings?
> E.g. password: alphanumerical and lenght=6(at least)


Well, if alphanumerical means A-Z0-9 then the following is a way to
express that

<xs:element name="password" type="passwordType" />

<xs:simpleType name="passwordType">
<xs:restriction base="xs:string">
<xs:minLength value="6" />
<xsattern value="[a-zA-Z0-9]{6,}" />
</xs:restriction>
</xs:simpleType>


However many languages have more letters than A-Z so you might need to
extend the pattern, for instance with the letter ż

<xs:element name="password" type="passwordType" />

<xs:simpleType name="passwordType">
<xs:restriction base="xs:string">
<xs:minLength value="6" />
<xsattern value="[a-zA-Z0-9ż]{6,}" />
</xs:restriction>
</xs:simpleType>

Make sure you use an editor that is Unicode capable when you author the
XML schema file.


> how can i write pattern for e-mail addres. pseudocode like this:
> [alpha_num]'@'[alpha_num]'.com.pl'


While regular expressions are powerful I think they are not powerful
enough to write one that really matches all the possibilities the RFC
for email adresses allows.
--

Martin Honnen
http://JavaScript.FAQTs.com/

 
Reply With Quote
 
 
 
 
Ruthless
Guest
Posts: n/a
 
      12-28-2003
> > how can i write pattern for e-mail addres. pseudocode like this:
> > [alpha_num]'@'[alpha_num]'.com.pl'

>
> While regular expressions are powerful I think they are not powerful
> enough to write one that really matches all the possibilities the RFC
> for email adresses allows.


OK but for the example pattern with '@' and ending: 'com.pl'

how it would be? I don't know regular expresions at all and i'm beginner in
XML

Maybe sth like this:
<xs:simpleType name="mail-type">
<xs:restriction base="xs:string">
<xsattern value="[a-zA-Z0-9]{1,}[@][a-zA-Z0-9]{1,}['com.pl']" />
</xs:restriction>
</xs:simpleType>
?

thanks 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
 
Patrick TJ McPhee
Guest
Posts: n/a
 
      12-29-2003
In article <bsmr0n$djn$(E-Mail Removed)>,
Ruthless <ruthless@NO_SPAM.poczta.onet.pl> wrote:
% > > how can i write pattern for e-mail addres. pseudocode like this:
% > > [alpha_num]'@'[alpha_num]'.com.pl'
% >
% > While regular expressions are powerful I think they are not powerful
% > enough to write one that really matches all the possibilities the RFC
% > for email adresses allows.
%
% OK but for the example pattern with '@' and ending: 'com.pl'
%
% how it would be? I don't know regular expresions at all and i'm beginner in
% XML
%
% Maybe sth like this:
% <xs:simpleType name="mail-type">
% <xs:restriction base="xs:string">
% <xsattern value="[a-zA-Z0-9]{1,}[@][a-zA-Z0-9]{1,}['com.pl']" />
% </xs:restriction>
% </xs:simpleType>

This is no good. It doesn't allow, for instance, dots. It doesn't
append com.pl correctly. There are probably other problems. You could have

[a-zA-Z0-9._]+@[a-zA-Z0-9._]+com.pl

but it might be better to have

[^@\p{Z}]+@[^@\p{Z}]+com.pl

[^@\p{Z}] is the set of all characters except @ and space-type characters.

--

Patrick TJ McPhee
East York Canada
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
Ruthless
Guest
Posts: n/a
 
      12-29-2003
thanx

greetings R

Uytkownik "Patrick TJ McPhee" <(E-Mail Removed)> napisa w wiadomoci
news:bso76g$mol$(E-Mail Removed)...
> In article <bsmr0n$djn$(E-Mail Removed)>,
> Ruthless <ruthless@NO_SPAM.poczta.onet.pl> wrote:
> % > > how can i write pattern for e-mail addres. pseudocode like this:
> % > > [alpha_num]'@'[alpha_num]'.com.pl'




---
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
 
Martin Honnen
Guest
Posts: n/a
 
      12-29-2003


Patrick TJ McPhee wrote:

> In article <bsmr0n$djn$(E-Mail Removed)>,
> Ruthless <ruthless@NO_SPAM.poczta.onet.pl> wrote:
> % > > how can i write pattern for e-mail addres. pseudocode like this:
> % > > [alpha_num]'@'[alpha_num]'.com.pl'
> % >
> % > While regular expressions are powerful I think they are not powerful
> % > enough to write one that really matches all the possibilities the RFC
> % > for email adresses allows.
> %
> % OK but for the example pattern with '@' and ending: 'com.pl'
> %



>
> This is no good. It doesn't allow, for instance, dots. It doesn't
> append com.pl correctly. There are probably other problems. You could have
>
> [a-zA-Z0-9._]+@[a-zA-Z0-9._]+com.pl


It depends on what the original poster wants but I suspect the dot
between com.pl needs to be escaped
com\.pl



--

Martin Honnen
http://JavaScript.FAQTs.com/

 
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
Shrink large file according to REG_EXP thellper Perl Misc 12 01-18-2008 01:36 AM
reg_exp and croatian special characters Zvonko Bikup Javascript 1 03-16-2007 01:57 PM
XML + XSD: Is it possible to get all errors against the XSD? Markus Java 1 11-22-2005 02:53 PM
referencing another XSD file within an XSD file JavaDeveloper@nowhere.com XML 1 01-14-2004 05:22 PM
XSD document for XSD defintion Rick Razzano XML 1 09-26-2003 12:41 AM



Advertisments