[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Internal subset equivalent in new schema proposals?

  • From: Ketil Z Malde <ketil@i...>
  • To: Joel Bender <joel@s...>
  • Date: 02 Dec 1998 09:48:53 +0100

regex state
Joel Bender <joel@s...> 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
> attributes.

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.

	<prop>
	  <name xml:regexp="(state|county|city)">state</name>
	  <prop-content...> </..>
        </prop>

or perhaps rather

	<prop>
	   <!-- one of state, county, city -->
	   <state xml:regexp="[A-Z]+">NY</state>
	<prop>

>  That is to say, how can I tell the parser that the 'name'
> attribute value for the 'prop' entity must be of the form
> "[a-zA-Z_][0-9a-zA-Z_]*"?

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
application software.

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 (+*?).

~kzm
-- 
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:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.