2022-07-05 18:59:45 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-09-03 00:22:54 +02:00
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
2022-07-05 18:59:45 +01:00
|
|
|
|
|
|
|
namespace Web::DOMParsing {
|
|
|
|
|
2022-09-03 00:22:54 +02:00
|
|
|
class XMLSerializer final : public Bindings::PlatformObject {
|
|
|
|
WEB_PLATFORM_OBJECT(XMLSerializer, Bindings::PlatformObject);
|
2022-07-05 18:59:45 +01:00
|
|
|
|
2022-09-03 00:22:54 +02:00
|
|
|
public:
|
2023-02-19 16:51:16 +01:00
|
|
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<XMLSerializer>> construct_impl(JS::Realm&);
|
2022-07-05 18:59:45 +01:00
|
|
|
|
|
|
|
virtual ~XMLSerializer() override;
|
|
|
|
|
2023-02-25 10:44:51 -07:00
|
|
|
WebIDL::ExceptionOr<DeprecatedString> serialize_to_string(JS::NonnullGCPtr<DOM::Node const> root);
|
2022-07-05 18:59:45 +01:00
|
|
|
|
|
|
|
private:
|
2022-09-25 16:15:49 -06:00
|
|
|
explicit XMLSerializer(JS::Realm&);
|
2023-01-10 06:28:20 -05:00
|
|
|
|
2023-01-28 12:33:35 -05:00
|
|
|
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
2022-07-05 18:59:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum class RequireWellFormed {
|
|
|
|
No,
|
|
|
|
Yes,
|
|
|
|
};
|
|
|
|
|
2023-02-25 10:44:51 -07:00
|
|
|
WebIDL::ExceptionOr<DeprecatedString> serialize_node_to_xml_string(JS::NonnullGCPtr<DOM::Node const> root, RequireWellFormed require_well_formed);
|
2022-07-05 18:59:45 +01:00
|
|
|
}
|