[xml] Need mechanism to turn on 'format' field
- From: Phil Shafer <phil juniper net>
- To: xml gnome org
- Subject: [xml] Need mechanism to turn on 'format' field
- Date: Mon, 29 Nov 2004 17:58:58 -0500
Hi,
I'm calling xmlSaveToFd() and didn't see a way to turn on the
'format' field of the xmlSaveContext. So I added an enum to
xmlParserOption. This patch allows me to turn on the flag when I
create the context:
handle = xmlSaveToFd(fd, NULL, XML_SAVE_FORMAT);
In my local tree, I've isolated these under a NO_LOCAL_MODS ifdef,
which you won't need.
Please let me know if I missed something in libxml2 that already
does this.
Thanks,
Phil
Index: contrib/libxml2/xmlsave.c
===================================================================
RCS file: contrib/libxml2/xmlsave.c,v
retrieving revision 1.3
diff -u -p -r1.3 xmlsave.c
--- contrib/libxml2/xmlsave.c 4 Nov 2004 22:03:10 -0000 1.3
+++ contrib/libxml2/xmlsave.c 29 Nov 2004 22:39:40 -0000
@@ -378,6 +378,13 @@ xmlNewSaveCtxt(const char *encoding, int
}
memset(ret, 0, sizeof(xmlSaveCtxt));
ret->options = options;
+#ifndef NO_LOCAL_MODS
+ /*
+ * Local mod: Add mechanism for turning on the format flag
+ */
+ if (options & XML_SAVE_FORMAT)
+ ret->format = 1;
+#endif
if (encoding != NULL) {
ret->handler = xmlFindCharEncodingHandler(encoding);
if (ret->handler == NULL) {
Index: contrib/libxml2/include/libxml/parser.h
===================================================================
RCS file: contrib/libxml2/include/libxml/parser.h,v
retrieving revision 1.3
diff -u -p -r1.3 parser.h
--- contrib/libxml2/include/libxml/parser.h 4 Nov 2004 22:03:27 -0000 1.3
+++ contrib/libxml2/include/libxml/parser.h 29 Nov 2004 22:39:41 -0000
@@ -1072,7 +1072,10 @@ typedef enum {
XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionnary */
XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */
XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */
- XML_PARSE_NOXINCNODE= 1<<15 /* do not generate XINCLUDE START/END nodes */
+ XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */
+#ifndef NO_LOCAL_MODS
+ XML_SAVE_FORMAT = 1<<16,/* format save output */
+#endif
} xmlParserOption;
XMLPUBFUN void XMLCALL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]