[libxml2] Allow to set the quoting character of an xmlWriter



commit 429d3a0aae2eda7ba9451f9c9f8523c61cc0368b
Author: Csaba Raduly <rcsaba gmail com>
Date:   Tue Sep 11 11:50:25 2012 +0800

    Allow to set the quoting character of an xmlWriter
    
    It's otherwise impossible to set the quoting character of
    attribute values of an xmlWriter.

 include/libxml/xmlwriter.h |    4 ++++
 xmlwriter.c                |   20 ++++++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/include/libxml/xmlwriter.h b/include/libxml/xmlwriter.h
index 91e683c..9cb75f6 100644
--- a/include/libxml/xmlwriter.h
+++ b/include/libxml/xmlwriter.h
@@ -471,6 +471,10 @@ extern "C" {
         xmlTextWriterSetIndentString(xmlTextWriterPtr writer,
                                      const xmlChar * str);
 
+    XMLPUBFUN int XMLCALL
+        xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar);
+
+
 /*
  * misc
  */
diff --git a/python/setup.py b/python/setup.py
old mode 100755
new mode 100644
diff --git a/xmlwriter.c b/xmlwriter.c
index b3e85fa..4acd2fd 100644
--- a/xmlwriter.c
+++ b/xmlwriter.c
@@ -4610,6 +4610,26 @@ xmlTextWriterSetIndentString(xmlTextWriterPtr writer, const xmlChar * str)
 }
 
 /**
+ * xmlTextWriterSetQuoteChar:
+ * @writer:  the xmlTextWriterPtr
+ * @quotechar:  the quote character
+ *
+ * Set the character used for quoting attributes.
+ *
+ * Returns -1 on error or 0 otherwise.
+ */
+int
+xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar)
+{
+    if ((writer == NULL) || ((quotechar != '\'') && (quotechar != '"')))
+        return -1;
+
+    writer->qchar = quotechar;
+
+    return 0;
+}
+
+/**
  * xmlTextWriterWriteIndent:
  * @writer:  the xmlTextWriterPtr
  *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]