MarpaX::Languages::SVG::Parser - Nested parsing

MarpaX::Languages::SVG::Parser uses XML::SAX and Marpa::R2 to parse an SVG file into an array of hashrefs.

XML::SAX parses the input file, and then certain tags' attribute values are parsed by Marpa::R2.

The attribute values treated specially each have their own BNFs. This is why it's called nested parsing.

Examples of these special cases are the path's 'd' attribute and the 'transform' attribute of various tags.

The SVG versions of the attribute-specific BNFs are here.

You are encouraged to peruse the FAQ.

I hope this code will show that it is not really difficult to implement 2-level parsing of (e.g.) XML for any dataset.

Leave a comment

About Ron Savage

user-pic I try to write all code in Perl, but find I end up writing in bash, CSS, HTML, JS, and SQL, and doing database design, just to get anything done...