Donner 0.8.0-pre
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::xml::XMLIncrementalParser Class Reference

Parser entry points for source-edit fragments. More...

#include "donner/base/xml/XMLIncrementalParser.h"

Static Public Member Functions

static ParseResult< XMLDocumentParseAttribute (std::string_view attributeSource)
 Parse one attribute source fragment by wrapping it in a synthetic element.
static ParseResult< XMLDocumentParseOpeningTag (std::string_view openingTagSource)
 Parse one opening tag source fragment.
static ParseResult< XMLDocumentParsePcdata (std::string_view textSource)
 Parse parsed-character-data source by wrapping it in a synthetic element.
static ParseResult< XMLDocumentParseTextLikeNode (std::string_view nodeSource)
 Parse one raw text-like node source fragment.
static ParseResult< XMLDocumentParseElement (std::string_view elementSource)
 Parse one element subtree source fragment.

Detailed Description

Parser entry points for source-edit fragments.

These helpers parse the bounded XML scopes used by XMLDocument::applySourceEdit. Returned documents own a temporary source store whose source locations are relative to the parsed fragment; callers that install the parsed metadata into a live document must offset those ranges by the fragment's source offset.

Member Function Documentation

◆ ParseAttribute()

ParseResult< XMLDocument > donner::xml::XMLIncrementalParser::ParseAttribute ( std::string_view attributeSource)
static

Parse one attribute source fragment by wrapping it in a synthetic element.

Parameters
attributeSourceSource bytes such as fill="red".
Returns
Parsed temporary XML document, or a parse diagnostic.

◆ ParseElement()

ParseResult< XMLDocument > donner::xml::XMLIncrementalParser::ParseElement ( std::string_view elementSource)
static

Parse one element subtree source fragment.

Parameters
elementSourceSource bytes for the complete element subtree.
Returns
Parsed temporary XML document, or a parse diagnostic.

◆ ParseOpeningTag()

ParseResult< XMLDocument > donner::xml::XMLIncrementalParser::ParseOpeningTag ( std::string_view openingTagSource)
static

Parse one opening tag source fragment.

The opening tag is converted to a self-closing tag when needed so attributes can be parsed without reparsing the element body.

Parameters
openingTagSourceSource bytes such as <rect fill="red">.
Returns
Parsed temporary XML document, or a parse diagnostic.

◆ ParsePcdata()

ParseResult< XMLDocument > donner::xml::XMLIncrementalParser::ParsePcdata ( std::string_view textSource)
static

Parse parsed-character-data source by wrapping it in a synthetic element.

Parameters
textSourceSource bytes from an element text span.
Returns
Parsed temporary XML document, or a parse diagnostic.

◆ ParseTextLikeNode()

ParseResult< XMLDocument > donner::xml::XMLIncrementalParser::ParseTextLikeNode ( std::string_view nodeSource)
static

Parse one raw text-like node source fragment.

This is used for CDATA sections, XML comments, and processing instructions.

Parameters
nodeSourceSource bytes for the complete text-like node.
Returns
Parsed temporary XML document, or a parse diagnostic.

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