Added wrapper for the xmlURIPtr type, provided accessors, fixed the
* python/generator.py python/libxml.c python/libxml2-python-api.xml
python/libxml2class.txt python/libxml_wrap.h python/types.c:
Added wrapper for the xmlURIPtr type, provided accessors, fixed
the accessor generator for strings
* python/tests/Makefile.am python/tests/tstURI.py: added a specific
regression test.
Daniel
diff --git a/python/generator.py b/python/generator.py
index 7a575c5..6aad6b0 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -267,6 +267,7 @@
'htmlParserCtxt *': ('O', "parserCtxt", "xmlParserCtxtPtr", "xmlParserCtxtPtr"),
'xmlCatalogPtr': ('O', "catalog", "xmlCatalogPtr", "xmlCatalogPtr"),
'FILE *': ('O', "File", "FILEPtr", "FILE *"),
+ 'xmlURIPtr': ('O', "URI", "xmlURIPtr", "xmlURIPtr"),
}
py_return_types = {
@@ -346,8 +347,14 @@
if ret[0] == 'void':
if file == "python_accessor":
- c_call = "\n %s->%s = %s;\n" % (args[0][0], args[1][0],
- args[1][0])
+ if args[1][1] == "char *" or args[1][1] == "xmlChar *":
+ c_call = "\n if (%s->%s != NULL) xmlFree(%s->%s);\n" % (
+ args[0][0], args[1][0], args[0][0], args[1][0])
+ c_call = c_call + " %s->%s = xmlStrdup(%s);\n" % (args[0][0],
+ args[1][0], args[1][0])
+ else:
+ c_call = "\n %s->%s = %s;\n" % (args[0][0], args[1][0],
+ args[1][0])
else:
c_call = "\n %s(%s);\n" % (name, c_call);
ret_convert = " Py_INCREF(Py_None);\n return(Py_None);\n"
@@ -519,6 +526,7 @@
"xmlParserCtxtPtr": ("._o", "parserCtxt(_obj=%s)", "parserCtxt"),
"xmlParserCtxt *": ("._o", "parserCtxt(_obj=%s)", "parserCtxt"),
"xmlCatalogPtr": ("._o", "catalog(_obj=%s)", "catalog"),
+ "xmlURIPtr": ("._o", "URI(_obj=%s)", "URI"),
}
converter_type = {
@@ -540,6 +548,7 @@
classes_destructors = {
"parserCtxt": "xmlFreeParserCtxt",
"catalog": "xmlFreeCatalog",
+ "URI": "xmlFreeURI",
}
function_classes = {}
@@ -562,6 +571,12 @@
elif name[0:10] == "xmlNodeGet" and file == "python_accessor":
func = name[10:]
func = string.lower(func[0:1]) + func[1:]
+ elif name[0:9] == "xmlURIGet" and file == "python_accessor":
+ func = name[9:]
+ func = string.lower(func[0:1]) + func[1:]
+ elif name[0:9] == "xmlURISet" and file == "python_accessor":
+ func = name[6:]
+ func = string.lower(func[0:1]) + func[1:]
elif name[0:17] == "xmlXPathParserGet" and file == "python_accessor":
func = name[17:]
func = string.lower(func[0:1]) + func[1:]