2022-03-26 21:32:57 +04:30
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Ali Mohammad Pur <mpfard@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-12-04 18:02:33 +00:00
|
|
|
#include <AK/DeprecatedString.h>
|
2022-09-13 17:42:39 +02:00
|
|
|
#include <AK/HashMap.h>
|
2022-03-26 21:32:57 +04:30
|
|
|
#include <AK/Variant.h>
|
|
|
|
#include <AK/Vector.h>
|
|
|
|
#include <LibXML/FundamentalTypes.h>
|
|
|
|
|
|
|
|
namespace XML {
|
|
|
|
|
|
|
|
struct Attribute {
|
|
|
|
Name name;
|
2022-12-04 18:02:33 +00:00
|
|
|
DeprecatedString value;
|
2022-03-26 21:32:57 +04:30
|
|
|
};
|
|
|
|
|
|
|
|
struct Node {
|
|
|
|
struct Text {
|
|
|
|
StringBuilder builder;
|
|
|
|
};
|
|
|
|
struct Comment {
|
2022-12-04 18:02:33 +00:00
|
|
|
DeprecatedString text;
|
2022-03-26 21:32:57 +04:30
|
|
|
};
|
|
|
|
struct Element {
|
|
|
|
Name name;
|
2022-12-04 18:02:33 +00:00
|
|
|
HashMap<Name, DeprecatedString> attributes;
|
2023-03-06 17:16:25 +01:00
|
|
|
Vector<NonnullOwnPtr<Node>> children;
|
2022-03-26 21:32:57 +04:30
|
|
|
};
|
|
|
|
|
|
|
|
bool operator==(Node const&) const;
|
|
|
|
|
|
|
|
Variant<Text, Comment, Element> content;
|
|
|
|
Node* parent { nullptr };
|
|
|
|
};
|
|
|
|
}
|