Regular expression validation for email

I might be doing something stupid here but I really need some help.
Can someone please tell me why can't I get this xml to pass my
validation when I use XmlValidatingReader?  The XMLSpy seems to accept
it.

XML:
<?xml version="1.0" encoding="UTF-8"?>
<Address>
	<email>x.x@x.com</email>
</Address>

XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="Address">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="email" type="email"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:simpleType name="email">
		<xs:restriction base="xs:string">
		<xs:minLength value="1" />
		<xs:maxLength value="100" />
		<xs:pattern
value="([\w_\-]*[.]*[\w_\-])+@[\w_\-]+[.]+[a-zA-Z]{2,4}"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>

Code:
				XmlValidatingReader reader = new XmlValidatingReader(new
XmlTextReader( new StringReader( xmlString ) ) );

				reader.ValidationType = ValidationType.Schema;
				reader.Schemas.Add(null, "D:\\Projects\\Test\\email.xsd");
	reader.ValidationEventHandler += new
System.Xml.Schema.ValidationEventHandler(this.ValidationEventHandle);
				while (XSDValidationError == string.Empty && reader.Read())
				{
					reader.Read();
				}


ValidationHandler:
		private void ValidationEventHandle (object sender,
ValidationEventArgs args)
		{
//Error trapping code
		}

0
8/16/2005 12:35:14 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
616 Views

Similar Articles

[PageSpeed] 28

Also, if I use the same regular expression in my C# code the validation
works fine, it's just the XSD validation by XmlValidatingReader is not
working

Regex validEmail = new
Regex(@"([\w_\-]*[.]*[\w_\-])+@[\w_\-]+[.]+[a-zA-Z]{2,4}");
if (!validEmail.IsMatch("aa.cc@aa.com"))
.....

Thanks

0
8/16/2005 3:07:49 PM
This is a known problem in .net 1.1 which is fixed in .net 2.0 beta2.

"AGGoogle" <ajayk_goel@yahoo.com> wrote in message
news:1124204869.117087.59570@z14g2000cwz.googlegroups.com...
> Also, if I use the same regular expression in my C# code the validation
> works fine, it's just the XSD validation by XmlValidatingReader is not
> working
>
> Regex validEmail = new
> Regex(@"([\w_\-]*[.]*[\w_\-])+@[\w_\-]+[.]+[a-zA-Z]{2,4}");
> if (!validEmail.IsMatch("aa.cc@aa.com"))
> ....
>
> Thanks
>


0
someone1 (389)
8/17/2005 1:16:29 AM
Reply:

Similar Artilces:

Formatting Text in a Forwarded Email Message
Odd problem in Outlook on one of our pc's. We are using Outlook 2002 SP3. When attempting to forward a message, I sometimes change a few of the words in the body of the message. I place the cursor within the word I wish to change. As soon as I type one letter, any letter, the letter shows up two font sizes bigger (from 12 to 14), and with a space on each side of the inserted letter. What seems to make this more puzzling is that when I attempt the same task on our other pc, everything functions as it should; no change in font size and no extra spaces. Any help in eli...

frozen emails in queues under smtp local
Our exchange server 2000 was working fine till to wensday afternoon.Then it started working slow.Then I got lots of emails (incoming and outgoing) frozen in queues. I checked the server with Virus Killer and spyware I couldn't locate anyone. Then I tried to start and stop smtp service. so some of emails got delivered (a few)and some didn't ( lots of them ). I even deleted all emails from queues the restared Server. But no result, again I got lots of new emails frozen (marked frozen). I tried unfreeze command but it didn't helped. any idea or help would be appreciated. Hi ...

CRM Email router prob
Hi, Have installed MS CRM 1.2 on SBS 2003 Premium. Client is using OWA so have followed instructions to install router to a seperate web site. However, incoming emails (as in replies to CRM emails) are still generating errors in the event viewer as follows: A platform error message was encountered. Subject: 'RE: Test 9 - post reinstall CRM:{4359A166-A341-4407-9E6B-AF7FB608AEEF}:MRC' Platform Error Code: 80070057 Platform Error Description: 'The parameter is incorrect. ' Literal SOAP Fault: '<e...

Sending daily emails automatically
I am trying to send a daily email message automatically. For example a safety message that will not change but needs to be sent everyday. Rather than spend time each day cutting and pasting the message and sending, can it be set up to send this message automatically? Is this possible to do? Take a look at http://www.outlookcode.com/d/forms/skedrpt.htm -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< &g...

Mobile Express set-up problem
After the installation, when I try to add some entities to the mobile application I get the following error: <?xml version="1.0"?> <configuration> <appSettings> <add key="DraftXmlLocation" value="C:\CrmMobileExpress\DraftXML.xml"/> <add key="PublishedXmlLocation" value="C:\CrmMobileExpress\PublishedXML.xml"/> <add key="Microsoft.Crm.Sandbox.Mobile.CrmServiceSdk.CrmService" value="http://triton:5555/MSCRMServices/2006/CrmService.asmx"/> <add key="Microsoft.Crm.Sandbox.Mobil...

