mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
- HTMLtree.[ch]: started augmenting the HTML save API with
encoding and formatting parameters Daniel
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
Thu Jun 14 09:49:09 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
|
* HTMLtree.[ch]: started augmenting the HTML save API with
|
||||||
|
encoding and formatting parameters
|
||||||
|
|
||||||
Wed Jun 13 09:44:15 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
Wed Jun 13 09:44:15 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
* HTMLtree.h: cleanup and started evaluating the work needed on
|
* HTMLtree.h: cleanup and started evaluating the work needed on
|
||||||
|
169
HTMLtree.c
169
HTMLtree.c
@ -295,7 +295,7 @@ found_meta:
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
htmlDocContentDump(xmlBufferPtr buf, xmlDocPtr cur);
|
htmlDocContentDump(xmlBufferPtr buf, xmlDocPtr cur, int format);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* htmlDtdDump:
|
* htmlDtdDump:
|
||||||
@ -375,21 +375,28 @@ htmlAttrDump(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur) {
|
|||||||
* Dump a list of HTML attributes
|
* Dump a list of HTML attributes
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
htmlAttrListDump(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur) {
|
htmlAttrListDump(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur, int format) {
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
if (cur == NULL) {
|
if (cur == NULL) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"htmlAttrListDump : property == NULL\n");
|
"htmlAttrListDump : property == NULL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
|
i++;
|
||||||
|
if ((format) && (i >= 5)) {
|
||||||
|
i = 0;
|
||||||
|
xmlBufferWriteChar(buf, "\n");
|
||||||
|
}
|
||||||
htmlAttrDump(buf, doc, cur);
|
htmlAttrDump(buf, doc, cur);
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
htmlNodeDumpFormat(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int format);
|
||||||
|
|
||||||
void
|
|
||||||
htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur);
|
|
||||||
/**
|
/**
|
||||||
* htmlNodeListDump:
|
* htmlNodeListDump:
|
||||||
* @buf: the HTML buffer output
|
* @buf: the HTML buffer output
|
||||||
@ -399,28 +406,30 @@ htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur);
|
|||||||
* Dump an HTML node list, recursive behaviour,children are printed too.
|
* Dump an HTML node list, recursive behaviour,children are printed too.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
htmlNodeListDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur) {
|
htmlNodeListDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int format) {
|
||||||
if (cur == NULL) {
|
if (cur == NULL) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"htmlNodeListDump : node == NULL\n");
|
"htmlNodeListDump : node == NULL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
htmlNodeDump(buf, doc, cur);
|
htmlNodeDumpFormat(buf, doc, cur, format);
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* htmlNodeDump:
|
* htmlNodeDumpFormat:
|
||||||
* @buf: the HTML buffer output
|
* @buf: the HTML buffer output
|
||||||
* @doc: the document
|
* @doc: the document
|
||||||
* @cur: the current node
|
* @cur: the current node
|
||||||
|
* @format: should formatting spaces been added
|
||||||
*
|
*
|
||||||
* Dump an HTML node, recursive behaviour,children are printed too.
|
* Dump an HTML node, recursive behaviour,children are printed too.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur) {
|
htmlNodeDumpFormat(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
|
||||||
|
int format) {
|
||||||
htmlElemDescPtr info;
|
htmlElemDescPtr info;
|
||||||
|
|
||||||
if (cur == NULL) {
|
if (cur == NULL) {
|
||||||
@ -434,7 +443,7 @@ htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur) {
|
|||||||
if (cur->type == XML_DTD_NODE)
|
if (cur->type == XML_DTD_NODE)
|
||||||
return;
|
return;
|
||||||
if (cur->type == XML_HTML_DOCUMENT_NODE) {
|
if (cur->type == XML_HTML_DOCUMENT_NODE) {
|
||||||
htmlDocContentDump(buf, (xmlDocPtr) cur);
|
htmlDocContentDump(buf, (xmlDocPtr) cur, format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (cur->type == HTML_TEXT_NODE) {
|
if (cur->type == HTML_TEXT_NODE) {
|
||||||
@ -514,7 +523,7 @@ htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur) {
|
|||||||
xmlBufferWriteChar(buf, "<");
|
xmlBufferWriteChar(buf, "<");
|
||||||
xmlBufferWriteCHAR(buf, cur->name);
|
xmlBufferWriteCHAR(buf, cur->name);
|
||||||
if (cur->properties != NULL)
|
if (cur->properties != NULL)
|
||||||
htmlAttrListDump(buf, doc, cur->properties);
|
htmlAttrListDump(buf, doc, cur->properties, format);
|
||||||
|
|
||||||
if ((info != NULL) && (info->empty)) {
|
if ((info != NULL) && (info->empty)) {
|
||||||
xmlBufferWriteChar(buf, ">");
|
xmlBufferWriteChar(buf, ">");
|
||||||
@ -562,7 +571,7 @@ htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur) {
|
|||||||
(cur->children->type != HTML_ENTITY_REF_NODE) &&
|
(cur->children->type != HTML_ENTITY_REF_NODE) &&
|
||||||
(cur->children != cur->last))
|
(cur->children != cur->last))
|
||||||
xmlBufferWriteChar(buf, "\n");
|
xmlBufferWriteChar(buf, "\n");
|
||||||
htmlNodeListDump(buf, doc, cur->children);
|
htmlNodeListDump(buf, doc, cur->children, format);
|
||||||
if ((cur->last->type != HTML_TEXT_NODE) &&
|
if ((cur->last->type != HTML_TEXT_NODE) &&
|
||||||
(cur->last->type != HTML_ENTITY_REF_NODE) &&
|
(cur->last->type != HTML_ENTITY_REF_NODE) &&
|
||||||
(cur->children != cur->last))
|
(cur->children != cur->last))
|
||||||
@ -578,23 +587,56 @@ htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* htmlNodeDump:
|
||||||
|
* @buf: the HTML buffer output
|
||||||
|
* @doc: the document
|
||||||
|
* @cur: the current node
|
||||||
|
*
|
||||||
|
* Dump an HTML node, recursive behaviour,children are printed too,
|
||||||
|
* and formatting returns are added.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur) {
|
||||||
|
htmlNodeDumpFormat(buf, doc, cur, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* htmlNodeDumpFileFormat:
|
||||||
|
* @out: the FILE pointer
|
||||||
|
* @doc: the document
|
||||||
|
* @cur: the current node
|
||||||
|
* @encoding: the document encoding
|
||||||
|
* @format: should formatting spaces been added
|
||||||
|
*
|
||||||
|
* Dump an HTML node, recursive behaviour,children are printed too.
|
||||||
|
*
|
||||||
|
* TODO: handle the encoding not used yet
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
htmlNodeDumpFileFormat(FILE *out, xmlDocPtr doc, xmlNodePtr cur,
|
||||||
|
const char *encoding ATTRIBUTE_UNUSED, int format) {
|
||||||
|
xmlBufferPtr buf;
|
||||||
|
|
||||||
|
buf = xmlBufferCreate();
|
||||||
|
if (buf == NULL) return;
|
||||||
|
htmlNodeDumpFormat(buf, doc, cur, format);
|
||||||
|
xmlBufferDump(out, buf);
|
||||||
|
xmlBufferFree(buf);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* htmlNodeDumpFile:
|
* htmlNodeDumpFile:
|
||||||
* @out: the FILE pointer
|
* @out: the FILE pointer
|
||||||
* @doc: the document
|
* @doc: the document
|
||||||
* @cur: the current node
|
* @cur: the current node
|
||||||
*
|
*
|
||||||
* Dump an HTML node, recursive behaviour,children are printed too.
|
* Dump an HTML node, recursive behaviour,children are printed too,
|
||||||
|
* and formatting returns are added.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
htmlNodeDumpFile(FILE *out, xmlDocPtr doc, xmlNodePtr cur) {
|
htmlNodeDumpFile(FILE *out, xmlDocPtr doc, xmlNodePtr cur) {
|
||||||
xmlBufferPtr buf;
|
htmlNodeDumpFileFormat(out, doc, cur, NULL, 1);
|
||||||
|
|
||||||
buf = xmlBufferCreate();
|
|
||||||
if (buf == NULL) return;
|
|
||||||
htmlNodeDump(buf, doc, cur);
|
|
||||||
xmlBufferDump(out, buf);
|
|
||||||
xmlBufferFree(buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -605,7 +647,7 @@ htmlNodeDumpFile(FILE *out, xmlDocPtr doc, xmlNodePtr cur) {
|
|||||||
* Dump an HTML document.
|
* Dump an HTML document.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
htmlDocContentDump(xmlBufferPtr buf, xmlDocPtr cur) {
|
htmlDocContentDump(xmlBufferPtr buf, xmlDocPtr cur, int format) {
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -621,7 +663,7 @@ htmlDocContentDump(xmlBufferPtr buf, xmlDocPtr cur) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
if (cur->children != NULL) {
|
if (cur->children != NULL) {
|
||||||
htmlNodeListDump(buf, cur, cur->children);
|
htmlNodeListDump(buf, cur, cur->children, format);
|
||||||
}
|
}
|
||||||
xmlBufferWriteChar(buf, "\n");
|
xmlBufferWriteChar(buf, "\n");
|
||||||
cur->type = (xmlElementType) type;
|
cur->type = (xmlElementType) type;
|
||||||
@ -711,6 +753,9 @@ htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) {
|
|||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr cur,
|
||||||
|
const char *encoding, int format);
|
||||||
/**
|
/**
|
||||||
* htmlDtdDumpOutput:
|
* htmlDtdDumpOutput:
|
||||||
* @buf: the HTML buffer output
|
* @buf: the HTML buffer output
|
||||||
@ -812,40 +857,46 @@ htmlAttrListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur, co
|
|||||||
void htmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
void htmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
||||||
xmlNodePtr cur, const char *encoding);
|
xmlNodePtr cur, const char *encoding);
|
||||||
|
|
||||||
|
void htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
||||||
|
xmlNodePtr cur, const char *encoding, int format);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* htmlNodeListDumpOutput:
|
* htmlNodeListDumpOutput:
|
||||||
* @buf: the HTML buffer output
|
* @buf: the HTML buffer output
|
||||||
* @doc: the document
|
* @doc: the document
|
||||||
* @cur: the first node
|
* @cur: the first node
|
||||||
* @encoding: the encoding string
|
* @encoding: the encoding string
|
||||||
|
* @format: should formatting spaces been added
|
||||||
*
|
*
|
||||||
* Dump an HTML node list, recursive behaviour,children are printed too.
|
* Dump an HTML node list, recursive behaviour,children are printed too.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
htmlNodeListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, const char *encoding) {
|
htmlNodeListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
||||||
|
xmlNodePtr cur, const char *encoding, int format) {
|
||||||
if (cur == NULL) {
|
if (cur == NULL) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"htmlNodeListDump : node == NULL\n");
|
"htmlNodeListDump : node == NULL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
htmlNodeDumpOutput(buf, doc, cur, encoding);
|
htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format);
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* htmlNodeDumpOutput:
|
* htmlNodeDumpFormatOutput:
|
||||||
* @buf: the HTML buffer output
|
* @buf: the HTML buffer output
|
||||||
* @doc: the document
|
* @doc: the document
|
||||||
* @cur: the current node
|
* @cur: the current node
|
||||||
* @encoding: the encoding string
|
* @encoding: the encoding string
|
||||||
|
* @format: should formatting spaces been added
|
||||||
*
|
*
|
||||||
* Dump an HTML node, recursive behaviour,children are printed too.
|
* Dump an HTML node, recursive behaviour,children are printed too.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
htmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
||||||
xmlNodePtr cur, const char *encoding) {
|
xmlNodePtr cur, const char *encoding, int format) {
|
||||||
htmlElemDescPtr info;
|
htmlElemDescPtr info;
|
||||||
|
|
||||||
if (cur == NULL) {
|
if (cur == NULL) {
|
||||||
@ -994,7 +1045,7 @@ htmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
|||||||
(cur->children != cur->last) &&
|
(cur->children != cur->last) &&
|
||||||
(!xmlStrEqual(cur->name, BAD_CAST "pre")))
|
(!xmlStrEqual(cur->name, BAD_CAST "pre")))
|
||||||
xmlOutputBufferWriteString(buf, "\n");
|
xmlOutputBufferWriteString(buf, "\n");
|
||||||
htmlNodeListDumpOutput(buf, doc, cur->children, encoding);
|
htmlNodeListDumpOutput(buf, doc, cur->children, encoding, format);
|
||||||
if ((cur->last->type != HTML_TEXT_NODE) &&
|
if ((cur->last->type != HTML_TEXT_NODE) &&
|
||||||
(cur->last->type != HTML_ENTITY_REF_NODE) &&
|
(cur->last->type != HTML_ENTITY_REF_NODE) &&
|
||||||
(cur->children != cur->last) &&
|
(cur->children != cur->last) &&
|
||||||
@ -1014,7 +1065,23 @@ htmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* htmlDocContentDumpOutput:
|
* htmlNodeDumpOutput:
|
||||||
|
* @buf: the HTML buffer output
|
||||||
|
* @doc: the document
|
||||||
|
* @cur: the current node
|
||||||
|
* @encoding: the encoding string
|
||||||
|
*
|
||||||
|
* Dump an HTML node, recursive behaviour,children are printed too,
|
||||||
|
* and formatting returns/spaces are added.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
htmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
||||||
|
xmlNodePtr cur, const char *encoding) {
|
||||||
|
htmlNodeDumpFormatOutput(buf, doc, cur, encoding, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* htmlDocContentDumpFormatOutput:
|
||||||
* @buf: the HTML buffer output
|
* @buf: the HTML buffer output
|
||||||
* @cur: the document
|
* @cur: the document
|
||||||
* @encoding: the encoding string
|
* @encoding: the encoding string
|
||||||
@ -1022,8 +1089,8 @@ htmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
|||||||
* Dump an HTML document.
|
* Dump an HTML document.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
htmlDocContentDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr cur,
|
htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr cur,
|
||||||
const char *encoding) {
|
const char *encoding, int format) {
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1035,12 +1102,26 @@ htmlDocContentDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr cur,
|
|||||||
htmlDtdDumpOutput(buf, cur, NULL);
|
htmlDtdDumpOutput(buf, cur, NULL);
|
||||||
}
|
}
|
||||||
if (cur->children != NULL) {
|
if (cur->children != NULL) {
|
||||||
htmlNodeListDumpOutput(buf, cur, cur->children, encoding);
|
htmlNodeListDumpOutput(buf, cur, cur->children, encoding, format);
|
||||||
}
|
}
|
||||||
xmlOutputBufferWriteString(buf, "\n");
|
xmlOutputBufferWriteString(buf, "\n");
|
||||||
cur->type = (xmlElementType) type;
|
cur->type = (xmlElementType) type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* htmlDocContentDumpOutput:
|
||||||
|
* @buf: the HTML buffer output
|
||||||
|
* @cur: the document
|
||||||
|
* @encoding: the encoding string
|
||||||
|
*
|
||||||
|
* Dump an HTML document. Formating return/spaces are added.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
htmlDocContentDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr cur,
|
||||||
|
const char *encoding) {
|
||||||
|
htmlDocContentDumpFormatOutput(buf, cur, encoding, 1);
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Saving functions front-ends *
|
* Saving functions front-ends *
|
||||||
@ -1164,16 +1245,19 @@ htmlSaveFile(const char *filename, xmlDocPtr cur) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* htmlSaveFileEnc:
|
* htmlSaveFileFormat:
|
||||||
* @filename: the filename
|
* @filename: the filename
|
||||||
* @cur: the document
|
* @cur: the document
|
||||||
|
* @format: should formatting spaces been added
|
||||||
|
* @encoding: the document encoding
|
||||||
*
|
*
|
||||||
* Dump an HTML document to a file using a given encoding.
|
* Dump an HTML document to a file using a given encoding.
|
||||||
*
|
*
|
||||||
* returns: the number of byte written or -1 in case of failure.
|
* returns: the number of byte written or -1 in case of failure.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
htmlSaveFileEnc(const char *filename, xmlDocPtr cur, const char *encoding) {
|
htmlSaveFileFormat(const char *filename, xmlDocPtr cur,
|
||||||
|
const char *encoding, int format) {
|
||||||
xmlOutputBufferPtr buf;
|
xmlOutputBufferPtr buf;
|
||||||
xmlCharEncodingHandlerPtr handler = NULL;
|
xmlCharEncodingHandlerPtr handler = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
@ -1213,9 +1297,26 @@ htmlSaveFileEnc(const char *filename, xmlDocPtr cur, const char *encoding) {
|
|||||||
buf = xmlOutputBufferCreateFilename(filename, handler, 0);
|
buf = xmlOutputBufferCreateFilename(filename, handler, 0);
|
||||||
if (buf == NULL) return(0);
|
if (buf == NULL) return(0);
|
||||||
|
|
||||||
htmlDocContentDumpOutput(buf, cur, encoding);
|
htmlDocContentDumpFormatOutput(buf, cur, encoding, format);
|
||||||
|
|
||||||
ret = xmlOutputBufferClose(buf);
|
ret = xmlOutputBufferClose(buf);
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* htmlSaveFileEnc:
|
||||||
|
* @filename: the filename
|
||||||
|
* @cur: the document
|
||||||
|
* @encoding: the document encoding
|
||||||
|
*
|
||||||
|
* Dump an HTML document to a file using a given encoding
|
||||||
|
* and formatting returns/spaces are added.
|
||||||
|
*
|
||||||
|
* returns: the number of byte written or -1 in case of failure.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
htmlSaveFileEnc(const char *filename, xmlDocPtr cur, const char *encoding) {
|
||||||
|
return(htmlSaveFileFormat(filename, cur, encoding, 1));
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* LIBXML_HTML_ENABLED */
|
#endif /* LIBXML_HTML_ENABLED */
|
||||||
|
@ -75,9 +75,18 @@ void htmlNodeDump (xmlBufferPtr buf,
|
|||||||
void htmlNodeDumpFile (FILE *out,
|
void htmlNodeDumpFile (FILE *out,
|
||||||
xmlDocPtr doc,
|
xmlDocPtr doc,
|
||||||
xmlNodePtr cur);
|
xmlNodePtr cur);
|
||||||
|
void htmlNodeDumpFileFormat (FILE *out,
|
||||||
|
xmlDocPtr doc,
|
||||||
|
xmlNodePtr cur,
|
||||||
|
const char *encoding,
|
||||||
|
int format);
|
||||||
int htmlSaveFileEnc (const char *filename,
|
int htmlSaveFileEnc (const char *filename,
|
||||||
xmlDocPtr cur,
|
xmlDocPtr cur,
|
||||||
const char *encoding);
|
const char *encoding);
|
||||||
|
int htmlSaveFileFormat (const char *filename,
|
||||||
|
xmlDocPtr cur,
|
||||||
|
const char *encoding,
|
||||||
|
int format);
|
||||||
|
|
||||||
/* This one is imported from xmlIO.h
|
/* This one is imported from xmlIO.h
|
||||||
void htmlDocContentDumpOutput(xmlOutputBufferPtr buf,
|
void htmlDocContentDumpOutput(xmlOutputBufferPtr buf,
|
||||||
|
@ -75,9 +75,18 @@ void htmlNodeDump (xmlBufferPtr buf,
|
|||||||
void htmlNodeDumpFile (FILE *out,
|
void htmlNodeDumpFile (FILE *out,
|
||||||
xmlDocPtr doc,
|
xmlDocPtr doc,
|
||||||
xmlNodePtr cur);
|
xmlNodePtr cur);
|
||||||
|
void htmlNodeDumpFileFormat (FILE *out,
|
||||||
|
xmlDocPtr doc,
|
||||||
|
xmlNodePtr cur,
|
||||||
|
const char *encoding,
|
||||||
|
int format);
|
||||||
int htmlSaveFileEnc (const char *filename,
|
int htmlSaveFileEnc (const char *filename,
|
||||||
xmlDocPtr cur,
|
xmlDocPtr cur,
|
||||||
const char *encoding);
|
const char *encoding);
|
||||||
|
int htmlSaveFileFormat (const char *filename,
|
||||||
|
xmlDocPtr cur,
|
||||||
|
const char *encoding,
|
||||||
|
int format);
|
||||||
|
|
||||||
/* This one is imported from xmlIO.h
|
/* This one is imported from xmlIO.h
|
||||||
void htmlDocContentDumpOutput(xmlOutputBufferPtr buf,
|
void htmlDocContentDumpOutput(xmlOutputBufferPtr buf,
|
||||||
|
Reference in New Issue
Block a user