Re: Validation of SVG paths

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