Lists Home |
Date Index |
- From: Ketil Z Malde <email@example.com>
- To: Joel Bender <firstname.lastname@example.org>
- Date: 02 Dec 1998 09:48:53 +0100
Joel Bender <email@example.com> writes:
> I was thinking along similar lines. I've been adding something like this
> to my XML documents:
> <prop name="state" xml:regexp="[A-Z]+">NY</prop>
It's a neat way of doing it, since checking is optional and
transparent to non-checking applications.
> So the parser can verify that the CDATA matches the regular expression.
> Works OK for content, but I don't see how I can add this meta-meta-data for
The dividing line between attributes and elements is a fine one,
anyway. Is it a real restriction to have the user embed constrained
information content in elements and not attributes? E.g.
or perhaps rather
<!-- one of state, county, city -->
> That is to say, how can I tell the parser that the 'name'
> attribute value for the 'prop' entity must be of the form
Not to mention the form of the xml:regexp attribute, eh? :-)
Actually, that *is* a problem, since as a DTD designer, I want to
express the lexical data formats my applications handle, I wouldn't
want to leave this to document authors, who probably know more about
technical writing, and less about the technical limitations of the
By the way, you *can* check attributes by doing
<prop name="state" name.regexp=""[a-zA-Z_][0-9a-zA-Z_]*"...>
or something, can't you?
> Of course this also brings up the murky waters of grep syntax, which I've
> been avoiding.
Well, looking back, I realize I consider regular expressions a simple
solution. Looking further back, I realize that this is because of a
long and shady past of juggling Unix shell scripts.
On the other hand, regular expressions are very powerful, and you
don't really need to know all the ins and outs to write simple ones,
like "[A-Z]" or "(one|two|three)". And many of the special characters
are used in DTDs already (+*?).
If I haven't seen further, it is by standing in the footprints of giants
xml-dev: A list for W3C XML Developers. To post, mailto:firstname.lastname@example.org
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:email@example.com the following message;
To subscribe to the digests, mailto:firstname.lastname@example.org the following message;
List coordinator, Henry Rzepa (mailto:email@example.com)