I'm not so much of an XML expert, but isn't the CCDATA character section
offering a nice solution in order to preserve the real look of a reg. exp.
in an XML file?
Fr.
-----Original Message-----
From: David Winterfeldt [mailto:[EMAIL PROTECTED]]
Sent: 25 June 2001 18:11
To: [EMAIL PROTECTED]
Subject: RE: server-side, java-based validation rules for struts..
Regular expressions should be:
^"\(?(\d{3})\)?[-| ]?(\d{3})[-| ]?(\d{4})$"
Properties file version
^\"\\(?(\\d{3})\\)?[-| ]?(\\d{3})[-| ]?(\\d{4})\"$
David
--- David Winterfeldt <[EMAIL PROTECTED]> wrote:
> When you are doing regular expressions you can
> basically just cut and paste them from an example
> and
> escape out the few XML sensitive characters, but you
> have to escape out the escape characters in a java
> properties file which I think makes something that
> is
> already hard to read even more unreadable. This is
> just a simple regular expression.
>
> XML Version (phone number with double quotes around
> it)
> "^\(?(\d{3})\)?[-| ]?(\d{3})[-|
> ]?(\d{4})$"
>
> Properties file version
> \"^\\(?(\\d{3})\\)?[-| ]?(\\d{3})[-| ]?(\\d{4})$\"
>
> In a regular expression a '(' means something and
> regular expressions also use '\' to escape out
> characters except they don't match java's escape
> characters. So '\\(' is escaping out a '\' which is
> then escaping a '('.
>
> I did a project keeping all of my regular
> expressions
> in a properties file and I find keeping them in xml
> much more convenient. Of course if you were using a
> Java IDE then you wouldn't have to worry about
> escaping out the java escape characters yourself,
> but
> not everyone uses a full blown IDE.
>
> When I mentioned less technical people I meant
> art/design people that use something like
> Dreamweaver.
> Dreamweaver already has basic support for JSP and
> one
> day it will probably support or have a plugin for
> editing XML files. I don't think less technical
> people are going to find a java IDE easier to use
> than
> an HTML editor if you use properties files. There
> are
> lots of generic XML editing packages so you don't
> have
> to hand roll your own xml editor. And there's
> always
> vi or notepad.
>
> David
> http://home.earthlink.net/~dwinterfeldt
>
>
> --- Nick Afshartous <[EMAIL PROTECTED]>
> wrote:
> >
> > Cook, Levi writes:
> > > IMHO, expressing rules using first class Java
> > objects *can* be just as
> > > flexible as defining rules in an XML file.
> > >
> > > The analog to changing a value in an XML file
> is
> > using a property editor to
> > > change values stored in a JavaBean (thus
> avoiding
> > recompiling). The upside
> > > of this approach is simpler integration with
> > visual editors (simply
> > > implement a property editor for your
> form-bean).
> >
> > > Ultimately, I feel this is
> > > where your less technical people can begin to
> > contribute more effectivly.
> > > The other route requires hand-rolling a visual
> > editor for your XML scheme
> > > and/or having your users learn quite a bit
> about
> > the intricacies of your
> > > schema.
> >
> > Thanks Levi for pointing out that a property
> editor
> > could be used.
> > Could one also add new rules and attributes
> > dynamically with a
> > property editor ?
> >
> > Maybe the trickiest part for the users would be to
> > learn the
> > syntax for rule expressions. In particular how to
> > refer
> > to object attributes within a rule.
> > --
> >
> > Nick
> >
> >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
************************************************************************
The information in this email is confidential and is intended solely
for the addressee(s).
Access to this email by anyone else is unauthorised. If you are not
an intended recipient, you must not read, use or disseminate the
information contained in the email.
Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of Capco.
http://www.capco.com
***********************************************************************