|
libmobi
C library for handling MOBI format ebook documents
|
Implements a simplified subset of libxml2 functions used in libmobi. More...
#include <stdlib.h>#include <string.h>#include "xmlwriter.h"#include "debug.h"#include "util.h"#include "parse_rawml.h"Macros | |
| #define | _GNU_SOURCE 1 |
| #define | __USE_BSD /* for strdup on linux/glibc */ |
| #define | MOBI_XML_BUFFERSIZE 4096 |
| #define | MOBI_XML_STATESSIZE 200 |
| #define | XML_ERROR -1 |
| #define | XML_OK 0 |
Functions | |
| xmlBufferPtr | xmlBufferCreate (void) |
| Create xml buffer. More... | |
| void | xmlBufferFree (xmlBufferPtr buf) |
| Free XML buffer. More... | |
| xmlTextWriterPtr | xmlNewTextWriterMemory (xmlBufferPtr xmlbuf, int compression) |
| Initialize TextWriter structure. More... | |
| void | xmlFreeTextWriter (xmlTextWriterPtr writer) |
| Deallocate TextWriter instance and all its resources. More... | |
| int | xmlTextWriterStartDocument (xmlTextWriterPtr writer, const char *version, const char *encoding, const char *standalone) |
| Start xml document. More... | |
| int | xmlTextWriterEndDocument (xmlTextWriterPtr writer) |
| End xml document. More... | |
| int | xmlTextWriterStartElement (xmlTextWriterPtr writer, const xmlChar *name) |
| Start xml element. More... | |
| int | xmlTextWriterEndElement (xmlTextWriterPtr writer) |
| End current element. More... | |
| int | xmlTextWriterStartAttribute (xmlTextWriterPtr writer, const xmlChar *name) |
| Start attribute for current xml element. More... | |
| int | xmlTextWriterEndAttribute (xmlTextWriterPtr writer) |
| End current attribute. More... | |
| int | xmlTextWriterWriteAttribute (xmlTextWriterPtr writer, const xmlChar *name, const xmlChar *content) |
| Write attribute with given name and content. More... | |
| int | xmlTextWriterStartAttributeNS (xmlTextWriterPtr writer, const xmlChar *prefix, const xmlChar *name, const xmlChar *namespaceURI) |
| Start attribute with namespace support for current xml element. More... | |
| int | xmlTextWriterWriteAttributeNS (xmlTextWriterPtr writer, const xmlChar *prefix, const xmlChar *name, const xmlChar *namespaceURI, const xmlChar *content) |
| Write attribute with namespace support. More... | |
| int | xmlTextWriterStartElementNS (xmlTextWriterPtr writer, const xmlChar *prefix, const xmlChar *name, const xmlChar *namespaceURI) |
| Start element with namespace support. More... | |
| int | xmlTextWriterWriteElementNS (xmlTextWriterPtr writer, const xmlChar *prefix, const xmlChar *name, const xmlChar *namespaceURI, const xmlChar *content) |
| Write element with namespace support. More... | |
| int | xmlTextWriterWriteString (xmlTextWriterPtr writer, const xmlChar *content) |
| Write xml string. More... | |
| int | xmlTextWriterSetIndent (xmlTextWriterPtr writer, int indent) |
| Set indentation option. More... | |
Implements a simplified subset of libxml2 functions used in libmobi.
Copyright (c) 2016 Bartek Fabiszewski http://www.fabiszewski.net
This file is part of libmobi. Licensed under LGPL, either version 3, or any later. See http://www.gnu.org/licenses/
| xmlBufferPtr xmlBufferCreate | ( | void | ) |
Create xml buffer.
Libxml2 compatibility wrapper for MOBIBuffer structure. Must be deallocated with xmlBufferFree
| void xmlBufferFree | ( | xmlBufferPtr | buf | ) |
Free XML buffer.
| [in,out] | buf | XML buffer |
| void xmlFreeTextWriter | ( | xmlTextWriterPtr | writer | ) |
Deallocate TextWriter instance and all its resources.
| [in,out] | writer | TextWriter |
| xmlTextWriterPtr xmlNewTextWriterMemory | ( | xmlBufferPtr | xmlbuf, |
| int | compression | ||
| ) |
Initialize TextWriter structure.
| [in] | xmlbuf | Initialized xml output buffer |
| [in] | compression | Unused |
| int xmlTextWriterEndAttribute | ( | xmlTextWriterPtr | writer | ) |
End current attribute.
| [in,out] | writer | TextWriter |
| int xmlTextWriterEndDocument | ( | xmlTextWriterPtr | writer | ) |
End xml document.
All open elements will be closed. xmlBuffer will be flushed.
| [in] | writer | TextWriter |
| int xmlTextWriterEndElement | ( | xmlTextWriterPtr | writer | ) |
End current element.
| [in] | writer | TextWriter |
| int xmlTextWriterSetIndent | ( | xmlTextWriterPtr | writer, |
| int | indent | ||
| ) |
Set indentation option.
| [in,out] | writer | TextWriter |
| [in] | indent | Indent output if value greater than zero |
| int xmlTextWriterStartAttribute | ( | xmlTextWriterPtr | writer, |
| const xmlChar * | name | ||
| ) |
Start attribute for current xml element.
| [in,out] | writer | TextWriter |
| [in] | name | Attribute name |
| int xmlTextWriterStartAttributeNS | ( | xmlTextWriterPtr | writer, |
| const xmlChar * | prefix, | ||
| const xmlChar * | name, | ||
| const xmlChar * | namespaceURI | ||
| ) |
Start attribute with namespace support for current xml element.
| [in,out] | writer | TextWriter |
| [in] | prefix | Namespace prefix or NULL |
| [in] | name | Attribute name |
| [in] | namespaceURI | Namespace uri or NULL |
| int xmlTextWriterStartDocument | ( | xmlTextWriterPtr | writer, |
| const char * | version, | ||
| const char * | encoding, | ||
| const char * | standalone | ||
| ) |
Start xml document.
Only utf-8 encoding supported.
| [in] | writer | TextWriter |
| [in] | version | Value of version attribute, "1.0" if NULL |
| [in] | encoding | Unused, defaults to utf-8 |
| [in] | standalone | Unused, omitted in declaration |
| int xmlTextWriterStartElement | ( | xmlTextWriterPtr | writer, |
| const xmlChar * | name | ||
| ) |
Start xml element.
| [in,out] | writer | TextWriter |
| [in] | name | Element name |
| int xmlTextWriterStartElementNS | ( | xmlTextWriterPtr | writer, |
| const xmlChar * | prefix, | ||
| const xmlChar * | name, | ||
| const xmlChar * | namespaceURI | ||
| ) |
Start element with namespace support.
| [in,out] | writer | TextWriter |
| [in] | prefix | Namespace prefix or NULL |
| [in] | name | Element name |
| [in] | namespaceURI | Namespace uri or NULL |
| int xmlTextWriterWriteAttribute | ( | xmlTextWriterPtr | writer, |
| const xmlChar * | name, | ||
| const xmlChar * | content | ||
| ) |
Write attribute with given name and content.
| [in,out] | writer | TextWriter |
| [in] | name | Attribute name |
| [in] | content | Attribute content |
| int xmlTextWriterWriteAttributeNS | ( | xmlTextWriterPtr | writer, |
| const xmlChar * | prefix, | ||
| const xmlChar * | name, | ||
| const xmlChar * | namespaceURI, | ||
| const xmlChar * | content | ||
| ) |
Write attribute with namespace support.
| [in,out] | writer | TextWriter |
| [in] | prefix | Namespace prefix or NULL |
| [in] | name | Attribute name |
| [in] | namespaceURI | Namespace uri or NULL |
| [in] | content | Attribute content |
| int xmlTextWriterWriteElementNS | ( | xmlTextWriterPtr | writer, |
| const xmlChar * | prefix, | ||
| const xmlChar * | name, | ||
| const xmlChar * | namespaceURI, | ||
| const xmlChar * | content | ||
| ) |
Write element with namespace support.
| [in,out] | writer | TextWriter |
| [in] | prefix | Namespace prefix or NULL |
| [in] | name | Element name |
| [in] | namespaceURI | Namespace uri or NULL |
| [in] | content | Element content |
| int xmlTextWriterWriteString | ( | xmlTextWriterPtr | writer, |
| const xmlChar * | content | ||
| ) |
Write xml string.
| [in,out] | writer | TextWriter |
| [in] | content | Attribute content |