Donner
C++20 SVG rendering library
Loading...
Searching...
No Matches
donner::svg::parser::XMLParser::Options Struct Reference

Options to modify the parsing behavior. More...

#include "donner/svg/xml/XMLParser.h"

Public Member Functions

constexpr Options ()
 Default options.
 

Public Attributes

bool disableUserAttributes = true
 By default, the parser will ignore user-defined attributes (only presentation attributes will be parsed), to optimize for performance.
 

Detailed Description

Options to modify the parsing behavior.

Examples
svg_to_png.cc.

Member Data Documentation

◆ disableUserAttributes

bool donner::svg::parser::XMLParser::Options::disableUserAttributes = true

By default, the parser will ignore user-defined attributes (only presentation attributes will be parsed), to optimize for performance.

This behavior breaks some CSS matchers, which may use user-defined attributes to control styling.

For example:

<svg>
<style>
rect[fill="red"] { fill: green; }
rect[my-custom-attribute="value"] { stroke: green; }
</style>
<rect x="10" y="20" width="30" height="40"
my-custom-attribute="value"
fill="red" stroke="red" />
</svg>

If user attributes are disabled (disableUserAttributes is true), the above example will only match the first rule, because my-custom-attribute will be ignored during parsing.

To support rendering documents that use user-defined attributes, set this to false.

Examples
svg_to_png.cc.

The documentation for this struct was generated from the following file: