W3C home > Mailing lists > Public > www-svg@w3.org > May 2021

Re: Validation of SVG paths

From: Dr. Olaf Hoffmann <dr.o.hoffmann@gmx.de>
Date: Sat, 15 May 2021 13:01:03 +0200
To: www-svg@w3.org
Cc: benkasminbullock@gmail.com
Message-ID: <2595631.pH2jSZUcsh@hp>
Relevant both for implementations and validation is the recommendation.
There is no reference implementation, all implentations have bugs and gaps,
none is complete unfortunately.
In this case we have a BNF grammar for path data:
See as well

Clearly after a M or m a coordinate pair has to follow.
The next character we expect is whitespace or a digit, dot or sign).

If you want to write a relatively simple path validation yourself, use the BNF
from the recommendation ;o)

If validators like that from W3C are based on DTDs, there is only a limited
check of attribute values possible, DTDs do not include (E)BNF unfortunately.
Specific SVG validators have to take into account much more than a schema
language seems to provide, some rules are only available as prose, but path
syntax can be checked automatically.
Received on Saturday, 15 May 2021 11:01:19 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 15 May 2021 11:01:20 UTC