Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IXmlDocumentHolder.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* IXmlDocumentHolder.h (C) 2000-2018 */
9/* */
10/* Interface of a DOM document manager. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_IXMLDOCUMENTHOLDER_H
13#define ARCANE_IXMLDOCUMENTHOLDER_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28class XmlNode;
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
33/*!
34 * \ingroup Xml
35 * \brief Manager of a DOM document.
36 *
37 * This class encapsulates the document node of a DOM tree.
38 * The destructor of this class releases the DOM tree.
39 * The user must be careful not to use
40 * a node from this tree after its release.
41 */
42class ARCANE_CORE_EXPORT IXmlDocumentHolder
43{
44 public:
45
46 //! Releases resources
48
49 public:
50
51 //! Creates and returns a null document.
52 static IXmlDocumentHolder* createNull();
53
54 /*!
55 * \brief Loads an XML document.
56 *
57 * Reads and parses the XML document named \a name whose data is in \a buffer.
58 *
59 * The returned instance is never null.
60 * The caller owns the returned instance and must
61 * destroy it using the delete operator.
62 */
63 static IXmlDocumentHolder*
64 loadFromBuffer(Span<const Byte> buffer, const String& name, ITraceMng* tm);
65
66 /*!
67 * \brief Loads an XML document.
68 *
69 * Reads and parses the XML document named \a name whose data is in \a buffer.
70 *
71 * The returned instance is never null.
72 * The caller owns the returned instance and must
73 * destroy it using the delete operator.
74 */
75 static IXmlDocumentHolder*
76 loadFromBuffer(ByteConstSpan buffer, const String& name, ITraceMng* tm);
77
78 /*!
79 * \brief Loads an XML document.
80 *
81 * Reads and parses the XML document contained in the file \a filename.
82 *
83 * The returned instance is never null.
84 * The caller owns the returned instance and must
85 * destroy it using the delete operator.
86 */
87 static IXmlDocumentHolder*
88 loadFromFile(const String& filename, ITraceMng* tm);
89
90 /*!
91 * \brief Loads an XML document.
92 *
93 * Reads and parses the XML document contained in the file \a filename.
94 *
95 * The returned instance is never null.
96 * The caller owns the returned instance and must
97 * destroy it using the delete operator.
98 *
99 * If \a schema_filename is not null, it indicates the XML file containing the schema
100 * used to validate the XML file.
101 */
102 static IXmlDocumentHolder*
103 loadFromFile(const String& filename, const String& schema_filename, ITraceMng* tm);
104
105 public:
106
107 //! Document node. \c This node is null if the document does not exist.
108 virtual XmlNode documentNode() = 0;
109
110 //! Clones this document
111 virtual IXmlDocumentHolder* clone() = 0;
112
113 //! Saves this document into the array \a bytes.
114 virtual void save(ByteArray& bytes) = 0;
115
116 //! Saves this document and returns the string.
117 virtual String save() = 0;
118};
119
120/*---------------------------------------------------------------------------*/
121/*---------------------------------------------------------------------------*/
122
123} // End namespace Arcane
124
125/*---------------------------------------------------------------------------*/
126/*---------------------------------------------------------------------------*/
127
128#endif
Declarations of types used in Arcane.
Manager of a DOM document.
virtual void save(ByteArray &bytes)=0
Saves this document into the array bytes.
virtual XmlNode documentNode()=0
Document node. This node is null if the document does not exist.
virtual String save()=0
Saves this document and returns the string.
virtual ~IXmlDocumentHolder()
Releases resources.
virtual IXmlDocumentHolder * clone()=0
Clones this document.
View of an array of elements of type T.
Definition Span.h:635
Node of a DOM tree.
Definition XmlNode.h:51
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Array< Byte > ByteArray
Dynamic one-dimensional array of characters.
Definition UtilsTypes.h:121
Span< const std::byte > ByteConstSpan
Read-only view of a 1D array of characters.
Definition UtilsTypes.h:548