"tracing" email
One of my users is receiving "anonymous" email from someone at my firm. They were first using a hotmail account and now have switched to another account. What do I need to find out who is sending this mail, or at least figure out where it is coming from? ANY information will be greatly appreciated! Thanks! Doreen "Doreen" <doreo715@hotmail.com> wrote: > >One of my users is receiving "anonymous" email from someone at my firm. >They were first using a hotmail account and now have switched to another >account. > >What do I need to fin...

POP3 Emails and Exchange Server
Hey all: I have a virtual POP3 Server running on my exchange server 2000. My company just purchased a bunch of Treo 600 and want to set them up to receive corporate emails. What I would like to do is use the POP3 Account instead of purchasing a package that would work directly with Exhange Server. My question is how do I find out what my pop3 account name is. I tried using pop3.mydomainname.com, and mail.mydomainname.com, but that didn;t work. Can anyone provide me with the steps to locate the name of my pop3 account. Thanks ...

Wnat to change email address of Public Folder email address with Exchange 2003! Get error
The HTTP service used by Public Folder is not avialable, possible are that the Public stores are not mounted and the Information Store service i snot running. Id no: c1030af Exchange System Manager Used as part of SBS 2K3 Publick folders and information services are started and working properly! Questions? 1) How to fix Public stores are not mounted? How? 2) Fixed with Exchange SP1 "Walt Smith" <walts@yahoo.com> wrote in message news:z0Nqe.59554$887.53617@tornado.socal.rr.com... > The HTTP service used by Public Folder is not avialable, possible ...

Outlook Junk Filter is filtering good emails sometime
I have a co worker that sends me emails all the time, some time the junk email filters it, and sometimes it does not. I would like it to never filter emails from his address. Using outlook 2003 with exchange 2003 Frank. Can you add them to the Safe Senders list? "WizardOnTheRun" <frank.perryman@dadeservice.com> wrote in message news:1186663659.958194.221190@b79g2000hse.googlegroups.com... >I have a co worker that sends me emails all the time, some time the > junk email filters it, and sometimes it does not. I would like it to > never filter emails from his addre...

Send page as (the body of the) email..., How?
In IE 6 > open a page *on the web*> File > Send > Send page as email...> the result is a message with the page as the body. But when I open a *local* HTML file, one on this computer, and try to send as email, the result is a plain text email with the HTML page as an attachment. Why is there a difference? And how do I "Send page as email" with the page as the body of the message when the page is stored locally? IE6 and Outlook 2003 -- ********************* * Nehmo Sergheyev * ********************* > In IE 6 > open a page *on the web*> F...

If I delete a profile will the email still be available?
Hello All I have SBS 2K3, outlook 2003, mail is saved in personal folders. I am getting MS exchange is in recovery mode messages when I log in with outlook 2K3. i say a post that said to delete the profile, and make a new one to aleviate this error, my questions is will the email be o.k? Thaks for any info MMJII MMJII <MMJII@microsoft.com> wrote: > I have SBS 2K3, outlook 2003, mail is saved in personal folders. I am > getting MS exchange is in recovery mode messages when I log in with > outlook 2K3. i say a post that said to delete the profile, and make a > new one to a...

how do i configure outlook to use my aol email account
jonbon wrote: <nothing> PLEASE write your question in the body of the post and NOT just the subject Have a look here: http://dts-l.org/goodpost.htm the answer: http://www.slipstick.com/addins/services/online.htm which Google would have told you with 6.5 million hits in 0.43 secs. http://www.slipstick.com/addins/services/online.htm#aol -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outlook Tips: http://www.outlook-t...

Contacts with multiple email addresses #2
Need Help When I right-click a contact and click create new message, all of the contacts three email addresses autimatically appear in the "to" line. How do I prevent this from happening. In other words, how do I make one the three addresses for that contact a default address so that only that one appears when I try to send an email. Thanks ...

Disapearing emails
Outgoing emails are sent and a copy is placed in SentItems box, however they do not reach SMTP server. Outlook behaves as though it connected to the server and sent the email, however it never reaches the SMTP server and therefore is not delivered. Even an email addressed to myself never gets delivered. The SMTP server appears to be functioning correctly; I am able to send email via the web interface to my account. All the incoming email is retrieved correctly from the mail server. Any ideas? Is it possible that I have a trojan that redirects all outgoing emails to a different SMTP...

Creating EMAIL Message -- Font is blurry to recipient
Once I send an email that I create in publisher the text appears blurry to the recipeint. Any one have any ideas how I can eliminate this problem I am using Verdan 8pt font and i have converted it to a web publication. Hi JV (anonymous@discussions.microsoft.com), in the newsgroups you posted: || Once I send an email that I create in publisher the text appears || blurry to the recipeint. Any one have any ideas how I can eliminate || this problem? || || I am using Verdan 8pt font and i have converted it to a web || publication. Is it blurry only to this particular recipient? What does it loo...

