Parse an SVG XML document. More...
#include "donner/svg/parser/SVGParser.h"
Classes | |
| struct | Options |
| Options to modify the parsing behavior. More... | |
Static Public Member Functions | |
| static ParseResult< SVGDocument > | ParseSVG (std::string_view source, ParseWarningSink &warningSink, Options options={}, SVGDocument::Settings settings={}) noexcept |
| Parses an SVG XML document from a string (typically the contents of a .svg file). | |
| static ParseResult< SVGDocument > | ParseXMLDocument (xml::XMLDocument &&xmlDocument, ParseWarningSink &warningSink, Options options={}, SVGDocument::Settings settings={}) noexcept |
| Parses an SVG XML document from an XML document tree. | |
Parse an SVG XML document.
Elements outside the SVG namespace are retained in the tree as unknown elements rather than detached, so whole-tree consumers (attribute selectors, export checks, source projection) see a complete document. They are marked non-rendering: neither a foreign element nor its subtree paints, matching how conforming SVG consumers treat foreign content. A retained foreign subtree counts against Options::maximumTreeNodes and Options::maximumTreeDepth like any other content, and reports one unsupported-namespace warning at the top of the subtree.
|
staticnoexcept |
Parses an SVG XML document from a string (typically the contents of a .svg file).
This is a rendering parser, not an SVG sanitizer. SVGDocument::source() retains the original markup, including browser-active constructs that Donner does not render. Do not serve that source as a trusted browser document or treat serialization as sanitized output.
The input buffer does not need to be null-terminated, but if there are embedded null characters parsing will stop. Gzip-compressed input (SVGZ) is detected and decompressed automatically.
| source | Input buffer containing the SVG XML document. Will not be modified. |
| warningSink | Sink to collect warnings encountered during parsing. |
| options | Options to modify the parsing behavior. |
| settings | Document settings, including the resource loader and processing mode. |
|
staticnoexcept |
Parses an SVG XML document from an XML document tree.
| xmlDocument | XML document to parse. |
| warningSink | Sink to collect warnings encountered during parsing. |
| options | Options to modify the parsing behavior. |
| settings | Document settings, including the resource loader and processing mode. |