1 /* libxml2 - Library for parsing XML documents
2  * Copyright (C) 2006-2019 Free Software Foundation, Inc.
3  *
4  * This file is not part of the GNU gettext program, but is used with
5  * GNU gettext.
6  *
7  * The original copyright notice is as follows:
8  */
9 
10 /*
11  * Copyright (C) 1998-2012 Daniel Veillard.  All Rights Reserved.
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a copy
14  * of this software and associated documentation files (the "Software"), to deal
15  * in the Software without restriction, including without limitation the rights
16  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17  * copies of the Software, and to permit persons to whom the Software is fur-
18  * nished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included in
21  * all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
25  * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
26  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29  * THE SOFTWARE.
30  *
31  * Author: Daniel Veillard
32  */
33 
34 /*
35  * Summary: the XML document serializer
36  * Description: API to save document or subtree of document
37  */
38 
39 #ifndef __XML_XMLSAVE_H__
40 #define __XML_XMLSAVE_H__
41 
42 #include <libxml/xmlversion.h>
43 #include <libxml/tree.h>
44 #include <libxml/encoding.h>
45 #include <libxml/xmlIO.h>
46 
47 #ifdef LIBXML_OUTPUT_ENABLED
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 /**
53  * xmlSaveOption:
54  *
55  * This is the set of XML save options that can be passed down
56  * to the xmlSaveToFd() and similar calls.
57  */
58 typedef enum {
59     XML_SAVE_FORMAT     = 1<<0,	/* format save output */
60     XML_SAVE_NO_DECL    = 1<<1,	/* drop the xml declaration */
61     XML_SAVE_NO_EMPTY	= 1<<2, /* no empty tags */
62     XML_SAVE_NO_XHTML	= 1<<3, /* disable XHTML1 specific rules */
63     XML_SAVE_XHTML	= 1<<4, /* force XHTML1 specific rules */
64     XML_SAVE_AS_XML     = 1<<5, /* force XML serialization on HTML doc */
65     XML_SAVE_AS_HTML    = 1<<6, /* force HTML serialization on XML doc */
66     XML_SAVE_WSNONSIG   = 1<<7  /* format with non-significant whitespace */
67 } xmlSaveOption;
68 
69 
70 typedef struct _xmlSaveCtxt xmlSaveCtxt;
71 typedef xmlSaveCtxt *xmlSaveCtxtPtr;
72 
73 XMLPUBFUN xmlSaveCtxtPtr XMLCALL
74 		xmlSaveToFd		(int fd,
75 					 const char *encoding,
76 					 int options);
77 XMLPUBFUN xmlSaveCtxtPtr XMLCALL
78 		xmlSaveToFilename	(const char *filename,
79 					 const char *encoding,
80 					 int options);
81 
82 XMLPUBFUN xmlSaveCtxtPtr XMLCALL
83 		xmlSaveToBuffer		(xmlBufferPtr buffer,
84 					 const char *encoding,
85 					 int options);
86 
87 XMLPUBFUN xmlSaveCtxtPtr XMLCALL
88 		xmlSaveToIO		(xmlOutputWriteCallback iowrite,
89 					 xmlOutputCloseCallback ioclose,
90 					 void *ioctx,
91 					 const char *encoding,
92 					 int options);
93 
94 XMLPUBFUN long XMLCALL
95 		xmlSaveDoc		(xmlSaveCtxtPtr ctxt,
96 					 xmlDocPtr doc);
97 XMLPUBFUN long XMLCALL
98 		xmlSaveTree		(xmlSaveCtxtPtr ctxt,
99 					 xmlNodePtr node);
100 
101 XMLPUBFUN int XMLCALL
102 		xmlSaveFlush		(xmlSaveCtxtPtr ctxt);
103 XMLPUBFUN int XMLCALL
104 		xmlSaveClose		(xmlSaveCtxtPtr ctxt);
105 XMLPUBFUN int XMLCALL
106 		xmlSaveSetEscape	(xmlSaveCtxtPtr ctxt,
107 					 xmlCharEncodingOutputFunc escape);
108 XMLPUBFUN int XMLCALL
109 		xmlSaveSetAttrEscape	(xmlSaveCtxtPtr ctxt,
110 					 xmlCharEncodingOutputFunc escape);
111 #ifdef __cplusplus
112 }
113 #endif
114 #endif /* LIBXML_OUTPUT_ENABLED */
115 #endif /* __XML_XMLSAVE_H__ */
116 
117 
118