summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibXML
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-11-03 09:43:34 -0400
committerLinus Groh <mail@linusgroh.de>2022-11-03 14:52:16 +0000
commitb10bbac06104a64ca507cc305c422d8c85b70aae (patch)
tree68aeafa32e235586317967e15bbfdd71f31859db /Userland/Libraries/LibXML
parente7412717b4e7db12e4ec2fe7e2b61725d552169e (diff)
downloadserenity-b10bbac06104a64ca507cc305c422d8c85b70aae.zip
LibXML+LibWeb: Store the XML document's original source
Similar to how we store an HTML document's original source. This allows the source to be inspected with "View Source" in the Browser.
Diffstat (limited to 'Userland/Libraries/LibXML')
-rw-r--r--Userland/Libraries/LibXML/Parser/Parser.cpp1
-rw-r--r--Userland/Libraries/LibXML/Parser/Parser.h1
2 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibXML/Parser/Parser.cpp b/Userland/Libraries/LibXML/Parser/Parser.cpp
index 7212560218..256f8641c0 100644
--- a/Userland/Libraries/LibXML/Parser/Parser.cpp
+++ b/Userland/Libraries/LibXML/Parser/Parser.cpp
@@ -174,6 +174,7 @@ ErrorOr<void, ParseError> Parser::parse_with_listener(Listener& listener)
{
m_listener = &listener;
ScopeGuard unset_listener { [this] { m_listener = nullptr; } };
+ m_listener->set_source(m_source);
m_listener->document_start();
auto result = parse_internal();
if (result.is_error())
diff --git a/Userland/Libraries/LibXML/Parser/Parser.h b/Userland/Libraries/LibXML/Parser/Parser.h
index 0d45e9420b..63e8e061f3 100644
--- a/Userland/Libraries/LibXML/Parser/Parser.h
+++ b/Userland/Libraries/LibXML/Parser/Parser.h
@@ -29,6 +29,7 @@ struct ParseError {
struct Listener {
virtual ~Listener() { }
+ virtual void set_source(String) { }
virtual void document_start() { }
virtual void document_end() { }
virtual void element_start(Name const&, HashMap<Name, String> const&) { }