RE: Validate regular expressions

I don't think it's possible to define a regular expression that matches all
regular expressions (and only regular expressions) - that view is based on
some long-forgotten computer-science theory concerned with different classes
of grammar, which others can correct me on if I've got it wrong. (It's
similar to another problem that comes up quite often, verifying that an
attribute holds a valid XPath expression).

XML Schema 1.1 allows assertions on complex types; my hope is that we will
also see them defined for simple types. That doesn't provide the whole
answer because the assertion language (XPath) isn't actually powerful enough
to describe such constraints. But XPath has well-defined extensibility
mechanisms that allow you to escape to procedural languages, and I believe
that this will in time enable you to define arbitrary constraints of this
kind provided the WG is brave enough to allow this power to be unleashed. 

At present, however, it has to be said that there's a strong sentiment
against allowing things that are quite so open-ended and lacking in
interoperability. These arguments are not without merit - if schemas were
computationally complete, would you be able to trust them? My own view,
however, is that we should give users the power they need to handle this
kind of requirement.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Sascha Mantscheff
> Sent: 06 December 2007 20:37
> To: xmlschema-dev@w3.org
> Subject: Validate regular expressions
> 
> 
> Is there a method to validate in a schema that an element's 
> or attribute's content is a valid regular expression? (I do 
> not want to test if the content *matches* a regular 
> expression, but if it *is* one.
> Maybe this boils down to a regular expression for regular 
> expressions, but is there another method?)
> 
> Any help welcome.
> s.m.
> 
> 
> 

Received on Thursday, 6 December 2007 23:37:39 UTC