mirror of
https://github.com/GNOME/libxml2.git
synced 2025-02-17 18:19:32 +08:00
Opening the interface xmlNewCharEncodingHandler as requested in #89415
* encoding.c include/libxml/encoding.h: Opening the interface xmlNewCharEncodingHandler as requested in #89415 * python/generator.py python/setup.py.in: applied cleanup patches from Marc-Andre Lemburg * tree.c: fixing bug #89332 on a specific case of loosing the XML-1.0 namespace on xml:xxx attributes Daniel
This commit is contained in:
parent
2c135a1cf1
commit
6f46f6c5b8
@ -1,3 +1,12 @@
|
||||
Thu Aug 1 12:17:30 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* encoding.c include/libxml/encoding.h: Opening the interface
|
||||
xmlNewCharEncodingHandler as requested in #89415
|
||||
* python/generator.py python/setup.py.in: applied cleanup
|
||||
patches from Marc-Andre Lemburg
|
||||
* tree.c: fixing bug #89332 on a specific case of loosing
|
||||
the XML-1.0 namespace on xml:xxx attributes
|
||||
|
||||
Wed Jul 31 23:27:42 2002 Aleksey Sanin <aleksey@aleksey.com>
|
||||
|
||||
* c14n.c include/libxml/c14n.h: fixed one more c14n + namespaces
|
||||
|
@ -1481,9 +1481,10 @@ static xmlCharEncodingHandlerPtr xmlDefaultCharEncodingHandler = NULL;
|
||||
* @output: the xmlCharEncodingOutputFunc to write that encoding
|
||||
*
|
||||
* Create and registers an xmlCharEncodingHandler.
|
||||
*
|
||||
* Returns the xmlCharEncodingHandlerPtr created (or NULL in case of error).
|
||||
*/
|
||||
static xmlCharEncodingHandlerPtr
|
||||
xmlCharEncodingHandlerPtr
|
||||
xmlNewCharEncodingHandler(const char *name,
|
||||
xmlCharEncodingInputFunc input,
|
||||
xmlCharEncodingOutputFunc output) {
|
||||
|
@ -155,7 +155,10 @@ xmlCharEncodingHandlerPtr
|
||||
xmlGetCharEncodingHandler (xmlCharEncoding enc);
|
||||
xmlCharEncodingHandlerPtr
|
||||
xmlFindCharEncodingHandler (const char *name);
|
||||
|
||||
xmlCharEncodingHandlerPtr
|
||||
xmlNewCharEncodingHandler (const char *name,
|
||||
xmlCharEncodingInputFunc input,
|
||||
xmlCharEncodingOutputFunc output);
|
||||
|
||||
/*
|
||||
* Interfaces for encoding names and aliases.
|
||||
|
@ -74,7 +74,7 @@ class SlowParser(xmllib.XMLParser):
|
||||
def getparser(target = None):
|
||||
# get the fastest available parser, and attach it to an
|
||||
# unmarshalling object. return both objects.
|
||||
if target == None:
|
||||
if target is None:
|
||||
target = docParser()
|
||||
if FastParser:
|
||||
return FastParser(target), target
|
||||
@ -392,7 +392,7 @@ def print_function_wrapper(name, output, export, include):
|
||||
if file == "python":
|
||||
# Those have been manually generated
|
||||
return 1
|
||||
if file == "python_accessor" and ret[0] != "void" and ret[2] == None:
|
||||
if file == "python_accessor" and ret[0] != "void" and ret[2] is None:
|
||||
# Those have been manually generated
|
||||
return 1
|
||||
|
||||
@ -651,7 +651,7 @@ def functionCompare(info1, info2):
|
||||
return 0
|
||||
|
||||
def writeDoc(name, args, indent, output):
|
||||
if functions[name][0] == None or functions[name][0] == "":
|
||||
if functions[name][0] is None or functions[name][0] == "":
|
||||
return
|
||||
val = functions[name][0]
|
||||
val = string.replace(val, "NULL", "None");
|
||||
@ -789,7 +789,7 @@ def buildWrappers():
|
||||
|
||||
for arg in args:
|
||||
if classes_type.has_key(arg[1]):
|
||||
classes.write(" if %s == None: %s__o = None\n" %
|
||||
classes.write(" if %s is None: %s__o = None\n" %
|
||||
(arg[0], arg[0]))
|
||||
classes.write(" else: %s__o = %s%s\n" %
|
||||
(arg[0], arg[0], classes_type[arg[1]][0]))
|
||||
@ -813,22 +813,22 @@ def buildWrappers():
|
||||
# Raise an exception
|
||||
#
|
||||
if functions_noexcept.has_key(name):
|
||||
classes.write(" if ret == None:return None\n");
|
||||
classes.write(" if ret is None:return None\n");
|
||||
elif string.find(name, "URI") >= 0:
|
||||
classes.write(
|
||||
" if ret == None:raise uriError('%s() failed')\n"
|
||||
" if ret is None:raise uriError('%s() failed')\n"
|
||||
% (name))
|
||||
elif string.find(name, "XPath") >= 0:
|
||||
classes.write(
|
||||
" if ret == None:raise xpathError('%s() failed')\n"
|
||||
" if ret is None:raise xpathError('%s() failed')\n"
|
||||
% (name))
|
||||
elif string.find(name, "Parse") >= 0:
|
||||
classes.write(
|
||||
" if ret == None:raise parserError('%s() failed')\n"
|
||||
" if ret is None:raise parserError('%s() failed')\n"
|
||||
% (name))
|
||||
else:
|
||||
classes.write(
|
||||
" if ret == None:raise treeError('%s() failed')\n"
|
||||
" if ret is None:raise treeError('%s() failed')\n"
|
||||
% (name))
|
||||
classes.write(" return ");
|
||||
classes.write(classes_type[ret[0]][1] % ("ret"));
|
||||
@ -898,7 +898,7 @@ def buildWrappers():
|
||||
for arg in args:
|
||||
if classes_type.has_key(arg[1]):
|
||||
if n != index:
|
||||
classes.write(" if %s == None: %s__o = None\n" %
|
||||
classes.write(" if %s is None: %s__o = None\n" %
|
||||
(arg[0], arg[0]))
|
||||
classes.write(" else: %s__o = %s%s\n" %
|
||||
(arg[0], arg[0], classes_type[arg[1]][0]))
|
||||
@ -929,22 +929,22 @@ def buildWrappers():
|
||||
#
|
||||
if functions_noexcept.has_key(name):
|
||||
classes.write(
|
||||
" if ret == None:return None\n");
|
||||
" if ret is None:return None\n");
|
||||
elif string.find(name, "URI") >= 0:
|
||||
classes.write(
|
||||
" if ret == None:raise uriError('%s() failed')\n"
|
||||
" if ret is None:raise uriError('%s() failed')\n"
|
||||
% (name))
|
||||
elif string.find(name, "XPath") >= 0:
|
||||
classes.write(
|
||||
" if ret == None:raise xpathError('%s() failed')\n"
|
||||
" if ret is None:raise xpathError('%s() failed')\n"
|
||||
% (name))
|
||||
elif string.find(name, "Parse") >= 0:
|
||||
classes.write(
|
||||
" if ret == None:raise parserError('%s() failed')\n"
|
||||
" if ret is None:raise parserError('%s() failed')\n"
|
||||
% (name))
|
||||
else:
|
||||
classes.write(
|
||||
" if ret == None:raise treeError('%s() failed')\n"
|
||||
" if ret is None:raise treeError('%s() failed')\n"
|
||||
% (name))
|
||||
classes.write(" return ");
|
||||
classes.write(classes_type[ret[0]][1] % ("ret"));
|
||||
@ -955,22 +955,22 @@ def buildWrappers():
|
||||
#
|
||||
if functions_noexcept.has_key(name):
|
||||
classes.write(
|
||||
" if ret == None:return None");
|
||||
" if ret is None:return None");
|
||||
elif string.find(name, "URI") >= 0:
|
||||
classes.write(
|
||||
" if ret == None:raise uriError('%s() failed')\n"
|
||||
" if ret is None:raise uriError('%s() failed')\n"
|
||||
% (name))
|
||||
elif string.find(name, "XPath") >= 0:
|
||||
classes.write(
|
||||
" if ret == None:raise xpathError('%s() failed')\n"
|
||||
" if ret is None:raise xpathError('%s() failed')\n"
|
||||
% (name))
|
||||
elif string.find(name, "Parse") >= 0:
|
||||
classes.write(
|
||||
" if ret == None:raise parserError('%s() failed')\n"
|
||||
" if ret is None:raise parserError('%s() failed')\n"
|
||||
% (name))
|
||||
else:
|
||||
classes.write(
|
||||
" if ret == None:raise treeError('%s() failed')\n"
|
||||
" if ret is None:raise treeError('%s() failed')\n"
|
||||
% (name))
|
||||
classes.write(" return ");
|
||||
classes.write(converter_type[ret[0]] % ("ret"));
|
||||
|
@ -127,7 +127,6 @@ if with_xslt == 1:
|
||||
libraries=libs))
|
||||
|
||||
if missing("MANIFEST"):
|
||||
global xml_files
|
||||
|
||||
manifest = open("MANIFEST", "w")
|
||||
manifest.write("setup.py\n")
|
||||
|
28
tree.c
28
tree.c
@ -4438,8 +4438,26 @@ xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace) {
|
||||
if (node == NULL) return(NULL);
|
||||
if ((nameSpace != NULL) &&
|
||||
(xmlStrEqual(nameSpace, (const xmlChar *)"xml"))) {
|
||||
if (doc == NULL)
|
||||
return(NULL);
|
||||
if ((doc == NULL) && (node->type == XML_ELEMENT_NODE)) {
|
||||
/*
|
||||
* The XML-1.0 namespace is normally held on the root
|
||||
* element. In this case exceptionally create it on the
|
||||
* node element.
|
||||
*/
|
||||
cur = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
|
||||
if (cur == NULL) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlSearchNs : malloc failed\n");
|
||||
return(NULL);
|
||||
}
|
||||
memset(cur, 0, sizeof(xmlNs));
|
||||
cur->type = XML_LOCAL_NAMESPACE;
|
||||
cur->href = xmlStrdup(XML_XML_NAMESPACE);
|
||||
cur->prefix = xmlStrdup((const xmlChar *)"xml");
|
||||
cur->next = node->nsDef;
|
||||
node->nsDef = cur;
|
||||
return(cur);
|
||||
}
|
||||
if (doc->oldNs == NULL) {
|
||||
/*
|
||||
* Allocate a new Namespace and fill the fields.
|
||||
@ -5863,6 +5881,9 @@ xmlNsDump(xmlBufferPtr buf, xmlNsPtr cur) {
|
||||
return;
|
||||
}
|
||||
if (cur->type == XML_LOCAL_NAMESPACE) {
|
||||
if (xmlStrEqual(cur->prefix, BAD_CAST "xml"))
|
||||
return;
|
||||
|
||||
/* Within the context of an element attributes */
|
||||
if (cur->prefix != NULL) {
|
||||
xmlBufferWriteChar(buf, " xmlns:");
|
||||
@ -6395,6 +6416,9 @@ xmlNsDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur) {
|
||||
return;
|
||||
}
|
||||
if ((cur->type == XML_LOCAL_NAMESPACE) && (cur->href != NULL)) {
|
||||
if (xmlStrEqual(cur->prefix, BAD_CAST "xml"))
|
||||
return;
|
||||
|
||||
/* Within the context of an element attributes */
|
||||
if (cur->prefix != NULL) {
|
||||
xmlOutputBufferWriteString(buf, " xmlns:");
|
||||
|
Loading…
Reference in New Issue
Block a user