mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-12 11:10:13 +00:00
LibXML: Add parser hooks for CDATASection and ProcessingInstructions
This allows listeners to be notified when a CDATASection or ProcessingInstruction is encountered during parsing. The non-listener path still has the incorrect behavior of silently treating CDATASection as Text nodes, but this allows listeners to handle them correctly.
This commit is contained in:
parent
5a1de8a187
commit
d9976b98b9
Notes:
github-actions[bot]
2025-07-19 12:57:43 +00:00
Author: https://github.com/ADKaster
Commit: d9976b98b9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5512
Reviewed-by: https://github.com/alimpfard ✅
2 changed files with 28 additions and 2 deletions
|
@ -40,6 +40,8 @@ struct Listener {
|
|||
virtual void element_start(Name const&, HashMap<Name, ByteString> const&) { }
|
||||
virtual void element_end(Name const&) { }
|
||||
virtual void text(StringView) { }
|
||||
virtual void cdata_section(StringView) { }
|
||||
virtual void processing_instruction(StringView, StringView) { }
|
||||
virtual void comment(StringView) { }
|
||||
virtual void error(ParseError const&) { }
|
||||
};
|
||||
|
@ -82,6 +84,8 @@ private:
|
|||
void append_node(NonnullOwnPtr<Node>);
|
||||
void append_text(StringView, LineTrackingLexer::Position);
|
||||
void append_comment(StringView, LineTrackingLexer::Position);
|
||||
void append_cdata_section(StringView, LineTrackingLexer::Position);
|
||||
void append_processing_instruction(StringView target, StringView data);
|
||||
void enter_node(Node&);
|
||||
void leave_node();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue