aboutsummaryrefslogtreecommitdiffstats
path: root/xmlIO.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@redhat.com>2012-08-06 11:16:30 +0800
committerDaniel Veillard <veillard@redhat.com>2012-08-06 11:16:30 +0800
commite258adecd0e19a6cfe6afa232b89aa416368820e (patch)
tree034a219a3ce5cc77645d0fd3ffdb4ed70741da8c /xmlIO.c
parent187e52901b01bb6ced0a7b57de393ec256973e39 (diff)
downloadandroid_external_libxml2-e258adecd0e19a6cfe6afa232b89aa416368820e.tar.gz
android_external_libxml2-e258adecd0e19a6cfe6afa232b89aa416368820e.tar.bz2
android_external_libxml2-e258adecd0e19a6cfe6afa232b89aa416368820e.zip
Provide new accessors for xmlOutputBuffer
To avoid digging into buf->buffer insternal strcuture the two new entry points xmlOutputBufferGetContent() and xmlOutputBufferGetSize() should make the ode cleaner. * include/libxml/xmlIO.h: add two new functions * xmlIO.c: impement the 2 functions based on the new buffer entry points
Diffstat (limited to 'xmlIO.c')
-rw-r--r--xmlIO.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/xmlIO.c b/xmlIO.c
index 20ec1810..53bd8bfe 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -2922,6 +2922,39 @@ xmlOutputBufferCreateBuffer(xmlBufferPtr buffer,
return(ret);
}
+/**
+ * xmlOutputBufferGetContent:
+ * @out: an xmlOutputBufferPtr
+ *
+ * Gives a pointer to the data currently held in the output buffer
+ *
+ * Returns a pointer to the data or NULL in case of error
+ */
+const xmlChar *
+xmlOutputBufferGetContent(xmlOutputBufferPtr out) {
+ if ((out == NULL) || (out->buffer == NULL))
+ return(NULL);
+
+ return(xmlBufContent(out->buffer));
+}
+
+/**
+ * xmlOutputBufferGetSize:
+ * @out: an xmlOutputBufferPtr
+ *
+ * Gives the length of the data currently held in the output buffer
+ *
+ * Returns 0 in case or error or no data is held, the size otherwise
+ */
+size_t
+xmlOutputBufferGetSize(xmlOutputBufferPtr out) {
+ if ((out == NULL) || (out->buffer == NULL))
+ return(0);
+
+ return(xmlBufUse(out->buffer));
+}
+
+
#endif /* LIBXML_OUTPUT_ENABLED */
/**