summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.h
blob: 1157ea47637ed1f7f04cf0e09f7aadea6fec25d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/RefCounted.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/Forward.h>

namespace Web::DOMParsing {

class XMLSerializer final
    : public RefCounted<XMLSerializer>
    , public Bindings::Wrappable {
public:
    using WrapperType = Bindings::XMLSerializerWrapper;

    static NonnullRefPtr<XMLSerializer> create_with_global_object(Bindings::WindowObject&)
    {
        return adopt_ref(*new XMLSerializer());
    }

    virtual ~XMLSerializer() override;

    DOM::ExceptionOr<String> serialize_to_string(NonnullRefPtr<DOM::Node> root);

private:
    XMLSerializer();
};

enum class RequireWellFormed {
    No,
    Yes,
};

DOM::ExceptionOr<String> serialize_node_to_xml_string(NonnullRefPtr<DOM::Node> root, RequireWellFormed require_well_formed);

}