Attaching email in queue to custom entity
Hi all, I am trying to do the above in code. I am able to create a new entity, and change the regardingobjectid on the email to the entity name. When I go into the interface and find the email, everything looks OK, however, when I go into the custom entity, I cannot see the activity either in the history, or in the activity list. Does anyone know how to achieve what I am trying to do? Thanks Saira The entity activity lists seem to be tied to the contents of the ActivityPartyBase table. You will need the Regarding object to be defined as a party and the owner as a second party (2 recor...

email address changing
We are experiencing a problem where users email address are changing by themselves. The users have an alias that we setup during user creation that is different from the username. Out of the blue they are having email addresses that show up that are their username@domain.com and it is set as the primary address. Any ideas? thanks The Recipient Policy is the obvious candidate. Take a look and post back to the list if that is not the source of the problem. Nue "Taylor" <user@home.com> wrote in message news:%23grbhzvFGHA.3100@tk2msftngp13.phx.gbl... > We are experien...

Cannot send email between users within same server?
Hi, Running Exchange 2003 Enterprise with latest SP on Windows 2003 Enterprise with latest SP. We are getting intermittent error message with users on the same Exchange server and OU. Any help is greatly appreciated. Thanks! Your message did not reach some or all of the intended recipients. Subject: Sent: 4/20/2010 11:44 AM The following recipient(s) cannot be reached: John Doe on 4/20/2010 11:45 AM You do not have permission to send to this recipient. For assistance, contact your system administrator. MSEXCH:MSExchangeIS:/DC=...

Data validation doesn't work if contents is added by pasting
Hi I've data validation set so that only the number 1 can be entered, but even this cannot be entered if an adjacent cell is a certain value. this works for direct entry, but not if the value is pasted in or added using the "drag handle". Is there any way to stop this happening as I just know somewones going to try and fill all the cells by draging the values down. Regards Jeff Jeff, You could disable "Allow cell drag and drop" in Tools | Options or... copy the following code, right click the sheet tab and choose 'view code'. Paste the code into the modu...

Dropdown lists thru Validation not friendly to Manual Text Entries
Using Excel 2000. I created a (long) dropdown list using the Validation feature. When users go to enter data, some prefer to never touch their mouse. And scrolling through this long list is cumbersome for everyone. Is there a way to either autocomplete an entry based on the items in the list? Or to have the dropdown box "intelligently" scroll when a user types a few characters (For instance, drop to the "S's" when he or she keys in an 'S'?) thanks! (sorry if this was addressed in other posts, I really have tried searching) --- Message posted from http:...

email downloads require right click to download pictures
I know the saftey precautions that Outlook (2003) has concerning the downloading of pictures (right-click to download pictures) Also know how to set the options under security. My problem is that if I decide to right click and download the pictures, it does not always work unless I close he first try then right open the email a 2nd time and ths time the pctures will download. TIA, BL ...

The format disappears when I send the message via email
Need your help desperately!! I've created a file and sent out as message via email. However, the template collapsed, words and pictures are all distached. Last time, I was successful to do so but not this time. What happen to the setting? -- Christine Lam ...

VB 10 Express: Can i build standalone app?
Hello guys, I am new to vb. Can I build project to standalone application so I can execute it from command line in VB10 Exress? Your EXE will depend on also having the .NET framework installed. Which framework depends on which target that you have set. Default may be that of the .NET 4.0 framework, which may or may not already be on your target machine. Also, any external assemblies that you might have used (or created in your project) also must be deployed with your EXE. So, the answer (in general) is no. However, the practical answer may be "yes." This is a ...

Problem with Outlook Task Reminder-Parameter Values are not valid
I have Outlook 2003 and have a problem that started around 3 days ago. I had a reminder in my task list and erased it. WEll I have done this frequently but something went wrong this time. Now whenever I open Outlook it comes up with this reminder. I immediately select to dismiss it and it says "Cannot turn off the reminder. You may be reminded Again. Could not complete the operation. One or more parameter values are not valid." I just select okay but this comes up every time I go into this program. Yet when I go into my task list that task does not appear. Any idea how I can ...

How do I restore gmail inbox emails that Outlook 2010 Beta deleted
I used Outlook 2010 Beta for the first time today...first time I've ever used Outlook. I added three email accounts, the default one being my personal gmail account. After adding them, I read some of my emails...was thinking how cool this was....when I discovered I was unable to log into gmail accounts from my Firefox browser. I then deleted the email accounts from Outlook. The only account affected by all this is my default personal email account at gmail, somehow all of my inbox emails were deleted. Vanished. Poof!!! I tried two different restore points and both times...