summaryrefslogtreecommitdiff
path: root/chromium/third_party/libxml/src/xmlsave.c
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/libxml/src/xmlsave.c')
-rw-r--r--chromium/third_party/libxml/src/xmlsave.c69
1 files changed, 15 insertions, 54 deletions
diff --git a/chromium/third_party/libxml/src/xmlsave.c b/chromium/third_party/libxml/src/xmlsave.c
index 3addd6528d6..77cb7b9b012 100644
--- a/chromium/third_party/libxml/src/xmlsave.c
+++ b/chromium/third_party/libxml/src/xmlsave.c
@@ -19,56 +19,14 @@
#include <libxml/HTMLtree.h>
-#include "buf.h"
-#include "enc.h"
-#include "save.h"
+#include "private/buf.h"
+#include "private/enc.h"
+#include "private/error.h"
+#include "private/save.h"
-/************************************************************************
- * *
- * XHTML detection *
- * *
- ************************************************************************/
-#define XHTML_STRICT_PUBLIC_ID BAD_CAST \
- "-//W3C//DTD XHTML 1.0 Strict//EN"
-#define XHTML_STRICT_SYSTEM_ID BAD_CAST \
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-#define XHTML_FRAME_PUBLIC_ID BAD_CAST \
- "-//W3C//DTD XHTML 1.0 Frameset//EN"
-#define XHTML_FRAME_SYSTEM_ID BAD_CAST \
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
-#define XHTML_TRANS_PUBLIC_ID BAD_CAST \
- "-//W3C//DTD XHTML 1.0 Transitional//EN"
-#define XHTML_TRANS_SYSTEM_ID BAD_CAST \
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+#ifdef LIBXML_OUTPUT_ENABLED
#define XHTML_NS_NAME BAD_CAST "http://www.w3.org/1999/xhtml"
-/**
- * xmlIsXHTML:
- * @systemID: the system identifier
- * @publicID: the public identifier
- *
- * Try to find if the document correspond to an XHTML DTD
- *
- * Returns 1 if true, 0 if not and -1 in case of error
- */
-int
-xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID) {
- if ((systemID == NULL) && (publicID == NULL))
- return(-1);
- if (publicID != NULL) {
- if (xmlStrEqual(publicID, XHTML_STRICT_PUBLIC_ID)) return(1);
- if (xmlStrEqual(publicID, XHTML_FRAME_PUBLIC_ID)) return(1);
- if (xmlStrEqual(publicID, XHTML_TRANS_PUBLIC_ID)) return(1);
- }
- if (systemID != NULL) {
- if (xmlStrEqual(systemID, XHTML_STRICT_SYSTEM_ID)) return(1);
- if (xmlStrEqual(systemID, XHTML_FRAME_SYSTEM_ID)) return(1);
- if (xmlStrEqual(systemID, XHTML_TRANS_SYSTEM_ID)) return(1);
- }
- return(0);
-}
-
-#ifdef LIBXML_OUTPUT_ENABLED
#define TODO \
xmlGenericError(xmlGenericErrorContext, \
@@ -463,7 +421,7 @@ xmlAttrSerializeContent(xmlOutputBufferPtr buf, xmlAttrPtr attr)
*
* This will dump the content of the notation table as an XML DTD definition
*/
-void
+static void
xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table) {
xmlBufferPtr buffer;
@@ -474,6 +432,7 @@ xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table) {
*/
return;
}
+ xmlBufferSetAllocationScheme(buffer, XML_BUFFER_ALLOC_DOUBLEIT);
xmlDumpNotationTable(buffer, table);
xmlBufMergeBuffer(buf, buffer);
}
@@ -486,7 +445,7 @@ xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table) {
* This will dump the content of the element declaration as an XML
* DTD definition
*/
-void
+static void
xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem) {
xmlBufferPtr buffer;
@@ -497,6 +456,7 @@ xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem) {
*/
return;
}
+ xmlBufferSetAllocationScheme(buffer, XML_BUFFER_ALLOC_DOUBLEIT);
xmlDumpElementDecl(buffer, elem);
xmlBufMergeBuffer(buf, buffer);
}
@@ -509,7 +469,7 @@ xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem) {
* This will dump the content of the attribute declaration as an XML
* DTD definition
*/
-void
+static void
xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr) {
xmlBufferPtr buffer;
@@ -520,6 +480,7 @@ xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr) {
*/
return;
}
+ xmlBufferSetAllocationScheme(buffer, XML_BUFFER_ALLOC_DOUBLEIT);
xmlDumpAttributeDecl(buffer, attr);
xmlBufMergeBuffer(buf, buffer);
}
@@ -531,7 +492,7 @@ xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr) {
*
* This will dump the content of the entity table as an XML DTD definition
*/
-void
+static void
xmlBufDumpEntityDecl(xmlBufPtr buf, xmlEntityPtr ent) {
xmlBufferPtr buffer;
@@ -542,6 +503,7 @@ xmlBufDumpEntityDecl(xmlBufPtr buf, xmlEntityPtr ent) {
*/
return;
}
+ xmlBufferSetAllocationScheme(buffer, XML_BUFFER_ALLOC_DOUBLEIT);
xmlDumpEntityDecl(buffer, ent);
xmlBufMergeBuffer(buf, buffer);
}
@@ -591,7 +553,6 @@ static void
xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur);
#endif
static void xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur);
-void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
static int xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur);
/**
@@ -1375,7 +1336,7 @@ xhtmlAttrListDumpOutput(xmlSaveCtxtPtr ctxt, xmlAttrPtr cur) {
(htmlIsBooleanAttr(cur->name))) {
if (cur->children != NULL)
xmlFreeNode(cur->children);
- cur->children = xmlNewText(cur->name);
+ cur->children = xmlNewDocText(cur->doc, cur->name);
if (cur->children != NULL)
cur->children->parent = (xmlNodePtr) cur;
}
@@ -2174,7 +2135,7 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
xmlBufBackToBuffer(buffer);
if (ret > INT_MAX)
return(-1);
- return((int) ret);
+ return(ret);
}
/**