29#include <sptk5/xdoc/Node.h>
36 explicit Document(Node::Type rootType = Node::Type::Object)
37 : m_root(std::make_shared<Node>(
"", rootType))
46 [[nodiscard]] SNode& root()
51 [[nodiscard]]
const SNode& root()
const
56 void load(
const Buffer& data,
bool xmlKeepFormatting =
false)
const;
58 void load(
const String& data,
bool xmlKeepFormatting =
false)
const;
60 void exportTo(DataFormat dataFormat,
Buffer& data,
bool formatted =
false)
const
62 m_root->exportTo(dataFormat, data, formatted);
65 void exportTo(DataFormat dataFormat, std::ostream& data,
bool formatted =
false)
const
67 m_root->exportTo(dataFormat, data, formatted);
70 [[maybe_unused]] [[nodiscard]] SNode& findOrCreate(
const String& name)
72 return m_root->findOrCreate(name);
75 [[nodiscard]] SNode findFirst(
const String& name, SearchMode searchMode = SearchMode::Recursive)
const
77 return m_root->findFirst(name, searchMode);
80 [[nodiscard]] Node::Vector select(
const String& xpath)
const
82 return m_root->select(xpath);
89using SDocument = std::shared_ptr<Document>;
Definition: Document.h:34