W3C home > Mailing lists > Public > www-svg@w3.org > March 2000

Re: Comma delimited lists in SVG

From: Dan Connolly <connolly@w3.org>
Date: Fri, 31 Mar 2000 18:10:41 -0600
Message-ID: <38E53E81.AE423D08@w3.org>
To: www-svg@w3.org
> From: Chris Lilley (chris@w3.org)
> Date: Mon, Mar 13 2000
[...]
> I note that URI syntax is  defined in EBNF, and XML syntax is also defined
> in EBNF, and SVGs path element d attribute in EBNF... It would have been
> really really neat to have been able to say, in a schema, that a particular
> attribute value (or indeed a particular content) had a particular EBNF.
> Subclassing what XML did. Saying "this attribute uses the following
> subclass of "string" (that overused CDATA) as follows ....

If you're willing to live with a restriction that your EBNF is
a regular grammar, and hence can be converted to a regular expression,
you *can* do that with schemas.
See:
	"2.4.2.4 pattern

	[Definition:]   pattern is a constraint on the value space of a
	datatype which is achieved by constraining the lexical space.
	The value of pattern must be a regular expression. "

	-- http://www.w3.org/TR/2000/WD-xmlschema-2-20000225/#pattern


Let's see if this works in the case of the SVG path element...

http://www.w3.org/TR/2000/03/WD-SVG-20000303/paths.html#PathDataBNF

Hmm... yes, it seems regular. I don't see any recursion.

Let's see if I can encode this as a regexp...

|svg-path:
|                 wsp* subpaths? wsp*

gives
	\s*{subpaths}?\s*

... combined with

|subpaths:
|                 subpath
|                 | subpath subpaths

we get

	\s*{subpath}*\s*

hmm... seems to be
	\s*{[Mn]\s*{coord-pair}(,\s*{lineto-argument-sequence})?}*\s*

then let's see... the number syntax makes for a bit of a hairy
regexp:

	(-?(\d+|(\d+?\.\d+([eE]\d+)?)
or something like that.

Anyway... I think it can be done.



> > With the exception of the color datatype, I'd suggest that the definition of all these attributes
> > be changed to strictly space-separated lists.
> 
> We might have to look at doing that if that is all that XSchema gives us.
> However, I live in hope that XSchema improves.

I suggest that you stick to space as a separator in the case of
simple vector lists. For regular constructus, use the pattern facet.

For more complex stuff (e.g. xpath notation), the schema spec doesn't
provide any mechanism to express that syntax.


-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/
Received on Friday, 31 March 2000 19:10:47 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:18 GMT