@@ -62,23 +62,24 @@ enum class XmlEntityType
62
62
/* *
63
63
* Represents an XML document in the DOM model.
64
64
*/
65
- class LIBXMLPP_API Document : public NonCopyable
65
+ class Document : public NonCopyable
66
66
{
67
67
// Ensure that libxml is properly initialised:
68
- class Init
68
+ class LIBXMLPP_API Init
69
69
{
70
70
public:
71
71
Init ();
72
72
~Init () noexcept ;
73
73
};
74
74
75
- friend class SaxParser ;
75
+ friend LIBXMLPP_API class SaxParser ;
76
76
77
77
public:
78
78
/* * Create a new document.
79
79
* @param version XML version.
80
80
* @throws xmlpp::internal_error If memory allocation fails.
81
81
*/
82
+ LIBXMLPP_API
82
83
explicit Document (const ustring& version = " 1.0" );
83
84
84
85
/* * Create a new C++ wrapper for an xmlDoc struct.
@@ -87,17 +88,19 @@ class LIBXMLPP_API Document : public NonCopyable
87
88
* @param doc A pointer to an xmlDoc struct. Must not be <tt>nullptr</tt>.
88
89
* @throws xmlpp::internal_error If @a doc is <tt>nullptr</tt>.
89
90
*/
90
- explicit Document (_xmlDoc* doc);
91
+ LIBXMLPP_API explicit Document (_xmlDoc* doc);
91
92
92
- ~Document () override ;
93
+ LIBXMLPP_API ~Document () override ;
93
94
94
95
/* * @return The encoding used in the source from which the document has been loaded.
95
96
*/
97
+ LIBXMLPP_API
96
98
ustring get_encoding () const ;
97
99
98
100
/* * Get the internal subset of this document.
99
101
* @returns A pointer to the DTD, or <tt>nullptr</tt> if not found.
100
102
*/
103
+ LIBXMLPP_API
101
104
Dtd* get_internal_subset () const ;
102
105
103
106
/* * Create the internal subset of this document.
@@ -106,6 +109,7 @@ class LIBXMLPP_API Document : public NonCopyable
106
109
* @param external_id The external (PUBLIC) ID, or an empty string.
107
110
* @param system_id The system ID, or an empty string.
108
111
*/
112
+ LIBXMLPP_API
109
113
void set_internal_subset (const ustring& name,
110
114
const ustring& external_id,
111
115
const ustring& system_id);
@@ -114,12 +118,14 @@ class LIBXMLPP_API Document : public NonCopyable
114
118
* This function does @b not create a default root node if it doesn't exist.
115
119
* @return A pointer to the root node if it exists, <tt>nullptr</tt> otherwise.
116
120
*/
121
+ LIBXMLPP_API
117
122
Element* get_root_node ();
118
123
119
124
/* * Return the root node.
120
125
* This function does @b not create a default root node if it doesn't exist.
121
126
* @return A pointer to the root node if it exists, <tt>nullptr</tt> otherwise.
122
127
*/
128
+ LIBXMLPP_API
123
129
const Element* get_root_node () const ;
124
130
125
131
/* * Create the root element node.
@@ -134,6 +140,7 @@ class LIBXMLPP_API Document : public NonCopyable
134
140
* @throws xmlpp::internal_error If memory allocation fails.
135
141
* @throws xmlpp::exception If a new namespace node cannot be created.
136
142
*/
143
+ LIBXMLPP_API
137
144
Element* create_root_node (const ustring& name,
138
145
const ustring& ns_uri = ustring(),
139
146
const ustring& ns_prefix = ustring() );
@@ -148,6 +155,7 @@ class LIBXMLPP_API Document : public NonCopyable
148
155
* @return A pointer to the new root node
149
156
* @throws xmlpp::exception If the node can't be copied.
150
157
*/
158
+ LIBXMLPP_API
151
159
Element* create_root_node_by_import (const Node* node,
152
160
bool recursive = true );
153
161
@@ -156,6 +164,7 @@ class LIBXMLPP_API Document : public NonCopyable
156
164
* @returns The new comment node.
157
165
* @throws xmlpp::internal_error
158
166
*/
167
+ LIBXMLPP_API
159
168
CommentNode* add_comment (const ustring& content);
160
169
161
170
/* * Append a new processing instruction node.
@@ -167,6 +176,7 @@ class LIBXMLPP_API Document : public NonCopyable
167
176
* @returns The new processing instruction node.
168
177
* @throws xmlpp::internal_error
169
178
*/
179
+ LIBXMLPP_API
170
180
ProcessingInstructionNode* add_processing_instruction (
171
181
const ustring& name, const ustring& content);
172
182
@@ -175,6 +185,7 @@ class LIBXMLPP_API Document : public NonCopyable
175
185
* @param encoding If not provided, UTF-8 is used
176
186
* @throws xmlpp::exception
177
187
*/
188
+ LIBXMLPP_API
178
189
void write_to_file (const std::string& filename, const ustring& encoding = ustring());
179
190
180
191
/* * Write the document to a file.
@@ -184,13 +195,15 @@ class LIBXMLPP_API Document : public NonCopyable
184
195
* @param encoding If not provided, UTF-8 is used
185
196
* @throws xmlpp::exception
186
197
*/
198
+ LIBXMLPP_API
187
199
void write_to_file_formatted (const std::string& filename, const ustring& encoding = ustring());
188
200
189
201
/* * Write the document to the memory.
190
202
* @param encoding If not provided, UTF-8 is used
191
203
* @returns The written document.
192
204
* @throws xmlpp::exception
193
205
*/
206
+ LIBXMLPP_API
194
207
ustring write_to_string (const ustring& encoding = ustring());
195
208
196
209
/* * Write the document to the memory.
@@ -200,6 +213,7 @@ class LIBXMLPP_API Document : public NonCopyable
200
213
* @returns The written document.
201
214
* @throws xmlpp::exception
202
215
*/
216
+ LIBXMLPP_API
203
217
ustring write_to_string_formatted (const ustring& encoding = ustring());
204
218
205
219
/* * Write the document to a std::ostream.
@@ -210,6 +224,7 @@ class LIBXMLPP_API Document : public NonCopyable
210
224
* @warning This method is much less efficient than write_to_string if you want to dump the
211
225
* document to a buffer or the standard output. Writing to a fstream is almost as fast as write_to_file
212
226
*/
227
+ LIBXMLPP_API
213
228
void write_to_stream (std::ostream& output, const ustring& encoding = ustring());
214
229
215
230
/* * Write the document to a std::ostream.
@@ -221,6 +236,7 @@ class LIBXMLPP_API Document : public NonCopyable
221
236
* @throws xmlpp::internal_error
222
237
* @warning See write_to_stream
223
238
*/
239
+ LIBXMLPP_API
224
240
void write_to_stream_formatted (std::ostream & output, const ustring& encoding = ustring());
225
241
226
242
/* * Add an Entity declaration to the document.
@@ -232,8 +248,11 @@ class LIBXMLPP_API Document : public NonCopyable
232
248
* is the replacement value.
233
249
* @throws xmlpp::internal_error
234
250
*/
235
- virtual void set_entity_declaration (const ustring& name, XmlEntityType type,
236
- const ustring& publicId, const ustring& systemId,
251
+ LIBXMLPP_API
252
+ virtual void set_entity_declaration (const ustring& name,
253
+ XmlEntityType type,
254
+ const ustring& publicId,
255
+ const ustring& systemId,
237
256
const ustring& content);
238
257
239
258
/* * Perform XInclude substitution on the XML document.
@@ -255,25 +274,30 @@ class LIBXMLPP_API Document : public NonCopyable
255
274
* @returns The number of substitutions.
256
275
* @throws xmlpp::exception
257
276
*/
277
+ LIBXMLPP_API
258
278
int process_xinclude (bool generate_xinclude_nodes = true , bool fixup_base_uris = true );
259
279
260
280
// /Access the underlying libxml implementation.
261
- _xmlDoc* cobj () noexcept ;
281
+ LIBXMLPP_API _xmlDoc* cobj () noexcept ;
262
282
263
283
// /Access the underlying libxml implementation.
264
- const _xmlDoc* cobj () const noexcept ;
284
+ LIBXMLPP_API const _xmlDoc* cobj () const noexcept ;
265
285
266
286
protected:
267
287
/* * Retrieve an Entity.
268
288
* The entity can be from an external subset or internally declared.
269
289
* @param name The name of the entity to get.
270
290
* @returns A pointer to the libxml2 entity structure, or <tt>nullptr</tt> if not found.
271
291
*/
292
+ LIBXMLPP_API
272
293
_xmlEntity* get_entity (const ustring& name);
273
294
274
295
private:
296
+ LIBXMLPP_API
275
297
void do_write_to_file (const std::string& filename, const ustring& encoding, bool format);
298
+ LIBXMLPP_API
276
299
ustring do_write_to_string (const ustring& encoding, bool format);
300
+ LIBXMLPP_API
277
301
void do_write_to_stream (std::ostream& output, const ustring& encoding, bool format);
278
302
279
303
static Init init_;
0 commit comments