validation

ASP .Net Custom Client-Side Validation

I have a custom validation function in JavaScript in a user control on a .Net 2.0 web site which checks to see that the fee paid is not in excess of the fee amount due. I've placed the validator code in the ascx file, and I have also tried using Page.ClientScript.RegisterClientScriptBlock() and in both cases the validation fires, but c...

How far should one take e-mail address validation?

I'm wondering how far people should take the validation of e-mail address. My field is primarily web-development, but this applies anywhere. I've seen a few approaches: simply checking if there is an "@" present, which is dead simply but of course not that reliable. a more complex regex test for standard e-mail formats a full regex ag...

How important is W3C XHTML/CSS validation when finalizing work?

Even though I always strive for complete validation these days, I often wonder if it's a waste of time. If the code runs and it looks the same in all browsers (I use browsershots.org to verify) then do I need to take it any further or am I just being overly anal? What level do you hold your code to when you create it for: a) yourself ...

Best method for varchar date validation in Sybase (T-SQL)?

I have a stored procedure which takes as its parameter a varchar which needs to be cast as a datetime for later use: SET @the_date = CAST(@date_string AS DATETIME) I'm expecting the date string to be supplied in the format "DD-MON-YYYY", but in an effort to code defensively, if for some reason it can't be cast successfully, I want to ...

Validating posted form data in the ASP.NET MVC framework

I've been playing around with the ASP.NET MVC Framework and the one thing that's really confusing me is how I'm meant to do server side validation of posted form data. I presume I don't post back to the same URL, but if I don't, how do I redisplay the form with the entered data and error messages? Also, where should the validation logi...

Problem databinding an ASP.Net AJAX toolkit MaskedEditExtender

I have a database that contains a date and we are using the MaskedEditExtender (MEE) and MaskedEditValidator to make sure the dates are appropriate. However, we want the Admins to be able to go in and change the data (specifically the date) if necessary. How can I have the MEE field pre-populate with the database value when the data ...

What's the best way to validate an XML file against an XSD file?

I'm generating xml files that need to conform to an xsd that was given to me. What's the best way to do this? ...

How do I validate xml against a DTD file in Python

I need to validate an XML string (and not a file) against a DTD description file. How can that be done in python? ...

What's the best way to implement field validation using ASP.NET MVC?

I am building a public website using ASP.NET, as part of the deliverable I need to do an Admin Site for data entry of the stuff shown in the public site, I was wondering what techniques or procedures are people using to validate entries using ASP.NET MVC. ...

How to check set of files conform to a naming scheme

I have a bunch of files (TV episodes, although that is fairly arbitrary) that I want to check match a specific naming/organisation scheme.. Currently: I have three arrays of regex, one for valid filenames, one for files missing an episode name, and one for valid paths. Then, I loop though each valid-filename regex, if it matches, appen...

How do you remove invalid hexadecimal characters from an XML-based data source prior to constructing an XmlReader or XPathDocument that uses the data?

Is there any easy/general way to clean an XML based data source prior to using it in an XmlReader so that I can gracefully consume XML data that is non-conformant to the hexadecimal character restrictions placed on XML? Note: The solution needs to handle XML data sources that use character encodings other than UTF-8, e.g. by specifyi...

MVC - where to implement form validation (server-side)?

In coding a traditional MVC application, what is the best practice for coding server-side form validations? Does the code belong in the controller, or the model layer? And why? ...

Email SMTP validator

I need to send hundreds of newsletters, but would like to check first if email exists on server. It's called smtp validation, at least i think so, based on my research on net. There's several libraries that can do that, and also a page with open-source code in asp (http://www.coveryourasp.com/ValidateEmail.asp#Result3), but I have hard t...

XML Parser Validation Report

Most XML parsers will give up after the first error in a document. In fact, IIRC, that's actually part of the 'official' spec for parsers. I'm looking for something that will break that rule. It should take a given schema (assuming a valid schema) and an xml input and attempt to keep going after the first error and either raise an e...

Checking if userinput is a valid URI in XUL

Is there an built-in function/method that can check if a given string is a valid URI or not in the Mozilla XUL toolkit. (I have looked for one but found none, but since this is my first time using XUL and it's documentation it could be that I just overlooked it. So I'm just making sure before I start writing my own IsValidURI function) ...

ValidationRule To Enforce Unique Name

I'm trying to write a custom WPF ValidationRule to enforce that a certain property is unique within the context of a given collection. For example: I am editing a collection of custom objects bound to a ListView and I need to ensure that the Name property of each object in the collection is unique. Does anyone know how to do this? ...

Validate (X)HTML in Python

What's the best way to go about validating that a document follows some version of HTML (prefereably that I can specify)? I'd like to be able to know where the failures occur, as in a web-based validator, except in a native Python app. ...

Validating a HUGE XML file

I'm trying to find a way to validate a large XML file against an XSD. I saw the question ...best way to validate an XML... but the answers all pointed to using the Xerces library for validation. The only problem is, when I use that library to validate a 180 MB file then I get an OutOfMemoryException. Are there any other tools,libraries,...

How to evaluate an IP?

How can I determine if a string is an IP? Either IPv4 or IPv6? What is the least and most number of characters? I assume this would be a regex answer. ...

Strong Validation in WPF

I have a databound TextBox in my application like so: (The type of Height is decimal?) <TextBox Text="{Binding Height, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True, Converter={StaticResource NullConverter}}" /> public class NullableConverter : IValueConverter { pu...