mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03: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:
@ -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>
|
Wed Jul 31 23:27:42 2002 Aleksey Sanin <aleksey@aleksey.com>
|
||||||
|
|
||||||
* c14n.c include/libxml/c14n.h: fixed one more c14n + namespaces
|
* 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
|
* @output: the xmlCharEncodingOutputFunc to write that encoding
|
||||||
*
|
*
|
||||||
* Create and registers an xmlCharEncodingHandler.
|
* Create and registers an xmlCharEncodingHandler.
|
||||||
|
*
|
||||||
* Returns the xmlCharEncodingHandlerPtr created (or NULL in case of error).
|
* Returns the xmlCharEncodingHandlerPtr created (or NULL in case of error).
|
||||||
*/
|
*/
|
||||||
static xmlCharEncodingHandlerPtr
|
xmlCharEncodingHandlerPtr
|
||||||
xmlNewCharEncodingHandler(const char *name,
|
xmlNewCharEncodingHandler(const char *name,
|
||||||
xmlCharEncodingInputFunc input,
|
xmlCharEncodingInputFunc input,
|
||||||
xmlCharEncodingOutputFunc output) {
|
xmlCharEncodingOutputFunc output) {
|
||||||
|
@ -155,7 +155,10 @@ xmlCharEncodingHandlerPtr
|
|||||||
xmlGetCharEncodingHandler (xmlCharEncoding enc);
|
xmlGetCharEncodingHandler (xmlCharEncoding enc);
|
||||||
xmlCharEncodingHandlerPtr
|
xmlCharEncodingHandlerPtr
|
||||||
xmlFindCharEncodingHandler (const char *name);
|
xmlFindCharEncodingHandler (const char *name);
|
||||||
|
xmlCharEncodingHandlerPtr
|
||||||
|
xmlNewCharEncodingHandler (const char *name,
|
||||||
|
xmlCharEncodingInputFunc input,
|
||||||
|
xmlCharEncodingOutputFunc output);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Interfaces for encoding names and aliases.
|
* Interfaces for encoding names and aliases.
|
||||||
|
@ -74,7 +74,7 @@ class SlowParser(xmllib.XMLParser):
|
|||||||
def getparser(target = None):
|
def getparser(target = None):
|
||||||
# get the fastest available parser, and attach it to an
|
# get the fastest available parser, and attach it to an
|
||||||
# unmarshalling object. return both objects.
|
# unmarshalling object. return both objects.
|
||||||
if target == None:
|
if target is None:
|
||||||
target = docParser()
|
target = docParser()
|
||||||
if FastParser:
|
if FastParser:
|
||||||
return FastParser(target), target
|
return FastParser(target), target
|
||||||
@ -392,7 +392,7 @@ def print_function_wrapper(name, output, export, include):
|
|||||||
if file == "python":
|
if file == "python":
|
||||||
# Those have been manually generated
|
# Those have been manually generated
|
||||||
return 1
|
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
|
# Those have been manually generated
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
@ -651,7 +651,7 @@ def functionCompare(info1, info2):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
def writeDoc(name, args, indent, output):
|
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
|
return
|
||||||
val = functions[name][0]
|
val = functions[name][0]
|
||||||
val = string.replace(val, "NULL", "None");
|
val = string.replace(val, "NULL", "None");
|
||||||
@ -789,7 +789,7 @@ def buildWrappers():
|
|||||||
|
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if classes_type.has_key(arg[1]):
|
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]))
|
(arg[0], arg[0]))
|
||||||
classes.write(" else: %s__o = %s%s\n" %
|
classes.write(" else: %s__o = %s%s\n" %
|
||||||
(arg[0], arg[0], classes_type[arg[1]][0]))
|
(arg[0], arg[0], classes_type[arg[1]][0]))
|
||||||
@ -813,22 +813,22 @@ def buildWrappers():
|
|||||||
# Raise an exception
|
# Raise an exception
|
||||||
#
|
#
|
||||||
if functions_noexcept.has_key(name):
|
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:
|
elif string.find(name, "URI") >= 0:
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret == None:raise uriError('%s() failed')\n"
|
" if ret is None:raise uriError('%s() failed')\n"
|
||||||
% (name))
|
% (name))
|
||||||
elif string.find(name, "XPath") >= 0:
|
elif string.find(name, "XPath") >= 0:
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret == None:raise xpathError('%s() failed')\n"
|
" if ret is None:raise xpathError('%s() failed')\n"
|
||||||
% (name))
|
% (name))
|
||||||
elif string.find(name, "Parse") >= 0:
|
elif string.find(name, "Parse") >= 0:
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret == None:raise parserError('%s() failed')\n"
|
" if ret is None:raise parserError('%s() failed')\n"
|
||||||
% (name))
|
% (name))
|
||||||
else:
|
else:
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret == None:raise treeError('%s() failed')\n"
|
" if ret is None:raise treeError('%s() failed')\n"
|
||||||
% (name))
|
% (name))
|
||||||
classes.write(" return ");
|
classes.write(" return ");
|
||||||
classes.write(classes_type[ret[0]][1] % ("ret"));
|
classes.write(classes_type[ret[0]][1] % ("ret"));
|
||||||
@ -898,7 +898,7 @@ def buildWrappers():
|
|||||||
for arg in args:
|
for arg in args:
|
||||||
if classes_type.has_key(arg[1]):
|
if classes_type.has_key(arg[1]):
|
||||||
if n != index:
|
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]))
|
(arg[0], arg[0]))
|
||||||
classes.write(" else: %s__o = %s%s\n" %
|
classes.write(" else: %s__o = %s%s\n" %
|
||||||
(arg[0], arg[0], classes_type[arg[1]][0]))
|
(arg[0], arg[0], classes_type[arg[1]][0]))
|
||||||
@ -929,22 +929,22 @@ def buildWrappers():
|
|||||||
#
|
#
|
||||||
if functions_noexcept.has_key(name):
|
if functions_noexcept.has_key(name):
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret == None:return None\n");
|
" if ret is None:return None\n");
|
||||||
elif string.find(name, "URI") >= 0:
|
elif string.find(name, "URI") >= 0:
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret == None:raise uriError('%s() failed')\n"
|
" if ret is None:raise uriError('%s() failed')\n"
|
||||||
% (name))
|
% (name))
|
||||||
elif string.find(name, "XPath") >= 0:
|
elif string.find(name, "XPath") >= 0:
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret == None:raise xpathError('%s() failed')\n"
|
" if ret is None:raise xpathError('%s() failed')\n"
|
||||||
% (name))
|
% (name))
|
||||||
elif string.find(name, "Parse") >= 0:
|
elif string.find(name, "Parse") >= 0:
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret == None:raise parserError('%s() failed')\n"
|
" if ret is None:raise parserError('%s() failed')\n"
|
||||||
% (name))
|
% (name))
|
||||||
else:
|
else:
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret == None:raise treeError('%s() failed')\n"
|
" if ret is None:raise treeError('%s() failed')\n"
|
||||||
% (name))
|
% (name))
|
||||||
classes.write(" return ");
|
classes.write(" return ");
|
||||||
classes.write(classes_type[ret[0]][1] % ("ret"));
|
classes.write(classes_type[ret[0]][1] % ("ret"));
|
||||||
@ -955,22 +955,22 @@ def buildWrappers():
|
|||||||
#
|
#
|
||||||
if functions_noexcept.has_key(name):
|
if functions_noexcept.has_key(name):
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret == None:return None");
|
" if ret is None:return None");
|
||||||
elif string.find(name, "URI") >= 0:
|
elif string.find(name, "URI") >= 0:
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret == None:raise uriError('%s() failed')\n"
|
" if ret is None:raise uriError('%s() failed')\n"
|
||||||
% (name))
|
% (name))
|
||||||
elif string.find(name, "XPath") >= 0:
|
elif string.find(name, "XPath") >= 0:
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret == None:raise xpathError('%s() failed')\n"
|
" if ret is None:raise xpathError('%s() failed')\n"
|
||||||
% (name))
|
% (name))
|
||||||
elif string.find(name, "Parse") >= 0:
|
elif string.find(name, "Parse") >= 0:
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret == None:raise parserError('%s() failed')\n"
|
" if ret is None:raise parserError('%s() failed')\n"
|
||||||
% (name))
|
% (name))
|
||||||
else:
|
else:
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret == None:raise treeError('%s() failed')\n"
|
" if ret is None:raise treeError('%s() failed')\n"
|
||||||
% (name))
|
% (name))
|
||||||
classes.write(" return ");
|
classes.write(" return ");
|
||||||
classes.write(converter_type[ret[0]] % ("ret"));
|
classes.write(converter_type[ret[0]] % ("ret"));
|
||||||
|
@ -127,7 +127,6 @@ if with_xslt == 1:
|
|||||||
libraries=libs))
|
libraries=libs))
|
||||||
|
|
||||||
if missing("MANIFEST"):
|
if missing("MANIFEST"):
|
||||||
global xml_files
|
|
||||||
|
|
||||||
manifest = open("MANIFEST", "w")
|
manifest = open("MANIFEST", "w")
|
||||||
manifest.write("setup.py\n")
|
manifest.write("setup.py\n")
|
||||||
|
26
tree.c
26
tree.c
@ -4438,8 +4438,26 @@ xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace) {
|
|||||||
if (node == NULL) return(NULL);
|
if (node == NULL) return(NULL);
|
||||||
if ((nameSpace != NULL) &&
|
if ((nameSpace != NULL) &&
|
||||||
(xmlStrEqual(nameSpace, (const xmlChar *)"xml"))) {
|
(xmlStrEqual(nameSpace, (const xmlChar *)"xml"))) {
|
||||||
if (doc == 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);
|
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) {
|
if (doc->oldNs == NULL) {
|
||||||
/*
|
/*
|
||||||
* Allocate a new Namespace and fill the fields.
|
* Allocate a new Namespace and fill the fields.
|
||||||
@ -5863,6 +5881,9 @@ xmlNsDump(xmlBufferPtr buf, xmlNsPtr cur) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (cur->type == XML_LOCAL_NAMESPACE) {
|
if (cur->type == XML_LOCAL_NAMESPACE) {
|
||||||
|
if (xmlStrEqual(cur->prefix, BAD_CAST "xml"))
|
||||||
|
return;
|
||||||
|
|
||||||
/* Within the context of an element attributes */
|
/* Within the context of an element attributes */
|
||||||
if (cur->prefix != NULL) {
|
if (cur->prefix != NULL) {
|
||||||
xmlBufferWriteChar(buf, " xmlns:");
|
xmlBufferWriteChar(buf, " xmlns:");
|
||||||
@ -6395,6 +6416,9 @@ xmlNsDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((cur->type == XML_LOCAL_NAMESPACE) && (cur->href != NULL)) {
|
if ((cur->type == XML_LOCAL_NAMESPACE) && (cur->href != NULL)) {
|
||||||
|
if (xmlStrEqual(cur->prefix, BAD_CAST "xml"))
|
||||||
|
return;
|
||||||
|
|
||||||
/* Within the context of an element attributes */
|
/* Within the context of an element attributes */
|
||||||
if (cur->prefix != NULL) {
|
if (cur->prefix != NULL) {
|
||||||
xmlOutputBufferWriteString(buf, " xmlns:");
|
xmlOutputBufferWriteString(buf, " xmlns:");
|
||||||
|
Reference in New Issue
Block a user