Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.1
libxml2-python
libxml2-2.7.1-xmlsave.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libxml2-2.7.1-xmlsave.patch of Package libxml2-python
--- include/libxml/xmlsave.h +++ include/libxml/xmlsave.h @@ -30,7 +30,10 @@ XML_SAVE_FORMAT = 1<<0, /* format save output */ XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */ XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */ - XML_SAVE_NO_XHTML = 1<<3 /* disable XHTML1 specific rules */ + XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */ + XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */ + XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */ + XML_SAVE_AS_HTML = 1<<6 /* force HTML serialization on XML doc */ } xmlSaveOption; --- xmlsave.c +++ xmlsave.c @@ -757,8 +757,14 @@ return; } #ifdef LIBXML_HTML_ENABLED - if ((cur->type != XML_NAMESPACE_DECL) && (cur->doc != NULL) && - (cur->doc->type == XML_HTML_DOCUMENT_NODE)) { + if (ctxt->options & XML_SAVE_XHTML) { + xhtmlNodeDumpOutput(ctxt, cur); + return; + } + if (((cur->type != XML_NAMESPACE_DECL) && (cur->doc != NULL) && + (cur->doc->type == XML_HTML_DOCUMENT_NODE) && + ((ctxt->options & XML_SAVE_AS_XML) == 0)) || + (ctxt->options & XML_SAVE_AS_HTML)) { htmlNodeDumpOutputInternal(ctxt, cur); return; } @@ -953,7 +959,10 @@ xmlGetCharEncodingName((xmlCharEncoding) cur->charset); } - if (cur->type == XML_HTML_DOCUMENT_NODE) { + if (((cur->type == XML_HTML_DOCUMENT_NODE) && + ((ctxt->options & XML_SAVE_AS_XML) == 0) && + ((ctxt->options & XML_SAVE_XHTML) == 0)) || + (ctxt->options & XML_SAVE_AS_HTML)) { #ifdef LIBXML_HTML_ENABLED if (encoding != NULL) htmlSetMetaEncoding(cur, (const xmlChar *) encoding); @@ -981,7 +990,9 @@ #else return(-1); #endif - } else if (cur->type == XML_DOCUMENT_NODE) { + } else if ((cur->type == XML_DOCUMENT_NODE) || + (ctxt->options & XML_SAVE_AS_XML) || + (ctxt->options & XML_SAVE_XHTML)) { enc = xmlParseCharEncoding((const char*) encoding); if ((encoding != NULL) && (oldctxtenc == NULL) && (buf->encoder == NULL) && (buf->conv == NULL) && @@ -1032,6 +1043,8 @@ } #ifdef LIBXML_HTML_ENABLED + if (ctxt->options & XML_SAVE_XHTML) + is_xhtml = 1; if ((ctxt->options & XML_SAVE_NO_XHTML) == 0) { dtd = xmlGetIntSubset(cur); if (dtd != NULL) { @@ -2123,6 +2136,7 @@ ctxt.format = format; ctxt.encoding = (const xmlChar *) encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; #ifdef LIBXML_HTML_ENABLED dtd = xmlGetIntSubset(doc); @@ -2208,6 +2222,7 @@ ctxt.format = format; ctxt.encoding = (const xmlChar *) txt_encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; xmlDocContentDumpOutput(&ctxt, out_doc); xmlOutputBufferFlush(out_buff); if (out_buff->conv != NULL) { @@ -2326,6 +2341,7 @@ ctxt.format = format; ctxt.encoding = (const xmlChar *) encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; xmlDocContentDumpOutput(&ctxt, cur); ret = xmlOutputBufferClose(buf); @@ -2375,6 +2391,7 @@ ctxt.format = 0; ctxt.encoding = (const xmlChar *) encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; xmlDocContentDumpOutput(&ctxt, cur); ret = xmlOutputBufferClose(buf); return(ret); @@ -2414,6 +2431,7 @@ ctxt.format = format; ctxt.encoding = (const xmlChar *) encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; xmlDocContentDumpOutput(&ctxt, cur); ret = xmlOutputBufferClose(buf); return (ret); @@ -2468,6 +2486,7 @@ ctxt.format = format; ctxt.encoding = (const xmlChar *) encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; xmlDocContentDumpOutput(&ctxt, cur);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor