|
|
Donner 0.5.1
Embeddable browser-grade SVG2 engine
|
Options to modify the parsing behavior. More...
#include "donner/base/xml/XMLParser.h"
Public Member Functions | |
| constexpr | Options () |
| Default options. | |
Static Public Member Functions | |
| static Options | ParseAll () |
| Parse all nodes in the XML document, including comments, the doctype node, and processing instructions. | |
Public Attributes | |
| bool | parseComments = false |
| Parse comments in the XML document, e.g. | |
| bool | parseDoctype = true |
| Parse the doctype node in the XML document, e.g. | |
| bool | parseCustomEntities = false |
| Parse custom entities in the XML document, e.g. | |
| bool | parseProcessingInstructions = false |
| Parse processing instructions in the XML document, e.g. | |
| bool | disableEntityTranslation = false |
| Disable entity translation during parsing. | |
| int | maxEntityDepth = 64 |
| Maximum nesting depth allowed while expanding entities. | |
| uint64_t | maxEntitySubstitutions = 1'000 |
| Maximum total entity substitutions allowed for a single document parse. | |
| uint64_t | maxElements = 100'000 |
| Maximum total number of elements (and other tree-nodes) allowed in a single document parse. | |
| uint64_t | maxAttributesPerElement = 1'000 |
| Maximum number of attributes permitted on a single element. | |
| int | maxNestingDepth = 256 |
| Maximum element nesting depth in the parsed tree. | |
Options to modify the parsing behavior.
| bool donner::xml::XMLParser::Options::disableEntityTranslation = false |
Disable entity translation during parsing.
If this flag is set to true, built-in entities such as & and < will not be translated to their respective characters.
| uint64_t donner::xml::XMLParser::Options::maxAttributesPerElement = 1'000 |
Maximum number of attributes permitted on a single element.
Defaults to 1'000, which is far more than any realistic SVG needs. Refuses the "billion-attribute" expansion where an attacker piles thousands of attributes onto a single tag to amplify per-attribute callback / validation work.
| uint64_t donner::xml::XMLParser::Options::maxElements = 100'000 |
Maximum total number of elements (and other tree-nodes) allowed in a single document parse.
Defaults to 100'000 — larger than any realistic SVG but small enough to refuse a "billion-rect" DoS in bounded time. Failing to stay under this limit causes parsing to fail with a resource exhaustion error.
| int donner::xml::XMLParser::Options::maxEntityDepth = 64 |
Maximum nesting depth allowed while expanding entities.
Defaults to 64. Failing to stay under this limit will cause parsing to fail with a resource exhaustion error.
| uint64_t donner::xml::XMLParser::Options::maxEntitySubstitutions = 1'000 |
Maximum total entity substitutions allowed for a single document parse.
Defaults to 1'000. Failing to stay under this limit will cause parsing to fail with a resource exhaustion error.
| int donner::xml::XMLParser::Options::maxNestingDepth = 256 |
Maximum element nesting depth in the parsed tree.
Defaults to 256. This is the structural depth of <a><b><c>...</c></b></a>, orthogonal to maxEntityDepth. Exceeding it causes parsing to fail with a resource exhaustion error — this protects both the parser (which recurses into parseNodeContents) and later consumers (CSS cascade, renderers) from unbounded stacks.
| bool donner::xml::XMLParser::Options::parseComments = false |
Parse comments in the XML document, e.g.
<!-- ... -->. If this flag is set to true, comments will be parsed as donner::xml::XMLNode::Type::Comment nodes added to the document tree.
| bool donner::xml::XMLParser::Options::parseCustomEntities = false |
Parse custom entities in the XML document, e.g.
<!ENTITY ...>. If this flag is set to true, custom entities will be parsed and and translated in the document tree.
| bool donner::xml::XMLParser::Options::parseDoctype = true |
Parse the doctype node in the XML document, e.g.
<!DOCTYPE ...>. If this flag is set to true, the doctype node will be parsed as a donner::xml::XMLNode::Type::DocType node added to the document tree.
| bool donner::xml::XMLParser::Options::parseProcessingInstructions = false |
Parse processing instructions in the XML document, e.g.
<?php ...>. If this flag is set to true, processing instructions will be parsed as donner::xml::XMLNode::Type::ProcessingInstruction nodes added to the document tree.