summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2004-03-25 06:59:32 +0000
committerMike Hommey <mh@glandium.org>2004-03-25 06:59:32 +0000
commitd09ab089457ae3c20cc98f9afa03379c6ebf9598 (patch)
treef34702d634972abbc1b478a4529149b548a1cd4c /python
downloadlibxml2-d09ab089457ae3c20cc98f9afa03379c6ebf9598.tar.gz
[svn-inject] Installing original source versionupstream/2.6.8
Diffstat (limited to 'python')
-rw-r--r--python/Makefile.am73
-rw-r--r--python/Makefile.in709
-rw-r--r--python/README34
-rw-r--r--python/TODO57
-rw-r--r--python/drv_libxml2.py370
-rwxr-xr-xpython/generator.py1184
-rw-r--r--python/libxml.c3230
-rw-r--r--python/libxml.py628
-rw-r--r--python/libxml2-py.c12873
-rw-r--r--python/libxml2-python-api.xml310
-rw-r--r--python/libxml_wrap.h205
-rwxr-xr-xpython/setup.py242
-rwxr-xr-xpython/setup.py.in242
-rw-r--r--python/tests/Makefile.am60
-rw-r--r--python/tests/Makefile.in459
-rwxr-xr-xpython/tests/attribs.py34
-rwxr-xr-xpython/tests/build.py59
-rwxr-xr-xpython/tests/ctxterror.py56
-rwxr-xr-xpython/tests/cutnpaste.py48
-rwxr-xr-xpython/tests/error.py51
-rwxr-xr-xpython/tests/inbuf.py25
-rwxr-xr-xpython/tests/indexes.py113
-rw-r--r--python/tests/invalid.xml6
-rwxr-xr-xpython/tests/outbuf.py33
-rwxr-xr-xpython/tests/push.py35
-rwxr-xr-xpython/tests/pushSAX.py64
-rwxr-xr-xpython/tests/pushSAXhtml.py65
-rwxr-xr-xpython/tests/reader.py441
-rwxr-xr-xpython/tests/reader2.py256
-rwxr-xr-xpython/tests/reader3.py155
-rwxr-xr-xpython/tests/reader4.py45
-rwxr-xr-xpython/tests/reader5.py48
-rwxr-xr-xpython/tests/reader6.py123
-rwxr-xr-xpython/tests/reader7.py102
-rw-r--r--python/tests/readererr.py51
-rw-r--r--python/tests/regexp.py32
-rwxr-xr-xpython/tests/relaxng.py48
-rwxr-xr-xpython/tests/resolver.py39
-rwxr-xr-xpython/tests/serialize.py150
-rwxr-xr-xpython/tests/thread2.py96
-rwxr-xr-xpython/tests/tst.py28
-rw-r--r--python/tests/tst.xml1
-rwxr-xr-xpython/tests/tstLastError.py72
-rwxr-xr-xpython/tests/tstURI.py41
-rwxr-xr-xpython/tests/tstxpath.py63
-rw-r--r--python/tests/valid.xml4
-rwxr-xr-xpython/tests/validate.py82
-rwxr-xr-xpython/tests/walker.py145
-rwxr-xr-xpython/tests/xpath.py51
-rwxr-xr-xpython/tests/xpathext.py49
-rwxr-xr-xpython/tests/xpathret.py57
-rw-r--r--python/types.c661
52 files changed, 24105 insertions, 0 deletions
diff --git a/python/Makefile.am b/python/Makefile.am
new file mode 100644
index 0000000..8782efb
--- /dev/null
+++ b/python/Makefile.am
@@ -0,0 +1,73 @@
+# Makefile for libxml2 python library
+AUTOMAKE_OPTIONS = 1.4 foreign
+
+SUBDIRS= . tests
+
+INCLUDES = \
+ -I$(PYTHON_INCLUDES) \
+ -I$(top_srcdir)/include
+
+DOCS_DIR = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)
+# libxml2class.txt is generated
+DOCS = ${srcdir}/TODO
+
+EXTRA_DIST = \
+ libxml.c \
+ types.c \
+ setup.py \
+ setup.py.in \
+ generator.py \
+ libxml_wrap.h \
+ libxml.py \
+ drv_libxml2.py \
+ libxml2-python-api.xml \
+ $(DOCS)
+
+libxml2mod_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/.libs
+
+if WITH_PYTHON
+mylibs = \
+ $(top_builddir)/libxml2.la
+
+all-local: libxml2.py
+
+python_LTLIBRARIES = libxml2mod.la
+
+libxml2mod_la_SOURCES = libxml.c types.c libxml2-py.c
+libxml2mod_la_LIBADD = $(mylibs)
+
+libxml2.py: $(srcdir)/libxml.py $(srcdir)/libxml2class.py
+ cat $(srcdir)/libxml.py $(srcdir)/libxml2class.py > libxml2.py
+
+install-data-local:
+ $(mkinstalldirs) $(DESTDIR)$(pythondir)
+ @INSTALL@ -m 0644 libxml2.py $(DESTDIR)$(pythondir)
+ @INSTALL@ -m 0644 $(srcdir)/drv_libxml2.py $(DESTDIR)$(pythondir)
+ $(mkinstalldirs) $(DESTDIR)$(DOCS_DIR)
+ @(for doc in $(DOCS) ; \
+ do @INSTALL@ -m 0644 $$doc $(DESTDIR)$(DOCS_DIR) ; done)
+
+GENERATE = generator.py
+API_DESC = $(top_srcdir)/doc/libxml2-api.xml $(srcdir)/libxml2-python-api.xml
+GENERATED= $(srcdir)/libxml2class.py \
+ $(srcdir)/libxml2-export.c \
+ $(srcdir)/libxml2-py.c \
+ $(srcdir)/libxml2-py.h
+
+$(GENERATED): gen_prog
+
+gen_prog: $(srcdir)/$(GENERATE) $(API_DESC)
+ cd $(srcdir) && $(PYTHON) $(GENERATE)
+ touch gen_prog
+
+$(libxml2mod_la_OBJECTS): $(GENERATED)
+
+else
+all:
+endif
+tests test: all
+ cd tests && $(MAKE) tests
+
+clean:
+ rm -f $(GENERATED) *.o _libxml.so *.pyc libxml2.py gen_prog
+
diff --git a/python/Makefile.in b/python/Makefile.in
new file mode 100644
index 0000000..c6684bd
--- /dev/null
+++ b/python/Makefile.in
@@ -0,0 +1,709 @@
+# Makefile.in generated by automake 1.8.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SOURCES = $(libxml2mod_la_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = @host@
+subdir = python
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/setup.py.in TODO
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = setup.py
+am__installdirs = $(DESTDIR)$(pythondir)
+pythonLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(python_LTLIBRARIES)
+@WITH_PYTHON_TRUE@am__DEPENDENCIES_1 = $(top_builddir)/libxml2.la
+@WITH_PYTHON_TRUE@libxml2mod_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am__libxml2mod_la_SOURCES_DIST = libxml.c types.c libxml2-py.c
+@WITH_PYTHON_TRUE@am_libxml2mod_la_OBJECTS = libxml.lo types.lo \
+@WITH_PYTHON_TRUE@ libxml2-py.lo
+libxml2mod_la_OBJECTS = $(am_libxml2mod_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/libxml.Plo \
+@AMDEP_TRUE@ ./$(DEPDIR)/libxml2-py.Plo ./$(DEPDIR)/types.Plo
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libxml2mod_la_SOURCES)
+DIST_SOURCES = $(am__libxml2mod_la_SOURCES_DIST)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+C14N_OBJ = @C14N_OBJ@
+CATALOG_OBJ = @CATALOG_OBJ@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG_OBJ = @DEBUG_OBJ@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOCB_OBJ = @DOCB_OBJ@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FTP_OBJ = @FTP_OBJ@
+HAVE_ISINF = @HAVE_ISINF@
+HAVE_ISNAN = @HAVE_ISNAN@
+HTML_DIR = @HTML_DIR@
+HTML_OBJ = @HTML_OBJ@
+HTTP_OBJ = @HTTP_OBJ@
+ICONV_LIBS = @ICONV_LIBS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBXML_MAJOR_VERSION = @LIBXML_MAJOR_VERSION@
+LIBXML_MICRO_VERSION = @LIBXML_MICRO_VERSION@
+LIBXML_MINOR_VERSION = @LIBXML_MINOR_VERSION@
+LIBXML_VERSION = @LIBXML_VERSION@
+LIBXML_VERSION_INFO = @LIBXML_VERSION_INFO@
+LIBXML_VERSION_NUMBER = @LIBXML_VERSION_NUMBER@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MV = @MV@
+M_LIBS = @M_LIBS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATTERN_TEST = @PATTERN_TEST@
+PYTHON = @PYTHON@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_SITE_PACKAGES = @PYTHON_SITE_PACKAGES@
+PYTHON_SUBDIR = @PYTHON_SUBDIR@
+PYTHON_TESTS = @PYTHON_TESTS@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RDL_LIBS = @RDL_LIBS@
+READER_TEST = @READER_TEST@
+RELDATE = @RELDATE@
+RM = @RM@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STATIC_BINARIES = @STATIC_BINARIES@
+STRIP = @STRIP@
+TAR = @TAR@
+TEST_C14N = @TEST_C14N@
+TEST_CATALOG = @TEST_CATALOG@
+TEST_DEBUG = @TEST_DEBUG@
+TEST_HTML = @TEST_HTML@
+TEST_PHTML = @TEST_PHTML@
+TEST_PUSH = @TEST_PUSH@
+TEST_REGEXPS = @TEST_REGEXPS@
+TEST_SAX = @TEST_SAX@
+TEST_SCHEMAS = @TEST_SCHEMAS@
+TEST_THREADS = @TEST_THREADS@
+TEST_VALID = @TEST_VALID@
+TEST_VTIME = @TEST_VTIME@
+TEST_XINCLUDE = @TEST_XINCLUDE@
+TEST_XPATH = @TEST_XPATH@
+TEST_XPTR = @TEST_XPTR@
+THREADS_W32 = @THREADS_W32@
+THREAD_CFLAGS = @THREAD_CFLAGS@
+THREAD_LIBS = @THREAD_LIBS@
+U = @U@
+VERSION = @VERSION@
+WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@
+WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@
+WITH_C14N = @WITH_C14N@
+WITH_CATALOG = @WITH_CATALOG@
+WITH_DEBUG = @WITH_DEBUG@
+WITH_DOCB = @WITH_DOCB@
+WITH_FTP = @WITH_FTP@
+WITH_HTML = @WITH_HTML@
+WITH_HTTP = @WITH_HTTP@
+WITH_ICONV = @WITH_ICONV@
+WITH_ISO8859X = @WITH_ISO8859X@
+WITH_LEGACY = @WITH_LEGACY@
+WITH_MEM_DEBUG = @WITH_MEM_DEBUG@
+WITH_OUTPUT = @WITH_OUTPUT@
+WITH_PATTERN = @WITH_PATTERN@
+WITH_PUSH = @WITH_PUSH@
+WITH_PYTHON_FALSE = @WITH_PYTHON_FALSE@
+WITH_PYTHON_TRUE = @WITH_PYTHON_TRUE@
+WITH_READER = @WITH_READER@
+WITH_REGEXPS = @WITH_REGEXPS@
+WITH_SAX1 = @WITH_SAX1@
+WITH_SCHEMAS = @WITH_SCHEMAS@
+WITH_THREADS = @WITH_THREADS@
+WITH_TREE = @WITH_TREE@
+WITH_TRIO = @WITH_TRIO@
+WITH_TRIO_SOURCES_FALSE = @WITH_TRIO_SOURCES_FALSE@
+WITH_TRIO_SOURCES_TRUE = @WITH_TRIO_SOURCES_TRUE@
+WITH_VALID = @WITH_VALID@
+WITH_WRITER = @WITH_WRITER@
+WITH_XINCLUDE = @WITH_XINCLUDE@
+WITH_XPATH = @WITH_XPATH@
+WITH_XPTR = @WITH_XPTR@
+XINCLUDE_OBJ = @XINCLUDE_OBJ@
+XML_CFLAGS = @XML_CFLAGS@
+XML_INCLUDEDIR = @XML_INCLUDEDIR@
+XML_LIBDIR = @XML_LIBDIR@
+XML_LIBS = @XML_LIBS@
+XML_LIBTOOLLIBS = @XML_LIBTOOLLIBS@
+XPATH_OBJ = @XPATH_OBJ@
+XPTR_OBJ = @XPTR_OBJ@
+Z_CFLAGS = @Z_CFLAGS@
+Z_LIBS = @Z_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+
+# Makefile for libxml2 python library
+AUTOMAKE_OPTIONS = 1.4 foreign
+SUBDIRS = . tests
+INCLUDES = \
+ -I$(PYTHON_INCLUDES) \
+ -I$(top_srcdir)/include
+
+DOCS_DIR = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)
+# libxml2class.txt is generated
+DOCS = ${srcdir}/TODO
+EXTRA_DIST = \
+ libxml.c \
+ types.c \
+ setup.py \
+ setup.py.in \
+ generator.py \
+ libxml_wrap.h \
+ libxml.py \
+ drv_libxml2.py \
+ libxml2-python-api.xml \
+ $(DOCS)
+
+libxml2mod_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/.libs
+@WITH_PYTHON_TRUE@mylibs = \
+@WITH_PYTHON_TRUE@ $(top_builddir)/libxml2.la
+
+@WITH_PYTHON_TRUE@python_LTLIBRARIES = libxml2mod.la
+@WITH_PYTHON_TRUE@libxml2mod_la_SOURCES = libxml.c types.c libxml2-py.c
+@WITH_PYTHON_TRUE@libxml2mod_la_LIBADD = $(mylibs)
+@WITH_PYTHON_TRUE@GENERATE = generator.py
+@WITH_PYTHON_TRUE@API_DESC = $(top_srcdir)/doc/libxml2-api.xml $(srcdir)/libxml2-python-api.xml
+@WITH_PYTHON_TRUE@GENERATED = $(srcdir)/libxml2class.py \
+@WITH_PYTHON_TRUE@ $(srcdir)/libxml2-export.c \
+@WITH_PYTHON_TRUE@ $(srcdir)/libxml2-py.c \
+@WITH_PYTHON_TRUE@ $(srcdir)/libxml2-py.h
+
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign python/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign python/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+setup.py: $(top_builddir)/config.status $(srcdir)/setup.py.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-pythonLTLIBRARIES: $(python_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ $(mkdir_p) $(DESTDIR)$(pythondir)
+ @list='$(python_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=install $(pythonLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(pythondir)/$$f"; \
+ $(LIBTOOL) --mode=install $(pythonLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(pythondir)/$$f; \
+ else :; fi; \
+ done
+
+uninstall-pythonLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(python_LTLIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(pythondir)/$$p"; \
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(pythondir)/$$p; \
+ done
+
+clean-pythonLTLIBRARIES:
+ -test -z "$(python_LTLIBRARIES)" || rm -f $(python_LTLIBRARIES)
+ @list='$(python_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" = "$$p" && dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libxml2mod.la: $(libxml2mod_la_OBJECTS) $(libxml2mod_la_DEPENDENCIES)
+ $(LINK) -rpath $(pythondir) $(libxml2mod_la_LDFLAGS) $(libxml2mod_la_OBJECTS) $(libxml2mod_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxml.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxml2-py.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/types.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if (etags --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ else \
+ include_option=--include; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ $(mkdir_p) $(distdir)/${srcdir}
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES) all-local
+installdirs: installdirs-recursive
+installdirs-am:
+ $(mkdir_p) $(DESTDIR)$(pythondir)
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean-am: clean-generic clean-libtool clean-pythonLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-data-local install-pythonLTLIBRARIES
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-pythonLTLIBRARIES
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am all-local check \
+ check-am clean clean-generic clean-libtool \
+ clean-pythonLTLIBRARIES clean-recursive ctags ctags-recursive \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-recursive distclean-tags distdir \
+ dvi dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-data-local install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-pythonLTLIBRARIES install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am uninstall-info-am \
+ uninstall-pythonLTLIBRARIES
+
+
+@WITH_PYTHON_TRUE@all-local: libxml2.py
+
+@WITH_PYTHON_TRUE@libxml2.py: $(srcdir)/libxml.py $(srcdir)/libxml2class.py
+@WITH_PYTHON_TRUE@ cat $(srcdir)/libxml.py $(srcdir)/libxml2class.py > libxml2.py
+
+@WITH_PYTHON_TRUE@install-data-local:
+@WITH_PYTHON_TRUE@ $(mkinstalldirs) $(DESTDIR)$(pythondir)
+@WITH_PYTHON_TRUE@ @INSTALL@ -m 0644 libxml2.py $(DESTDIR)$(pythondir)
+@WITH_PYTHON_TRUE@ @INSTALL@ -m 0644 $(srcdir)/drv_libxml2.py $(DESTDIR)$(pythondir)
+@WITH_PYTHON_TRUE@ $(mkinstalldirs) $(DESTDIR)$(DOCS_DIR)
+@WITH_PYTHON_TRUE@ @(for doc in $(DOCS) ; \
+@WITH_PYTHON_TRUE@ do @INSTALL@ -m 0644 $$doc $(DESTDIR)$(DOCS_DIR) ; done)
+
+@WITH_PYTHON_TRUE@$(GENERATED): gen_prog
+
+@WITH_PYTHON_TRUE@gen_prog: $(srcdir)/$(GENERATE) $(API_DESC)
+@WITH_PYTHON_TRUE@ cd $(srcdir) && $(PYTHON) $(GENERATE)
+@WITH_PYTHON_TRUE@ touch gen_prog
+
+@WITH_PYTHON_TRUE@$(libxml2mod_la_OBJECTS): $(GENERATED)
+
+@WITH_PYTHON_FALSE@all:
+tests test: all
+ cd tests && $(MAKE) tests
+
+clean:
+ rm -f $(GENERATED) *.o _libxml.so *.pyc libxml2.py gen_prog
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/python/README b/python/README
new file mode 100644
index 0000000..b46eee4
--- /dev/null
+++ b/python/README
@@ -0,0 +1,34 @@
+ Module libxml2-python
+ =====================
+
+This is the libxml2 python module, providing access to the
+libxml2 and libxslt (if available) libraries. For general
+informationss on those XML and XSLT libraries check their
+web pages at :
+ http://xmlsoft.org/
+ and
+ http://xmlsoft.org/XSLT/
+
+The latest version of the sources for this module and the
+associated libraries can be found at:
+ ftp://xmlsoft.org/
+
+Binaries packages of the libxml2 and libxslt libraries can
+be found either on the FTP site for Linux, from external
+sources linked from the web pages, or as part of your set of
+packages provided with your operating system.
+
+NOTE:
+this module distribution is not the primary distribution
+of the libxml2 and libxslt Python binding code, but as
+the Python way of packaging those for non-Linux systems.
+The main sources are the libxml2 and libxslt tar.gz found on
+the site. One side effect is that the official RPM packages for
+those modules are not generated from the libxml2-python
+distributions but as part of the normal RPM packaging of
+those two libraries.
+The RPM packages can be found at:
+ http://rpmfind.net/linux/rpm2html/search.php?query=libxml2-python
+ http://rpmfind.net/linux/rpm2html/search.php?query=libxslt-python
+
+Daniel Veillard
diff --git a/python/TODO b/python/TODO
new file mode 100644
index 0000000..ae3e74d
--- /dev/null
+++ b/python/TODO
@@ -0,0 +1,57 @@
+ TODO for the libxml2 Python wrappers
+
+ $Id: TODO,v 1.8 2002/02/06 16:06:57 veillard Exp $
+
+Things to do:
+-------------
+
+- SAX interfaces
+ - push is done but no generic interface
+ - elementDecl need some work
+ - need more testing and check full callbacks for xmllib/sgmlop replacement
+- enums -> libxml.py
+- access to XPath variables
+- xmlBuffer exposure
+- xpathContext, being able to set/get info and clean it up
+- more work needed on context handling for function lookup
+ and use of an hash table.
+- add regression tests
+ - SAX flow
+- DTD element and attributes content accesses
+ - attribute handled in SAX
+ - element needed in both
+
+
+Done:
+-----
+- class hierarchy:
+ + make specific node type inherit from xmlNode
+ done, had to sort the classes in the output
+ + get the generator to output a classes.txt description
+ done libxml2class.txt
+- add regression tests
+ - tests/Makefile.am: export the Python class path
+ - xpath queries
+ - xpath extension
+ - check memory
+ - build tree
+ - saving
+- extensions based on a python.xml description of the new specific
+ interfaces
+ file libxml2-python-api.xml , first entry is xmlRegisterXPathFunction
+- spec file: automatically generate for pythonX.Y if found
+ Done, a bit ugly by running new makes in %install for each level
+ found.
+- error redirections and preformat
+- handling of node.content
+- access to xmlParserCtxt and push mode
+ - needed for SAX too
+ - entry points
+ - wrappers
+ - decent interface for setting/getting behaviour
+- memory debug interfaces
+- SAX interfaces
+ - basic stuff with push is available
+ - basic xmllib replacement
+
+Daniel Veillard
diff --git a/python/drv_libxml2.py b/python/drv_libxml2.py
new file mode 100644
index 0000000..977c868
--- /dev/null
+++ b/python/drv_libxml2.py
@@ -0,0 +1,370 @@
+""" A SAX2 driver for libxml2, on top of it's XmlReader API
+
+USAGE
+ # put this file (drv_libxml2.py) in PYTHONPATH
+ import xml.sax
+ reader = xml.sax.make_parser(["drv_libxml2"])
+ # ...and the rest is standard python sax.
+
+CAVEATS
+ - Lexical handlers are supported, except for start/endEntity
+ (waiting for XmlReader.ResolveEntity) and start/endDTD
+ - Error callbacks are not exactly synchronous, they tend
+ to be invoked before the corresponding content callback,
+ because the underlying reader interface parses
+ data by chunks of 512 bytes
+
+TODO
+ - search for TODO
+ - some ErrorHandler events (warning)
+ - some ContentHandler events (setDocumentLocator, skippedEntity)
+ - EntityResolver (using libxml2.?)
+ - DTDHandler (if/when libxml2 exposes such node types)
+ - DeclHandler (if/when libxml2 exposes such node types)
+ - property_xml_string?
+ - feature_string_interning?
+ - Incremental parser
+ - additional performance tuning:
+ - one might cache callbacks to avoid some name lookups
+ - one might implement a smarter way to pass attributes to startElement
+ (some kind of lazy evaluation?)
+ - there might be room for improvement in start/endPrefixMapping
+ - other?
+
+"""
+
+__author__ = u"Stéphane Bidoul <sbi@skynet.be>"
+__version__ = "0.3"
+
+import codecs
+import sys
+from types import StringType, UnicodeType
+StringTypes = (StringType,UnicodeType)
+
+from xml.sax._exceptions import *
+from xml.sax import xmlreader, saxutils
+from xml.sax.handler import \
+ feature_namespaces, \
+ feature_namespace_prefixes, \
+ feature_string_interning, \
+ feature_validation, \
+ feature_external_ges, \
+ feature_external_pes, \
+ property_lexical_handler, \
+ property_declaration_handler, \
+ property_dom_node, \
+ property_xml_string
+
+# libxml2 returns strings as UTF8
+_decoder = codecs.lookup("utf8")[1]
+def _d(s):
+ if s is None:
+ return s
+ else:
+ return _decoder(s)[0]
+
+try:
+ import libxml2
+except ImportError, e:
+ raise SAXReaderNotAvailable("libxml2 not available: " \
+ "import error was: %s" % e)
+
+class Locator(xmlreader.Locator):
+ """SAX Locator adapter for libxml2.xmlTextReaderLocator"""
+
+ def __init__(self,locator):
+ self.__locator = locator
+
+ def getColumnNumber(self):
+ "Return the column number where the current event ends."
+ return -1
+
+ def getLineNumber(self):
+ "Return the line number where the current event ends."
+ return self.__locator.LineNumber()
+
+ def getPublicId(self):
+ "Return the public identifier for the current event."
+ return None
+
+ def getSystemId(self):
+ "Return the system identifier for the current event."
+ return self.__locator.BaseURI()
+
+class LibXml2Reader(xmlreader.XMLReader):
+
+ def __init__(self):
+ xmlreader.XMLReader.__init__(self)
+ # features
+ self.__ns = 0
+ self.__nspfx = 0
+ self.__validate = 0
+ # parsing flag
+ self.__parsing = 0
+ # additional handlers
+ self.__lex_handler = None
+ self.__decl_handler = None
+ # error messages accumulator
+ self.__errors = None
+
+ def _errorHandler(self,arg,msg,severity,locator):
+ if self.__errors is None:
+ self.__errors = []
+ self.__errors.append((severity,
+ SAXParseException(msg,None,
+ Locator(locator))))
+
+ def _reportErrors(self,fatal):
+ for severity,exception in self.__errors:
+ if severity in (libxml2.PARSER_SEVERITY_VALIDITY_WARNING,
+ libxml2.PARSER_SEVERITY_WARNING):
+ self._err_handler.warning(exception)
+ else:
+ # when fatal is set, the parse will stop;
+ # we consider that the last error reported
+ # is the fatal one.
+ if fatal and exception is self.__errors[-1][1]:
+ self._err_handler.fatalError(exception)
+ else:
+ self._err_handler.error(exception)
+ self.__errors = None
+
+ def parse(self, source):
+ self.__parsing = 1
+ try:
+ # prepare source and create reader
+ if type(source) in StringTypes:
+ reader = libxml2.newTextReaderFilename(source)
+ else:
+ source = saxutils.prepare_input_source(source)
+ input = libxml2.inputBuffer(source.getByteStream())
+ reader = input.newTextReader(source.getSystemId())
+ reader.SetErrorHandler(self._errorHandler,None)
+ # configure reader
+ reader.SetParserProp(libxml2.PARSER_LOADDTD,1)
+ reader.SetParserProp(libxml2.PARSER_DEFAULTATTRS,1)
+ reader.SetParserProp(libxml2.PARSER_SUBST_ENTITIES,1)
+ reader.SetParserProp(libxml2.PARSER_VALIDATE,self.__validate)
+ # we reuse attribute maps (for a slight performance gain)
+ if self.__ns:
+ attributesNSImpl = xmlreader.AttributesNSImpl({},{})
+ else:
+ attributesImpl = xmlreader.AttributesImpl({})
+ # prefixes to pop (for endPrefixMapping)
+ prefixes = []
+ # start loop
+ self._cont_handler.startDocument()
+ while 1:
+ r = reader.Read()
+ # check for errors
+ if r == 1:
+ if not self.__errors is None:
+ self._reportErrors(0)
+ elif r == 0:
+ if not self.__errors is None:
+ self._reportErrors(0)
+ break # end of parse
+ else:
+ if not self.__errors is None:
+ self._reportErrors(1)
+ else:
+ self._err_handler.fatalError(\
+ SAXException("Read failed (no details available)"))
+ break # fatal parse error
+ # get node type
+ nodeType = reader.NodeType()
+ # Element
+ if nodeType == 1:
+ if self.__ns:
+ eltName = (_d(reader.NamespaceUri()),\
+ _d(reader.LocalName()))
+ eltQName = _d(reader.Name())
+ attributesNSImpl._attrs = attrs = {}
+ attributesNSImpl._qnames = qnames = {}
+ newPrefixes = []
+ while reader.MoveToNextAttribute():
+ qname = _d(reader.Name())
+ value = _d(reader.Value())
+ if qname.startswith("xmlns"):
+ if len(qname) > 5:
+ newPrefix = qname[6:]
+ else:
+ newPrefix = None
+ newPrefixes.append(newPrefix)
+ self._cont_handler.startPrefixMapping(\
+ newPrefix,value)
+ if not self.__nspfx:
+ continue # don't report xmlns attribute
+ attName = (_d(reader.NamespaceUri()),
+ _d(reader.LocalName()))
+ qnames[attName] = qname
+ attrs[attName] = value
+ reader.MoveToElement()
+ self._cont_handler.startElementNS( \
+ eltName,eltQName,attributesNSImpl)
+ if reader.IsEmptyElement():
+ self._cont_handler.endElementNS(eltName,eltQName)
+ for newPrefix in newPrefixes:
+ self._cont_handler.endPrefixMapping(newPrefix)
+ else:
+ prefixes.append(newPrefixes)
+ else:
+ eltName = _d(reader.Name())
+ attributesImpl._attrs = attrs = {}
+ while reader.MoveToNextAttribute():
+ attName = _d(reader.Name())
+ attrs[attName] = _d(reader.Value())
+ reader.MoveToElement()
+ self._cont_handler.startElement( \
+ eltName,attributesImpl)
+ if reader.IsEmptyElement():
+ self._cont_handler.endElement(eltName)
+ # EndElement
+ elif nodeType == 15:
+ if self.__ns:
+ self._cont_handler.endElementNS( \
+ (_d(reader.NamespaceUri()),_d(reader.LocalName())),
+ _d(reader.Name()))
+ for prefix in prefixes.pop():
+ self._cont_handler.endPrefixMapping(prefix)
+ else:
+ self._cont_handler.endElement(_d(reader.Name()))
+ # Text
+ elif nodeType == 3:
+ self._cont_handler.characters(_d(reader.Value()))
+ # Whitespace
+ elif nodeType == 13:
+ self._cont_handler.ignorableWhitespace(_d(reader.Value()))
+ # SignificantWhitespace
+ elif nodeType == 14:
+ self._cont_handler.characters(_d(reader.Value()))
+ # CDATA
+ elif nodeType == 4:
+ if not self.__lex_handler is None:
+ self.__lex_handler.startCDATA()
+ self._cont_handler.characters(_d(reader.Value()))
+ if not self.__lex_handler is None:
+ self.__lex_handler.endCDATA()
+ # EntityReference
+ elif nodeType == 5:
+ if not self.__lex_handler is None:
+ self.startEntity(_d(reader.Name()))
+ reader.ResolveEntity()
+ # EndEntity
+ elif nodeType == 16:
+ if not self.__lex_handler is None:
+ self.endEntity(_d(reader.Name()))
+ # ProcessingInstruction
+ elif nodeType == 7:
+ self._cont_handler.processingInstruction( \
+ _d(reader.Name()),_d(reader.Value()))
+ # Comment
+ elif nodeType == 8:
+ if not self.__lex_handler is None:
+ self.__lex_handler.comment(_d(reader.Value()))
+ # DocumentType
+ elif nodeType == 10:
+ #if not self.__lex_handler is None:
+ # self.__lex_handler.startDTD()
+ pass # TODO (how to detect endDTD? on first non-dtd event?)
+ # XmlDeclaration
+ elif nodeType == 17:
+ pass # TODO
+ # Entity
+ elif nodeType == 6:
+ pass # TODO (entity decl)
+ # Notation (decl)
+ elif nodeType == 12:
+ pass # TODO
+ # Attribute (never in this loop)
+ #elif nodeType == 2:
+ # pass
+ # Document (not exposed)
+ #elif nodeType == 9:
+ # pass
+ # DocumentFragment (never returned by XmlReader)
+ #elif nodeType == 11:
+ # pass
+ # None
+ #elif nodeType == 0:
+ # pass
+ # -
+ else:
+ raise SAXException("Unexpected node type %d" % nodeType)
+ if r == 0:
+ self._cont_handler.endDocument()
+ reader.Close()
+ finally:
+ self.__parsing = 0
+
+ def setDTDHandler(self, handler):
+ # TODO (when supported, the inherited method works just fine)
+ raise SAXNotSupportedException("DTDHandler not supported")
+
+ def setEntityResolver(self, resolver):
+ # TODO (when supported, the inherited method works just fine)
+ raise SAXNotSupportedException("EntityResolver not supported")
+
+ def getFeature(self, name):
+ if name == feature_namespaces:
+ return self.__ns
+ elif name == feature_namespace_prefixes:
+ return self.__nspfx
+ elif name == feature_validation:
+ return self.__validate
+ elif name == feature_external_ges:
+ return 1 # TODO (does that relate to PARSER_LOADDTD)?
+ elif name == feature_external_pes:
+ return 1 # TODO (does that relate to PARSER_LOADDTD)?
+ else:
+ raise SAXNotRecognizedException("Feature '%s' not recognized" % \
+ name)
+
+ def setFeature(self, name, state):
+ if self.__parsing:
+ raise SAXNotSupportedException("Cannot set feature %s " \
+ "while parsing" % name)
+ if name == feature_namespaces:
+ self.__ns = state
+ elif name == feature_namespace_prefixes:
+ self.__nspfx = state
+ elif name == feature_validation:
+ self.__validate = state
+ elif name == feature_external_ges:
+ if state == 0:
+ # TODO (does that relate to PARSER_LOADDTD)?
+ raise SAXNotSupportedException("Feature '%s' not supported" % \
+ name)
+ elif name == feature_external_pes:
+ if state == 0:
+ # TODO (does that relate to PARSER_LOADDTD)?
+ raise SAXNotSupportedException("Feature '%s' not supported" % \
+ name)
+ else:
+ raise SAXNotRecognizedException("Feature '%s' not recognized" % \
+ name)
+
+ def getProperty(self, name):
+ if name == property_lexical_handler:
+ return self.__lex_handler
+ elif name == property_declaration_handler:
+ return self.__decl_handler
+ else:
+ raise SAXNotRecognizedException("Property '%s' not recognized" % \
+ name)
+
+ def setProperty(self, name, value):
+ if name == property_lexical_handler:
+ self.__lex_handler = value
+ elif name == property_declaration_handler:
+ # TODO: remove if/when libxml2 supports dtd events
+ raise SAXNotSupportedException("Property '%s' not supported" % \
+ name)
+ self.__decl_handler = value
+ else:
+ raise SAXNotRecognizedException("Property '%s' not recognized" % \
+ name)
+
+def create_parser():
+ return LibXml2Reader()
+
diff --git a/python/generator.py b/python/generator.py
new file mode 100755
index 0000000..0891eed
--- /dev/null
+++ b/python/generator.py
@@ -0,0 +1,1184 @@
+#!/usr/bin/python -u
+#
+# generate python wrappers from the XML API description
+#
+
+functions = {}
+enums = {} # { enumType: { enumConstant: enumValue } }
+
+import sys
+import string
+
+#######################################################################
+#
+# That part if purely the API acquisition phase from the
+# XML API description
+#
+#######################################################################
+import os
+import xmllib
+try:
+ import sgmlop
+except ImportError:
+ sgmlop = None # accelerator not available
+
+debug = 0
+
+if sgmlop:
+ class FastParser:
+ """sgmlop based XML parser. this is typically 15x faster
+ than SlowParser..."""
+
+ def __init__(self, target):
+
+ # setup callbacks
+ self.finish_starttag = target.start
+ self.finish_endtag = target.end
+ self.handle_data = target.data
+
+ # activate parser
+ self.parser = sgmlop.XMLParser()
+ self.parser.register(self)
+ self.feed = self.parser.feed
+ self.entity = {
+ "amp": "&", "gt": ">", "lt": "<",
+ "apos": "'", "quot": '"'
+ }
+
+ def close(self):
+ try:
+ self.parser.close()
+ finally:
+ self.parser = self.feed = None # nuke circular reference
+
+ def handle_entityref(self, entity):
+ # <string> entity
+ try:
+ self.handle_data(self.entity[entity])
+ except KeyError:
+ self.handle_data("&%s;" % entity)
+
+else:
+ FastParser = None
+
+
+class SlowParser(xmllib.XMLParser):
+ """slow but safe standard parser, based on the XML parser in
+ Python's standard library."""
+
+ def __init__(self, target):
+ self.unknown_starttag = target.start
+ self.handle_data = target.data
+ self.unknown_endtag = target.end
+ xmllib.XMLParser.__init__(self)
+
+def getparser(target = None):
+ # get the fastest available parser, and attach it to an
+ # unmarshalling object. return both objects.
+ if target is None:
+ target = docParser()
+ if FastParser:
+ return FastParser(target), target
+ return SlowParser(target), target
+
+class docParser:
+ def __init__(self):
+ self._methodname = None
+ self._data = []
+ self.in_function = 0
+
+ def close(self):
+ if debug:
+ print "close"
+
+ def getmethodname(self):
+ return self._methodname
+
+ def data(self, text):
+ if debug:
+ print "data %s" % text
+ self._data.append(text)
+
+ def start(self, tag, attrs):
+ if debug:
+ print "start %s, %s" % (tag, attrs)
+ if tag == 'function':
+ self._data = []
+ self.in_function = 1
+ self.function = None
+ self.function_args = []
+ self.function_descr = None
+ self.function_return = None
+ self.function_file = None
+ if attrs.has_key('name'):
+ self.function = attrs['name']
+ if attrs.has_key('file'):
+ self.function_file = attrs['file']
+ elif tag == 'info':
+ self._data = []
+ elif tag == 'arg':
+ if self.in_function == 1:
+ self.function_arg_name = None
+ self.function_arg_type = None
+ self.function_arg_info = None
+ if attrs.has_key('name'):
+ self.function_arg_name = attrs['name']
+ if attrs.has_key('type'):
+ self.function_arg_type = attrs['type']
+ if attrs.has_key('info'):
+ self.function_arg_info = attrs['info']
+ elif tag == 'return':
+ if self.in_function == 1:
+ self.function_return_type = None
+ self.function_return_info = None
+ self.function_return_field = None
+ if attrs.has_key('type'):
+ self.function_return_type = attrs['type']
+ if attrs.has_key('info'):
+ self.function_return_info = attrs['info']
+ if attrs.has_key('field'):
+ self.function_return_field = attrs['field']
+ elif tag == 'enum':
+ enum(attrs['type'],attrs['name'],attrs['value'])
+
+ def end(self, tag):
+ if debug:
+ print "end %s" % tag
+ if tag == 'function':
+ if self.function != None:
+ function(self.function, self.function_descr,
+ self.function_return, self.function_args,
+ self.function_file)
+ self.in_function = 0
+ elif tag == 'arg':
+ if self.in_function == 1:
+ self.function_args.append([self.function_arg_name,
+ self.function_arg_type,
+ self.function_arg_info])
+ elif tag == 'return':
+ if self.in_function == 1:
+ self.function_return = [self.function_return_type,
+ self.function_return_info,
+ self.function_return_field]
+ elif tag == 'info':
+ str = ''
+ for c in self._data:
+ str = str + c
+ if self.in_function == 1:
+ self.function_descr = str
+
+
+def function(name, desc, ret, args, file):
+ functions[name] = (desc, ret, args, file)
+
+def enum(type, name, value):
+ if not enums.has_key(type):
+ enums[type] = {}
+ enums[type][name] = value
+
+#######################################################################
+#
+# Some filtering rukes to drop functions/types which should not
+# be exposed as-is on the Python interface
+#
+#######################################################################
+
+skipped_modules = {
+ 'xmlmemory': None,
+ 'DOCBparser': None,
+ 'SAX': None,
+ 'hash': None,
+ 'list': None,
+ 'threads': None,
+# 'xpointer': None,
+}
+skipped_types = {
+ 'int *': "usually a return type",
+ 'xmlSAXHandlerPtr': "not the proper interface for SAX",
+ 'htmlSAXHandlerPtr': "not the proper interface for SAX",
+ 'xmlRMutexPtr': "thread specific, skipped",
+ 'xmlMutexPtr': "thread specific, skipped",
+ 'xmlGlobalStatePtr': "thread specific, skipped",
+ 'xmlListPtr': "internal representation not suitable for python",
+ 'xmlBufferPtr': "internal representation not suitable for python",
+ 'FILE *': None,
+}
+
+#######################################################################
+#
+# Table of remapping to/from the python type or class to the C
+# counterpart.
+#
+#######################################################################
+
+py_types = {
+ 'void': (None, None, None, None),
+ 'int': ('i', None, "int", "int"),
+ 'long': ('i', None, "int", "int"),
+ 'double': ('d', None, "double", "double"),
+ 'unsigned int': ('i', None, "int", "int"),
+ 'xmlChar': ('c', None, "int", "int"),
+ 'unsigned char *': ('z', None, "charPtr", "char *"),
+ 'char *': ('z', None, "charPtr", "char *"),
+ 'const char *': ('z', None, "charPtrConst", "const char *"),
+ 'xmlChar *': ('z', None, "xmlCharPtr", "xmlChar *"),
+ 'const xmlChar *': ('z', None, "xmlCharPtrConst", "const xmlChar *"),
+ 'xmlNodePtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'const xmlNodePtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'xmlNode *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'const xmlNode *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'xmlDtdPtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'const xmlDtdPtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'xmlDtd *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'const xmlDtd *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'xmlAttrPtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'const xmlAttrPtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'xmlAttr *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'const xmlAttr *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'xmlEntityPtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'const xmlEntityPtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'xmlEntity *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'const xmlEntity *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'xmlElementPtr': ('O', "xmlElement", "xmlElementPtr", "xmlElementPtr"),
+ 'const xmlElementPtr': ('O', "xmlElement", "xmlElementPtr", "xmlElementPtr"),
+ 'xmlElement *': ('O', "xmlElement", "xmlElementPtr", "xmlElementPtr"),
+ 'const xmlElement *': ('O', "xmlElement", "xmlElementPtr", "xmlElementPtr"),
+ 'xmlAttributePtr': ('O', "xmlAttribute", "xmlAttributePtr", "xmlAttributePtr"),
+ 'const xmlAttributePtr': ('O', "xmlAttribute", "xmlAttributePtr", "xmlAttributePtr"),
+ 'xmlAttribute *': ('O', "xmlAttribute", "xmlAttributePtr", "xmlAttributePtr"),
+ 'const xmlAttribute *': ('O', "xmlAttribute", "xmlAttributePtr", "xmlAttributePtr"),
+ 'xmlNsPtr': ('O', "xmlNode", "xmlNsPtr", "xmlNsPtr"),
+ 'const xmlNsPtr': ('O', "xmlNode", "xmlNsPtr", "xmlNsPtr"),
+ 'xmlNs *': ('O', "xmlNode", "xmlNsPtr", "xmlNsPtr"),
+ 'const xmlNs *': ('O', "xmlNode", "xmlNsPtr", "xmlNsPtr"),
+ 'xmlDocPtr': ('O', "xmlNode", "xmlDocPtr", "xmlDocPtr"),
+ 'const xmlDocPtr': ('O', "xmlNode", "xmlDocPtr", "xmlDocPtr"),
+ 'xmlDoc *': ('O', "xmlNode", "xmlDocPtr", "xmlDocPtr"),
+ 'const xmlDoc *': ('O', "xmlNode", "xmlDocPtr", "xmlDocPtr"),
+ 'htmlDocPtr': ('O', "xmlNode", "xmlDocPtr", "xmlDocPtr"),
+ 'const htmlDocPtr': ('O', "xmlNode", "xmlDocPtr", "xmlDocPtr"),
+ 'htmlDoc *': ('O', "xmlNode", "xmlDocPtr", "xmlDocPtr"),
+ 'const htmlDoc *': ('O', "xmlNode", "xmlDocPtr", "xmlDocPtr"),
+ 'htmlNodePtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'const htmlNodePtr': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'htmlNode *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'const htmlNode *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
+ 'xmlXPathContextPtr': ('O', "xmlXPathContext", "xmlXPathContextPtr", "xmlXPathContextPtr"),
+ 'xmlXPathContext *': ('O', "xpathContext", "xmlXPathContextPtr", "xmlXPathContextPtr"),
+ 'xmlXPathParserContextPtr': ('O', "xmlXPathParserContext", "xmlXPathParserContextPtr", "xmlXPathParserContextPtr"),
+ 'xmlParserCtxtPtr': ('O', "parserCtxt", "xmlParserCtxtPtr", "xmlParserCtxtPtr"),
+ 'xmlParserCtxt *': ('O', "parserCtxt", "xmlParserCtxtPtr", "xmlParserCtxtPtr"),
+ 'htmlParserCtxtPtr': ('O', "parserCtxt", "xmlParserCtxtPtr", "xmlParserCtxtPtr"),
+ 'htmlParserCtxt *': ('O', "parserCtxt", "xmlParserCtxtPtr", "xmlParserCtxtPtr"),
+ 'xmlCatalogPtr': ('O', "catalog", "xmlCatalogPtr", "xmlCatalogPtr"),
+ 'FILE *': ('O', "File", "FILEPtr", "FILE *"),
+ 'xmlURIPtr': ('O', "URI", "xmlURIPtr", "xmlURIPtr"),
+ 'xmlErrorPtr': ('O', "Error", "xmlErrorPtr", "xmlErrorPtr"),
+ 'xmlOutputBufferPtr': ('O', "outputBuffer", "xmlOutputBufferPtr", "xmlOutputBufferPtr"),
+ 'xmlParserInputBufferPtr': ('O', "inputBuffer", "xmlParserInputBufferPtr", "xmlParserInputBufferPtr"),
+ 'xmlRegexpPtr': ('O', "xmlReg", "xmlRegexpPtr", "xmlRegexpPtr"),
+ 'xmlTextReaderLocatorPtr': ('O', "xmlTextReaderLocator", "xmlTextReaderLocatorPtr", "xmlTextReaderLocatorPtr"),
+ 'xmlTextReaderPtr': ('O', "xmlTextReader", "xmlTextReaderPtr", "xmlTextReaderPtr"),
+ 'xmlRelaxNGPtr': ('O', "relaxNgSchema", "xmlRelaxNGPtr", "xmlRelaxNGPtr"),
+ 'xmlRelaxNGParserCtxtPtr': ('O', "relaxNgParserCtxt", "xmlRelaxNGParserCtxtPtr", "xmlRelaxNGParserCtxtPtr"),
+ 'xmlRelaxNGValidCtxtPtr': ('O', "relaxNgValidCtxt", "xmlRelaxNGValidCtxtPtr", "xmlRelaxNGValidCtxtPtr"),
+}
+
+py_return_types = {
+ 'xmlXPathObjectPtr': ('O', "foo", "xmlXPathObjectPtr", "xmlXPathObjectPtr"),
+}
+
+unknown_types = {}
+
+#######################################################################
+#
+# This part writes the C <-> Python stubs libxml2-py.[ch] and
+# the table libxml2-export.c to add when registrering the Python module
+#
+#######################################################################
+
+def skip_function(name):
+ if name[0:12] == "xmlXPathWrap":
+ return 1
+ if name == "xmlFreeParserCtxt":
+ return 1
+ if name == "xmlFreeTextReader":
+ return 1
+# if name[0:11] == "xmlXPathNew":
+# return 1
+ # the next function is defined in libxml.c
+ if name == "xmlRelaxNGFreeValidCtxt":
+ return 1
+#
+# Those are skipped because the Const version is used of the bindings
+# instead.
+#
+ if name == "xmlTextReaderBaseUri":
+ return 1
+ if name == "xmlTextReaderLocalName":
+ return 1
+ if name == "xmlTextReaderName":
+ return 1
+ if name == "xmlTextReaderNamespaceUri":
+ return 1
+ if name == "xmlTextReaderPrefix":
+ return 1
+ if name == "xmlTextReaderXmlLang":
+ return 1
+ if name == "xmlTextReaderValue":
+ return 1
+ if name == "xmlOutputBufferClose": # handled by by the superclass
+ return 1
+ if name == "xmlOutputBufferFlush": # handled by by the superclass
+ return 1
+ if name == "xmlErrMemory":
+ return 1
+ return 0
+
+def print_function_wrapper(name, output, export, include):
+ global py_types
+ global unknown_types
+ global functions
+ global skipped_modules
+
+ try:
+ (desc, ret, args, file) = functions[name]
+ except:
+ print "failed to get function %s infos"
+ return
+
+ if skipped_modules.has_key(file):
+ return 0
+ if skip_function(name) == 1:
+ return 0
+
+ c_call = "";
+ format=""
+ format_args=""
+ c_args=""
+ c_return=""
+ c_convert=""
+ for arg in args:
+ # This should be correct
+ if arg[1][0:6] == "const ":
+ arg[1] = arg[1][6:]
+ c_args = c_args + " %s %s;\n" % (arg[1], arg[0])
+ if py_types.has_key(arg[1]):
+ (f, t, n, c) = py_types[arg[1]]
+ if f != None:
+ format = format + f
+ if t != None:
+ format_args = format_args + ", &pyobj_%s" % (arg[0])
+ c_args = c_args + " PyObject *pyobj_%s;\n" % (arg[0])
+ c_convert = c_convert + \
+ " %s = (%s) Py%s_Get(pyobj_%s);\n" % (arg[0],
+ arg[1], t, arg[0]);
+ else:
+ format_args = format_args + ", &%s" % (arg[0])
+ if c_call != "":
+ c_call = c_call + ", ";
+ c_call = c_call + "%s" % (arg[0])
+ else:
+ if skipped_types.has_key(arg[1]):
+ return 0
+ if unknown_types.has_key(arg[1]):
+ lst = unknown_types[arg[1]]
+ lst.append(name)
+ else:
+ unknown_types[arg[1]] = [name]
+ return -1
+ if format != "":
+ format = format + ":%s" % (name)
+
+ if ret[0] == 'void':
+ if file == "python_accessor":
+ 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 = (%s)xmlStrdup((const xmlChar *)%s);\n" % (args[0][0],
+ args[1][0], args[1][1], 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"
+ elif py_types.has_key(ret[0]):
+ (f, t, n, c) = py_types[ret[0]]
+ c_return = " %s c_retval;\n" % (ret[0])
+ if file == "python_accessor" and ret[2] != None:
+ c_call = "\n c_retval = %s->%s;\n" % (args[0][0], ret[2])
+ else:
+ c_call = "\n c_retval = %s(%s);\n" % (name, c_call);
+ ret_convert = " py_retval = libxml_%sWrap((%s) c_retval);\n" % (n,c)
+ ret_convert = ret_convert + " return(py_retval);\n"
+ elif py_return_types.has_key(ret[0]):
+ (f, t, n, c) = py_return_types[ret[0]]
+ c_return = " %s c_retval;\n" % (ret[0])
+ c_call = "\n c_retval = %s(%s);\n" % (name, c_call);
+ ret_convert = " py_retval = libxml_%sWrap((%s) c_retval);\n" % (n,c)
+ ret_convert = ret_convert + " return(py_retval);\n"
+ else:
+ if skipped_types.has_key(ret[0]):
+ return 0
+ if unknown_types.has_key(ret[0]):
+ lst = unknown_types[ret[0]]
+ lst.append(name)
+ else:
+ unknown_types[ret[0]] = [name]
+ return -1
+
+ if file == "debugXML":
+ include.write("#ifdef LIBXML_DEBUG_ENABLED\n");
+ export.write("#ifdef LIBXML_DEBUG_ENABLED\n");
+ output.write("#ifdef LIBXML_DEBUG_ENABLED\n");
+ elif file == "HTMLtree" or file == "HTMLparser":
+ include.write("#ifdef LIBXML_HTML_ENABLED\n");
+ export.write("#ifdef LIBXML_HTML_ENABLED\n");
+ output.write("#ifdef LIBXML_HTML_ENABLED\n");
+ elif file == "c14n":
+ include.write("#ifdef LIBXML_C14N_ENABLED\n");
+ export.write("#ifdef LIBXML_C14N_ENABLED\n");
+ output.write("#ifdef LIBXML_C14N_ENABLED\n");
+ elif file == "xpathInternals" or file == "xpath":
+ include.write("#ifdef LIBXML_XPATH_ENABLED\n");
+ export.write("#ifdef LIBXML_XPATH_ENABLED\n");
+ output.write("#ifdef LIBXML_XPATH_ENABLED\n");
+ elif file == "xpointer":
+ include.write("#ifdef LIBXML_XPTR_ENABLED\n");
+ export.write("#ifdef LIBXML_XPTR_ENABLED\n");
+ output.write("#ifdef LIBXML_XPTR_ENABLED\n");
+ elif file == "xinclude":
+ include.write("#ifdef LIBXML_XINCLUDE_ENABLED\n");
+ export.write("#ifdef LIBXML_XINCLUDE_ENABLED\n");
+ output.write("#ifdef LIBXML_XINCLUDE_ENABLED\n");
+ elif file == "xmlregexp":
+ include.write("#ifdef LIBXML_REGEXP_ENABLED\n");
+ export.write("#ifdef LIBXML_REGEXP_ENABLED\n");
+ output.write("#ifdef LIBXML_REGEXP_ENABLED\n");
+ elif file == "xmlschemas" or file == "xmlschemastypes" or \
+ file == "relaxng":
+ include.write("#ifdef LIBXML_SCHEMAS_ENABLED\n");
+ export.write("#ifdef LIBXML_SCHEMAS_ENABLED\n");
+ output.write("#ifdef LIBXML_SCHEMAS_ENABLED\n");
+
+ include.write("PyObject * ")
+ include.write("libxml_%s(PyObject *self, PyObject *args);\n" % (name));
+
+ export.write(" { (char *)\"%s\", libxml_%s, METH_VARARGS, NULL },\n" %
+ (name, name))
+
+ if file == "python":
+ # Those have been manually generated
+ return 1
+ if file == "python_accessor" and ret[0] != "void" and ret[2] is None:
+ # Those have been manually generated
+ return 1
+
+ output.write("PyObject *\n")
+ output.write("libxml_%s(PyObject *self ATTRIBUTE_UNUSED," % (name))
+ output.write(" PyObject *args")
+ if format == "":
+ output.write(" ATTRIBUTE_UNUSED")
+ output.write(") {\n")
+ if ret[0] != 'void':
+ output.write(" PyObject *py_retval;\n")
+ if c_return != "":
+ output.write(c_return)
+ if c_args != "":
+ output.write(c_args)
+ if format != "":
+ output.write("\n if (!PyArg_ParseTuple(args, (char *)\"%s\"%s))\n" %
+ (format, format_args))
+ output.write(" return(NULL);\n")
+ if c_convert != "":
+ output.write(c_convert)
+
+ output.write(c_call)
+ output.write(ret_convert)
+ output.write("}\n\n")
+ if file == "debugXML":
+ include.write("#endif /* LIBXML_DEBUG_ENABLED */\n");
+ export.write("#endif /* LIBXML_DEBUG_ENABLED */\n");
+ output.write("#endif /* LIBXML_DEBUG_ENABLED */\n");
+ elif file == "HTMLtree" or file == "HTMLparser":
+ include.write("#endif /* LIBXML_HTML_ENABLED */\n");
+ export.write("#endif /* LIBXML_HTML_ENABLED */\n");
+ output.write("#endif /* LIBXML_HTML_ENABLED */\n");
+ elif file == "c14n":
+ include.write("#endif /* LIBXML_C14N_ENABLED */\n");
+ export.write("#endif /* LIBXML_C14N_ENABLED */\n");
+ output.write("#endif /* LIBXML_C14N_ENABLED */\n");
+ elif file == "xpathInternals" or file == "xpath":
+ include.write("#endif /* LIBXML_XPATH_ENABLED */\n");
+ export.write("#endif /* LIBXML_XPATH_ENABLED */\n");
+ output.write("#endif /* LIBXML_XPATH_ENABLED */\n");
+ elif file == "xpointer":
+ include.write("#endif /* LIBXML_XPTR_ENABLED */\n");
+ export.write("#endif /* LIBXML_XPTR_ENABLED */\n");
+ output.write("#endif /* LIBXML_XPTR_ENABLED */\n");
+ elif file == "xinclude":
+ include.write("#endif /* LIBXML_XINCLUDE_ENABLED */\n");
+ export.write("#endif /* LIBXML_XINCLUDE_ENABLED */\n");
+ output.write("#endif /* LIBXML_XINCLUDE_ENABLED */\n");
+ elif file == "xmlregexp":
+ include.write("#endif /* LIBXML_REGEXP_ENABLED */\n");
+ export.write("#endif /* LIBXML_REGEXP_ENABLED */\n");
+ output.write("#endif /* LIBXML_REGEXP_ENABLED */\n");
+ elif file == "xmlschemas" or file == "xmlschemastypes" or \
+ file == "relaxng":
+ include.write("#endif /* LIBXML_SCHEMAS_ENABLED */\n");
+ export.write("#endif /* LIBXML_SCHEMAS_ENABLED */\n");
+ output.write("#endif /* LIBXML_SCHEMAS_ENABLED */\n");
+ return 1
+
+def buildStubs():
+ global py_types
+ global py_return_types
+ global unknown_types
+
+ try:
+ f = open("libxml2-api.xml")
+ data = f.read()
+ (parser, target) = getparser()
+ parser.feed(data)
+ parser.close()
+ except IOError, msg:
+ try:
+ f = open("../doc/libxml2-api.xml")
+ data = f.read()
+ (parser, target) = getparser()
+ parser.feed(data)
+ parser.close()
+ except IOError, msg:
+ print file, ":", msg
+ sys.exit(1)
+
+ n = len(functions.keys())
+ print "Found %d functions in libxml2-api.xml" % (n)
+
+ py_types['pythonObject'] = ('O', "pythonObject", "pythonObject", "pythonObject")
+ try:
+ f = open("libxml2-python-api.xml")
+ data = f.read()
+ (parser, target) = getparser()
+ parser.feed(data)
+ parser.close()
+ except IOError, msg:
+ print file, ":", msg
+
+
+ print "Found %d functions in libxml2-python-api.xml" % (
+ len(functions.keys()) - n)
+ nb_wrap = 0
+ failed = 0
+ skipped = 0
+
+ include = open("libxml2-py.h", "w")
+ include.write("/* Generated */\n\n")
+ export = open("libxml2-export.c", "w")
+ export.write("/* Generated */\n\n")
+ wrapper = open("libxml2-py.c", "w")
+ wrapper.write("/* Generated */\n\n")
+ wrapper.write("#include <Python.h>\n")
+ wrapper.write("#include <libxml/xmlversion.h>\n")
+ wrapper.write("#include <libxml/tree.h>\n")
+ wrapper.write("#include <libxml/xmlschemastypes.h>\n")
+ wrapper.write("#include \"libxml_wrap.h\"\n")
+ wrapper.write("#include \"libxml2-py.h\"\n\n")
+ for function in functions.keys():
+ ret = print_function_wrapper(function, wrapper, export, include)
+ if ret < 0:
+ failed = failed + 1
+ del functions[function]
+ if ret == 0:
+ skipped = skipped + 1
+ del functions[function]
+ if ret == 1:
+ nb_wrap = nb_wrap + 1
+ include.close()
+ export.close()
+ wrapper.close()
+
+ print "Generated %d wrapper functions, %d failed, %d skipped\n" % (nb_wrap,
+ failed, skipped);
+ print "Missing type converters: "
+ for type in unknown_types.keys():
+ print "%s:%d " % (type, len(unknown_types[type])),
+ print
+
+#######################################################################
+#
+# This part writes part of the Python front-end classes based on
+# mapping rules between types and classes and also based on function
+# renaming to get consistent function names at the Python level
+#
+#######################################################################
+
+#
+# The type automatically remapped to generated classes
+#
+classes_type = {
+ "xmlNodePtr": ("._o", "xmlNode(_obj=%s)", "xmlNode"),
+ "xmlNode *": ("._o", "xmlNode(_obj=%s)", "xmlNode"),
+ "xmlDocPtr": ("._o", "xmlDoc(_obj=%s)", "xmlDoc"),
+ "xmlDocPtr *": ("._o", "xmlDoc(_obj=%s)", "xmlDoc"),
+ "htmlDocPtr": ("._o", "xmlDoc(_obj=%s)", "xmlDoc"),
+ "htmlxmlDocPtr *": ("._o", "xmlDoc(_obj=%s)", "xmlDoc"),
+ "xmlAttrPtr": ("._o", "xmlAttr(_obj=%s)", "xmlAttr"),
+ "xmlAttr *": ("._o", "xmlAttr(_obj=%s)", "xmlAttr"),
+ "xmlNsPtr": ("._o", "xmlNs(_obj=%s)", "xmlNs"),
+ "xmlNs *": ("._o", "xmlNs(_obj=%s)", "xmlNs"),
+ "xmlDtdPtr": ("._o", "xmlDtd(_obj=%s)", "xmlDtd"),
+ "xmlDtd *": ("._o", "xmlDtd(_obj=%s)", "xmlDtd"),
+ "xmlEntityPtr": ("._o", "xmlEntity(_obj=%s)", "xmlEntity"),
+ "xmlEntity *": ("._o", "xmlEntity(_obj=%s)", "xmlEntity"),
+ "xmlElementPtr": ("._o", "xmlElement(_obj=%s)", "xmlElement"),
+ "xmlElement *": ("._o", "xmlElement(_obj=%s)", "xmlElement"),
+ "xmlAttributePtr": ("._o", "xmlAttribute(_obj=%s)", "xmlAttribute"),
+ "xmlAttribute *": ("._o", "xmlAttribute(_obj=%s)", "xmlAttribute"),
+ "xmlXPathContextPtr": ("._o", "xpathContext(_obj=%s)", "xpathContext"),
+ "xmlXPathContext *": ("._o", "xpathContext(_obj=%s)", "xpathContext"),
+ "xmlXPathParserContext *": ("._o", "xpathParserContext(_obj=%s)", "xpathParserContext"),
+ "xmlXPathParserContextPtr": ("._o", "xpathParserContext(_obj=%s)", "xpathParserContext"),
+ "xmlParserCtxtPtr": ("._o", "parserCtxt(_obj=%s)", "parserCtxt"),
+ "xmlParserCtxt *": ("._o", "parserCtxt(_obj=%s)", "parserCtxt"),
+ "htmlParserCtxtPtr": ("._o", "parserCtxt(_obj=%s)", "parserCtxt"),
+ "htmlParserCtxt *": ("._o", "parserCtxt(_obj=%s)", "parserCtxt"),
+ "xmlCatalogPtr": ("._o", "catalog(_obj=%s)", "catalog"),
+ "xmlURIPtr": ("._o", "URI(_obj=%s)", "URI"),
+ "xmlErrorPtr": ("._o", "Error(_obj=%s)", "Error"),
+ "xmlOutputBufferPtr": ("._o", "outputBuffer(_obj=%s)", "outputBuffer"),
+ "xmlParserInputBufferPtr": ("._o", "inputBuffer(_obj=%s)", "inputBuffer"),
+ "xmlRegexpPtr": ("._o", "xmlReg(_obj=%s)", "xmlReg"),
+ "xmlTextReaderLocatorPtr": ("._o", "xmlTextReaderLocator(_obj=%s)", "xmlTextReaderLocator"),
+ "xmlTextReaderPtr": ("._o", "xmlTextReader(_obj=%s)", "xmlTextReader"),
+ 'xmlRelaxNGPtr': ('._o', "relaxNgSchema(_obj=%s)", "relaxNgSchema"),
+ 'xmlRelaxNGParserCtxtPtr': ('._o', "relaxNgParserCtxt(_obj=%s)", "relaxNgParserCtxt"),
+ 'xmlRelaxNGValidCtxtPtr': ('._o', "relaxNgValidCtxt(_obj=%s)", "relaxNgValidCtxt"),
+}
+
+converter_type = {
+ "xmlXPathObjectPtr": "xpathObjectRet(%s)",
+}
+
+primary_classes = ["xmlNode", "xmlDoc"]
+
+classes_ancestor = {
+ "xmlNode" : "xmlCore",
+ "xmlDtd" : "xmlNode",
+ "xmlDoc" : "xmlNode",
+ "xmlAttr" : "xmlNode",
+ "xmlNs" : "xmlNode",
+ "xmlEntity" : "xmlNode",
+ "xmlElement" : "xmlNode",
+ "xmlAttribute" : "xmlNode",
+ "outputBuffer": "ioWriteWrapper",
+ "inputBuffer": "ioReadWrapper",
+ "parserCtxt": "parserCtxtCore",
+ "xmlTextReader": "xmlTextReaderCore",
+}
+classes_destructors = {
+ "parserCtxt": "xmlFreeParserCtxt",
+ "catalog": "xmlFreeCatalog",
+ "URI": "xmlFreeURI",
+# "outputBuffer": "xmlOutputBufferClose",
+ "inputBuffer": "xmlFreeParserInputBuffer",
+ "xmlReg": "xmlRegFreeRegexp",
+ "xmlTextReader": "xmlFreeTextReader",
+ "relaxNgSchema": "xmlRelaxNGFree",
+ "relaxNgParserCtxt": "xmlRelaxNGFreeParserCtxt",
+ "relaxNgValidCtxt": "xmlRelaxNGFreeValidCtxt",
+}
+
+functions_noexcept = {
+ "xmlHasProp": 1,
+ "xmlHasNsProp": 1,
+ "xmlDocSetRootElement": 1,
+}
+
+reference_keepers = {
+ "xmlTextReader": [('inputBuffer', 'input')],
+ "relaxNgValidCtxt": [('relaxNgSchema', 'schema')],
+}
+
+function_classes = {}
+
+function_classes["None"] = []
+
+def nameFixup(name, classe, type, file):
+ listname = classe + "List"
+ ll = len(listname)
+ l = len(classe)
+ if name[0:l] == listname:
+ func = name[l:]
+ func = string.lower(func[0:1]) + func[1:]
+ elif name[0:12] == "xmlParserGet" and file == "python_accessor":
+ func = name[12:]
+ func = string.lower(func[0:1]) + func[1:]
+ elif name[0:12] == "xmlParserSet" and file == "python_accessor":
+ func = name[12:]
+ func = string.lower(func[0:1]) + func[1:]
+ 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:11] == "xmlErrorGet" and file == "python_accessor":
+ func = name[11:]
+ 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:]
+ elif name[0:11] == "xmlXPathGet" and file == "python_accessor":
+ func = name[11:]
+ func = string.lower(func[0:1]) + func[1:]
+ elif name[0:11] == "xmlXPathSet" and file == "python_accessor":
+ func = name[8:]
+ func = string.lower(func[0:1]) + func[1:]
+ elif name[0:15] == "xmlOutputBuffer" and file != "python":
+ func = name[15:]
+ func = string.lower(func[0:1]) + func[1:]
+ elif name[0:20] == "xmlParserInputBuffer" and file != "python":
+ func = name[20:]
+ func = string.lower(func[0:1]) + func[1:]
+ elif name[0:9] == "xmlRegexp" and file == "xmlregexp":
+ func = "regexp" + name[9:]
+ elif name[0:6] == "xmlReg" and file == "xmlregexp":
+ func = "regexp" + name[6:]
+ elif name[0:20] == "xmlTextReaderLocator" and file == "xmlreader":
+ func = name[20:]
+ elif name[0:18] == "xmlTextReaderConst" and file == "xmlreader":
+ func = name[18:]
+ elif name[0:13] == "xmlTextReader" and file == "xmlreader":
+ func = name[13:]
+ elif name[0:12] == "xmlReaderNew" and file == "xmlreader":
+ func = name[9:]
+ elif name[0:11] == "xmlACatalog":
+ func = name[11:]
+ func = string.lower(func[0:1]) + func[1:]
+ elif name[0:l] == classe:
+ func = name[l:]
+ func = string.lower(func[0:1]) + func[1:]
+ elif name[0:7] == "libxml_":
+ func = name[7:]
+ func = string.lower(func[0:1]) + func[1:]
+ elif name[0:6] == "xmlGet":
+ func = name[6:]
+ func = string.lower(func[0:1]) + func[1:]
+ elif name[0:3] == "xml":
+ func = name[3:]
+ func = string.lower(func[0:1]) + func[1:]
+ else:
+ func = name
+ if func[0:5] == "xPath":
+ func = "xpath" + func[5:]
+ elif func[0:4] == "xPtr":
+ func = "xpointer" + func[4:]
+ elif func[0:8] == "xInclude":
+ func = "xinclude" + func[8:]
+ elif func[0:2] == "iD":
+ func = "ID" + func[2:]
+ elif func[0:3] == "uRI":
+ func = "URI" + func[3:]
+ elif func[0:4] == "uTF8":
+ func = "UTF8" + func[4:]
+ elif func[0:3] == 'sAX':
+ func = "SAX" + func[3:]
+ return func
+
+
+def functionCompare(info1, info2):
+ (index1, func1, name1, ret1, args1, file1) = info1
+ (index2, func2, name2, ret2, args2, file2) = info2
+ if file1 == file2:
+ if func1 < func2:
+ return -1
+ if func1 > func2:
+ return 1
+ if file1 == "python_accessor":
+ return -1
+ if file2 == "python_accessor":
+ return 1
+ if file1 < file2:
+ return -1
+ if file1 > file2:
+ return 1
+ return 0
+
+def writeDoc(name, args, indent, output):
+ if functions[name][0] is None or functions[name][0] == "":
+ return
+ val = functions[name][0]
+ val = string.replace(val, "NULL", "None");
+ output.write(indent)
+ output.write('"""')
+ while len(val) > 60:
+ str = val[0:60]
+ i = string.rfind(str, " ");
+ if i < 0:
+ i = 60
+ str = val[0:i]
+ val = val[i:]
+ output.write(str)
+ output.write('\n ');
+ output.write(indent)
+ output.write(val);
+ output.write(' """\n')
+
+def buildWrappers():
+ global ctypes
+ global py_types
+ global py_return_types
+ global unknown_types
+ global functions
+ global function_classes
+ global classes_type
+ global classes_list
+ global converter_type
+ global primary_classes
+ global converter_type
+ global classes_ancestor
+ global converter_type
+ global primary_classes
+ global classes_ancestor
+ global classes_destructors
+ global functions_noexcept
+
+ for type in classes_type.keys():
+ function_classes[classes_type[type][2]] = []
+
+ #
+ # Build the list of C types to look for ordered to start
+ # with primary classes
+ #
+ ctypes = []
+ classes_list = []
+ ctypes_processed = {}
+ classes_processed = {}
+ for classe in primary_classes:
+ classes_list.append(classe)
+ classes_processed[classe] = ()
+ for type in classes_type.keys():
+ tinfo = classes_type[type]
+ if tinfo[2] == classe:
+ ctypes.append(type)
+ ctypes_processed[type] = ()
+ for type in classes_type.keys():
+ if ctypes_processed.has_key(type):
+ continue
+ tinfo = classes_type[type]
+ if not classes_processed.has_key(tinfo[2]):
+ classes_list.append(tinfo[2])
+ classes_processed[tinfo[2]] = ()
+
+ ctypes.append(type)
+ ctypes_processed[type] = ()
+
+ for name in functions.keys():
+ found = 0;
+ (desc, ret, args, file) = functions[name]
+ for type in ctypes:
+ classe = classes_type[type][2]
+
+ if name[0:3] == "xml" and len(args) >= 1 and args[0][1] == type:
+ found = 1
+ func = nameFixup(name, classe, type, file)
+ info = (0, func, name, ret, args, file)
+ function_classes[classe].append(info)
+ elif name[0:3] == "xml" and len(args) >= 2 and args[1][1] == type \
+ and file != "python_accessor":
+ found = 1
+ func = nameFixup(name, classe, type, file)
+ info = (1, func, name, ret, args, file)
+ function_classes[classe].append(info)
+ elif name[0:4] == "html" and len(args) >= 1 and args[0][1] == type:
+ found = 1
+ func = nameFixup(name, classe, type, file)
+ info = (0, func, name, ret, args, file)
+ function_classes[classe].append(info)
+ elif name[0:4] == "html" and len(args) >= 2 and args[1][1] == type \
+ and file != "python_accessor":
+ found = 1
+ func = nameFixup(name, classe, type, file)
+ info = (1, func, name, ret, args, file)
+ function_classes[classe].append(info)
+ if found == 1:
+ continue
+ if name[0:8] == "xmlXPath":
+ continue
+ if name[0:6] == "xmlStr":
+ continue
+ if name[0:10] == "xmlCharStr":
+ continue
+ func = nameFixup(name, "None", file, file)
+ info = (0, func, name, ret, args, file)
+ function_classes['None'].append(info)
+
+ classes = open("libxml2class.py", "w")
+ txt = open("libxml2class.txt", "w")
+ txt.write(" Generated Classes for libxml2-python\n\n")
+
+ txt.write("#\n# Global functions of the module\n#\n\n")
+ if function_classes.has_key("None"):
+ flist = function_classes["None"]
+ flist.sort(functionCompare)
+ oldfile = ""
+ for info in flist:
+ (index, func, name, ret, args, file) = info
+ if file != oldfile:
+ classes.write("#\n# Functions from module %s\n#\n\n" % file)
+ txt.write("\n# functions from module %s\n" % file)
+ oldfile = file
+ classes.write("def %s(" % func)
+ txt.write("%s()\n" % func);
+ n = 0
+ for arg in args:
+ if n != 0:
+ classes.write(", ")
+ classes.write("%s" % arg[0])
+ n = n + 1
+ classes.write("):\n")
+ writeDoc(name, args, ' ', classes);
+
+ for arg in args:
+ if classes_type.has_key(arg[1]):
+ 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]))
+ if ret[0] != "void":
+ classes.write(" ret = ");
+ else:
+ classes.write(" ");
+ classes.write("libxml2mod.%s(" % name)
+ n = 0
+ for arg in args:
+ if n != 0:
+ classes.write(", ");
+ classes.write("%s" % arg[0])
+ if classes_type.has_key(arg[1]):
+ classes.write("__o");
+ n = n + 1
+ classes.write(")\n");
+ if ret[0] != "void":
+ if classes_type.has_key(ret[0]):
+ #
+ # Raise an exception
+ #
+ if functions_noexcept.has_key(name):
+ classes.write(" if ret is None:return None\n");
+ elif string.find(name, "URI") >= 0:
+ classes.write(
+ " if ret is None:raise uriError('%s() failed')\n"
+ % (name))
+ elif string.find(name, "XPath") >= 0:
+ classes.write(
+ " if ret is None:raise xpathError('%s() failed')\n"
+ % (name))
+ elif string.find(name, "Parse") >= 0:
+ classes.write(
+ " if ret is None:raise parserError('%s() failed')\n"
+ % (name))
+ else:
+ classes.write(
+ " if ret is None:raise treeError('%s() failed')\n"
+ % (name))
+ classes.write(" return ");
+ classes.write(classes_type[ret[0]][1] % ("ret"));
+ classes.write("\n");
+ else:
+ classes.write(" return ret\n");
+ classes.write("\n");
+
+ txt.write("\n\n#\n# Set of classes of the module\n#\n\n")
+ for classname in classes_list:
+ if classname == "None":
+ pass
+ else:
+ if classes_ancestor.has_key(classname):
+ txt.write("\n\nClass %s(%s)\n" % (classname,
+ classes_ancestor[classname]))
+ classes.write("class %s(%s):\n" % (classname,
+ classes_ancestor[classname]))
+ classes.write(" def __init__(self, _obj=None):\n")
+ if reference_keepers.has_key(classname):
+ rlist = reference_keepers[classname]
+ for ref in rlist:
+ classes.write(" self.%s = None\n" % ref[1])
+ classes.write(" self._o = _obj\n")
+ classes.write(" %s.__init__(self, _obj=_obj)\n\n" % (
+ classes_ancestor[classname]))
+ if classes_ancestor[classname] == "xmlCore" or \
+ classes_ancestor[classname] == "xmlNode":
+ classes.write(" def __repr__(self):\n")
+ format = "<%s (%%s) object at 0x%%x>" % (classname)
+ classes.write(" return \"%s\" %% (self.name, id (self))\n\n" % (
+ format))
+ else:
+ txt.write("Class %s()\n" % (classname))
+ classes.write("class %s:\n" % (classname))
+ classes.write(" def __init__(self, _obj=None):\n")
+ if reference_keepers.has_key(classname):
+ list = reference_keepers[classname]
+ for ref in list:
+ classes.write(" self.%s = None\n" % ref[1])
+ classes.write(" if _obj != None:self._o = _obj;return\n")
+ classes.write(" self._o = None\n\n");
+ if classes_destructors.has_key(classname):
+ classes.write(" def __del__(self):\n")
+ classes.write(" if self._o != None:\n")
+ classes.write(" libxml2mod.%s(self._o)\n" %
+ classes_destructors[classname]);
+ classes.write(" self._o = None\n\n");
+ flist = function_classes[classname]
+ flist.sort(functionCompare)
+ oldfile = ""
+ for info in flist:
+ (index, func, name, ret, args, file) = info
+ if file != oldfile:
+ if file == "python_accessor":
+ classes.write(" # accessors for %s\n" % (classname))
+ txt.write(" # accessors\n")
+ else:
+ classes.write(" #\n")
+ classes.write(" # %s functions from module %s\n" % (
+ classname, file))
+ txt.write("\n # functions from module %s\n" % file)
+ classes.write(" #\n\n")
+ oldfile = file
+ classes.write(" def %s(self" % func)
+ txt.write(" %s()\n" % func);
+ n = 0
+ for arg in args:
+ if n != index:
+ classes.write(", %s" % arg[0])
+ n = n + 1
+ classes.write("):\n")
+ writeDoc(name, args, ' ', classes);
+ n = 0
+ for arg in args:
+ if classes_type.has_key(arg[1]):
+ if n != index:
+ 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]))
+ n = n + 1
+ if ret[0] != "void":
+ classes.write(" ret = ");
+ else:
+ classes.write(" ");
+ classes.write("libxml2mod.%s(" % name)
+ n = 0
+ for arg in args:
+ if n != 0:
+ classes.write(", ");
+ if n != index:
+ classes.write("%s" % arg[0])
+ if classes_type.has_key(arg[1]):
+ classes.write("__o");
+ else:
+ classes.write("self");
+ if classes_type.has_key(arg[1]):
+ classes.write(classes_type[arg[1]][0])
+ n = n + 1
+ classes.write(")\n");
+ if ret[0] != "void":
+ if classes_type.has_key(ret[0]):
+ #
+ # Raise an exception
+ #
+ if functions_noexcept.has_key(name):
+ classes.write(
+ " if ret is None:return None\n");
+ elif string.find(name, "URI") >= 0:
+ classes.write(
+ " if ret is None:raise uriError('%s() failed')\n"
+ % (name))
+ elif string.find(name, "XPath") >= 0:
+ classes.write(
+ " if ret is None:raise xpathError('%s() failed')\n"
+ % (name))
+ elif string.find(name, "Parse") >= 0:
+ classes.write(
+ " if ret is None:raise parserError('%s() failed')\n"
+ % (name))
+ else:
+ classes.write(
+ " if ret is None:raise treeError('%s() failed')\n"
+ % (name))
+
+ #
+ # generate the returned class wrapper for the object
+ #
+ classes.write(" __tmp = ");
+ classes.write(classes_type[ret[0]][1] % ("ret"));
+ classes.write("\n");
+
+ #
+ # Sometime one need to keep references of the source
+ # class in the returned class object.
+ # See reference_keepers for the list
+ #
+ tclass = classes_type[ret[0]][2]
+ if reference_keepers.has_key(tclass):
+ list = reference_keepers[tclass]
+ for pref in list:
+ if pref[0] == classname:
+ classes.write(" __tmp.%s = self\n" %
+ pref[1])
+ #
+ # return the class
+ #
+ classes.write(" return __tmp\n");
+ elif converter_type.has_key(ret[0]):
+ #
+ # Raise an exception
+ #
+ if functions_noexcept.has_key(name):
+ classes.write(
+ " if ret is None:return None");
+ elif string.find(name, "URI") >= 0:
+ classes.write(
+ " if ret is None:raise uriError('%s() failed')\n"
+ % (name))
+ elif string.find(name, "XPath") >= 0:
+ classes.write(
+ " if ret is None:raise xpathError('%s() failed')\n"
+ % (name))
+ elif string.find(name, "Parse") >= 0:
+ classes.write(
+ " if ret is None:raise parserError('%s() failed')\n"
+ % (name))
+ else:
+ classes.write(
+ " if ret is None:raise treeError('%s() failed')\n"
+ % (name))
+ classes.write(" return ");
+ classes.write(converter_type[ret[0]] % ("ret"));
+ classes.write("\n");
+ else:
+ classes.write(" return ret\n");
+ classes.write("\n");
+
+ #
+ # Generate enum constants
+ #
+ for type,enum in enums.items():
+ classes.write("# %s\n" % type)
+ items = enum.items()
+ items.sort(lambda i1,i2: cmp(long(i1[1]),long(i2[1])))
+ for name,value in items:
+ classes.write("%s = %s\n" % (name,value))
+ classes.write("\n");
+
+ txt.close()
+ classes.close()
+
+buildStubs()
+buildWrappers()
diff --git a/python/libxml.c b/python/libxml.c
new file mode 100644
index 0000000..7a19303
--- /dev/null
+++ b/python/libxml.c
@@ -0,0 +1,3230 @@
+/*
+ * libxml.c: this modules implements the main part of the glue of the
+ * libxml2 library and the Python interpreter. It provides the
+ * entry points where an automatically generated stub is either
+ * unpractical or would not match cleanly the Python model.
+ *
+ * If compiled with MERGED_MODULES, the entry point will be used to
+ * initialize both the libxml2 and the libxslt wrappers
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+#include <Python.h>
+#include <fileobject.h>
+/* #include "config.h" */
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xpath.h>
+#include <libxml/xmlerror.h>
+#include <libxml/xpathInternals.h>
+#include <libxml/xmlmemory.h>
+#include <libxml/xmlIO.h>
+#include <libxml/c14n.h>
+#include "libxml_wrap.h"
+#include "libxml2-py.h"
+
+#if (defined(_MSC_VER) || defined(__MINGW32__)) && !defined(vsnprintf)
+#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
+#elif defined(WITH_TRIO)
+#include "trio.h"
+#define vsnprintf trio_vsnprintf
+#endif
+
+/* #define DEBUG */
+/* #define DEBUG_SAX */
+/* #define DEBUG_XPATH */
+/* #define DEBUG_ERROR */
+/* #define DEBUG_MEMORY */
+/* #define DEBUG_FILES */
+/* #define DEBUG_LOADER */
+
+void initlibxml2mod(void);
+
+/**
+ * TODO:
+ *
+ * macro to flag unimplemented blocks
+ */
+#define TODO \
+ xmlGenericError(xmlGenericErrorContext, \
+ "Unimplemented block at %s:%d\n", \
+ __FILE__, __LINE__);
+
+/************************************************************************
+ * *
+ * Memory debug interface *
+ * *
+ ************************************************************************/
+
+#if 0
+extern void xmlMemFree(void *ptr);
+extern void *xmlMemMalloc(size_t size);
+extern void *xmlMemRealloc(void *ptr, size_t size);
+extern char *xmlMemoryStrdup(const char *str);
+#endif
+
+static int libxmlMemoryDebugActivated = 0;
+static long libxmlMemoryAllocatedBase = 0;
+
+static int libxmlMemoryDebug = 0;
+static xmlFreeFunc freeFunc = NULL;
+static xmlMallocFunc mallocFunc = NULL;
+static xmlReallocFunc reallocFunc = NULL;
+static xmlStrdupFunc strdupFunc = NULL;
+
+PyObject *
+libxml_xmlDebugMemory(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ int activate;
+ PyObject *py_retval;
+ long ret;
+
+ if (!PyArg_ParseTuple(args, (char *) "i:xmlDebugMemory", &activate))
+ return (NULL);
+
+#ifdef DEBUG_MEMORY
+ printf("libxml_xmlDebugMemory(%d) called\n", activate);
+#endif
+
+ if (activate != 0) {
+ if (libxmlMemoryDebug == 0) {
+ /*
+ * First initialize the library and grab the old memory handlers
+ * and switch the library to memory debugging
+ */
+ xmlMemGet((xmlFreeFunc *) & freeFunc,
+ (xmlMallocFunc *) & mallocFunc,
+ (xmlReallocFunc *) & reallocFunc,
+ (xmlStrdupFunc *) & strdupFunc);
+ if ((freeFunc == xmlMemFree) && (mallocFunc == xmlMemMalloc) &&
+ (reallocFunc == xmlMemRealloc) &&
+ (strdupFunc == xmlMemoryStrdup)) {
+ libxmlMemoryAllocatedBase = xmlMemUsed();
+ } else {
+ ret = (long) xmlMemSetup(xmlMemFree, xmlMemMalloc,
+ xmlMemRealloc, xmlMemoryStrdup);
+ if (ret < 0)
+ goto error;
+ libxmlMemoryAllocatedBase = xmlMemUsed();
+ }
+ xmlInitParser();
+ ret = 0;
+ } else if (libxmlMemoryDebugActivated == 0) {
+ libxmlMemoryAllocatedBase = xmlMemUsed();
+ ret = 0;
+ } else {
+ ret = xmlMemUsed() - libxmlMemoryAllocatedBase;
+ }
+ libxmlMemoryDebug = 1;
+ libxmlMemoryDebugActivated = 1;
+ } else {
+ if (libxmlMemoryDebugActivated == 1)
+ ret = xmlMemUsed() - libxmlMemoryAllocatedBase;
+ else
+ ret = 0;
+ libxmlMemoryDebugActivated = 0;
+ }
+ error:
+ py_retval = libxml_longWrap(ret);
+ return (py_retval);
+}
+
+PyObject *
+libxml_xmlDumpMemory(ATTRIBUTE_UNUSED PyObject * self,
+ ATTRIBUTE_UNUSED PyObject * args)
+{
+
+ if (libxmlMemoryDebug != 0)
+ xmlMemoryDump();
+ Py_INCREF(Py_None);
+ return (Py_None);
+}
+
+/************************************************************************
+ * *
+ * Handling Python FILE I/O at the C level *
+ * The raw I/O attack diectly the File objects, while the *
+ * other routines address the ioWrapper instance instead *
+ * *
+ ************************************************************************/
+
+/**
+ * xmlPythonFileCloseUnref:
+ * @context: the I/O context
+ *
+ * Close an I/O channel
+ */
+static int
+xmlPythonFileCloseRaw (void * context) {
+ PyObject *file, *ret;
+
+#ifdef DEBUG_FILES
+ printf("xmlPythonFileCloseUnref\n");
+#endif
+ file = (PyObject *) context;
+ if (file == NULL) return(-1);
+ ret = PyEval_CallMethod(file, (char *) "close", (char *) "()");
+ if (ret != NULL) {
+ Py_DECREF(ret);
+ }
+ Py_DECREF(file);
+ return(0);
+}
+
+/**
+ * xmlPythonFileReadRaw:
+ * @context: the I/O context
+ * @buffer: where to drop data
+ * @len: number of bytes to write
+ *
+ * Read @len bytes to @buffer from the Python file in the I/O channel
+ *
+ * Returns the number of bytes read
+ */
+static int
+xmlPythonFileReadRaw (void * context, char * buffer, int len) {
+ PyObject *file;
+ PyObject *ret;
+ int lenread = -1;
+ char *data;
+
+#ifdef DEBUG_FILES
+ printf("xmlPythonFileReadRaw: %d\n", len);
+#endif
+ file = (PyObject *) context;
+ if (file == NULL) return(-1);
+ ret = PyEval_CallMethod(file, (char *) "read", (char *) "(i)", len);
+ if (ret == NULL) {
+ printf("xmlPythonFileReadRaw: result is NULL\n");
+ return(-1);
+ } else if (PyString_Check(ret)) {
+ lenread = PyString_Size(ret);
+ data = PyString_AsString(ret);
+ if (lenread > len)
+ memcpy(buffer, data, len);
+ else
+ memcpy(buffer, data, lenread);
+ Py_DECREF(ret);
+ } else {
+ printf("xmlPythonFileReadRaw: result is not a String\n");
+ Py_DECREF(ret);
+ }
+ return(lenread);
+}
+
+/**
+ * xmlPythonFileRead:
+ * @context: the I/O context
+ * @buffer: where to drop data
+ * @len: number of bytes to write
+ *
+ * Read @len bytes to @buffer from the I/O channel.
+ *
+ * Returns the number of bytes read
+ */
+static int
+xmlPythonFileRead (void * context, char * buffer, int len) {
+ PyObject *file;
+ PyObject *ret;
+ int lenread = -1;
+ char *data;
+
+#ifdef DEBUG_FILES
+ printf("xmlPythonFileRead: %d\n", len);
+#endif
+ file = (PyObject *) context;
+ if (file == NULL) return(-1);
+ ret = PyEval_CallMethod(file, (char *) "io_read", (char *) "(i)", len);
+ if (ret == NULL) {
+ printf("xmlPythonFileRead: result is NULL\n");
+ return(-1);
+ } else if (PyString_Check(ret)) {
+ lenread = PyString_Size(ret);
+ data = PyString_AsString(ret);
+ if (lenread > len)
+ memcpy(buffer, data, len);
+ else
+ memcpy(buffer, data, lenread);
+ Py_DECREF(ret);
+ } else {
+ printf("xmlPythonFileRead: result is not a String\n");
+ Py_DECREF(ret);
+ }
+ return(lenread);
+}
+
+/**
+ * xmlFileWrite:
+ * @context: the I/O context
+ * @buffer: where to drop data
+ * @len: number of bytes to write
+ *
+ * Write @len bytes from @buffer to the I/O channel.
+ *
+ * Returns the number of bytes written
+ */
+static int
+xmlPythonFileWrite (void * context, const char * buffer, int len) {
+ PyObject *file;
+ PyObject *string;
+ PyObject *ret = NULL;
+ int written = -1;
+
+#ifdef DEBUG_FILES
+ printf("xmlPythonFileWrite: %d\n", len);
+#endif
+ file = (PyObject *) context;
+ if (file == NULL) return(-1);
+ string = PyString_FromStringAndSize(buffer, len);
+ if (string == NULL) return(-1);
+ if (PyObject_HasAttrString(file, (char *) "io_write")) {
+ ret = PyEval_CallMethod(file, (char *) "io_write", (char *) "(O)",
+ string);
+ } else if (PyObject_HasAttrString(file, (char *) "write")) {
+ ret = PyEval_CallMethod(file, (char *) "write", (char *) "(O)",
+ string);
+ }
+ Py_DECREF(string);
+ if (ret == NULL) {
+ printf("xmlPythonFileWrite: result is NULL\n");
+ return(-1);
+ } else if (PyInt_Check(ret)) {
+ written = (int) PyInt_AsLong(ret);
+ Py_DECREF(ret);
+ } else if (ret == Py_None) {
+ written = len;
+ Py_DECREF(ret);
+ } else {
+ printf("xmlPythonFileWrite: result is not an Int nor None\n");
+ Py_DECREF(ret);
+ }
+ return(written);
+}
+
+/**
+ * xmlPythonFileClose:
+ * @context: the I/O context
+ *
+ * Close an I/O channel
+ */
+static int
+xmlPythonFileClose (void * context) {
+ PyObject *file, *ret = NULL;
+
+#ifdef DEBUG_FILES
+ printf("xmlPythonFileClose\n");
+#endif
+ file = (PyObject *) context;
+ if (file == NULL) return(-1);
+ if (PyObject_HasAttrString(file, (char *) "io_close")) {
+ ret = PyEval_CallMethod(file, (char *) "io_close", (char *) "()");
+ } else if (PyObject_HasAttrString(file, (char *) "flush")) {
+ ret = PyEval_CallMethod(file, (char *) "flush", (char *) "()");
+ }
+ if (ret != NULL) {
+ Py_DECREF(ret);
+ }
+ return(0);
+}
+
+#ifdef LIBXML_OUTPUT_ENABLED
+/**
+ * xmlOutputBufferCreatePythonFile:
+ * @file: a PyFile_Type
+ * @encoder: the encoding converter or NULL
+ *
+ * Create a buffered output for the progressive saving to a PyFile_Type
+ * buffered C I/O
+ *
+ * Returns the new parser output or NULL
+ */
+static xmlOutputBufferPtr
+xmlOutputBufferCreatePythonFile(PyObject *file,
+ xmlCharEncodingHandlerPtr encoder) {
+ xmlOutputBufferPtr ret;
+
+ if (file == NULL) return(NULL);
+
+ ret = xmlAllocOutputBuffer(encoder);
+ if (ret != NULL) {
+ ret->context = file;
+ /* Py_INCREF(file); */
+ ret->writecallback = xmlPythonFileWrite;
+ ret->closecallback = xmlPythonFileClose;
+ }
+
+ return(ret);
+}
+
+PyObject *
+libxml_xmlCreateOutputBuffer(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) {
+ PyObject *py_retval;
+ PyObject *file;
+ xmlChar *encoding;
+ xmlCharEncodingHandlerPtr handler = NULL;
+ xmlOutputBufferPtr buffer;
+
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlOutputBufferCreate",
+ &file, &encoding))
+ return(NULL);
+ if ((encoding != NULL) && (encoding[0] != 0)) {
+ handler = xmlFindCharEncodingHandler((const char *) encoding);
+ }
+ buffer = xmlOutputBufferCreatePythonFile(file, handler);
+ if (buffer == NULL)
+ printf("libxml_xmlCreateOutputBuffer: buffer == NULL\n");
+ py_retval = libxml_xmlOutputBufferPtrWrap(buffer);
+ return(py_retval);
+}
+
+/**
+ * libxml_outputBufferGetPythonFile:
+ * @buffer: the I/O buffer
+ *
+ * read the Python I/O from the CObject
+ *
+ * Returns the new parser output or NULL
+ */
+static PyObject *
+libxml_outputBufferGetPythonFile(ATTRIBUTE_UNUSED PyObject *self,
+ PyObject *args) {
+ PyObject *buffer;
+ PyObject *file;
+ xmlOutputBufferPtr obj;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:outputBufferGetPythonFile",
+ &buffer))
+ return(NULL);
+
+ obj = PyoutputBuffer_Get(buffer);
+ if (obj == NULL) {
+ fprintf(stderr,
+ "outputBufferGetPythonFile: obj == NULL\n");
+ Py_INCREF(Py_None);
+ return(Py_None);
+ }
+ if (obj->closecallback != xmlPythonFileClose) {
+ fprintf(stderr,
+ "outputBufferGetPythonFile: not a python file wrapper\n");
+ Py_INCREF(Py_None);
+ return(Py_None);
+ }
+ file = (PyObject *) obj->context;
+ if (file == NULL) {
+ Py_INCREF(Py_None);
+ return(Py_None);
+ }
+ Py_INCREF(file);
+ return(file);
+}
+
+static PyObject *
+libxml_xmlOutputBufferClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlOutputBufferPtr out;
+ PyObject *pyobj_out;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlOutputBufferClose", &pyobj_out))
+ return(NULL);
+ out = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_out);
+
+ c_retval = xmlOutputBufferClose(out);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+static PyObject *
+libxml_xmlOutputBufferFlush(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlOutputBufferPtr out;
+ PyObject *pyobj_out;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlOutputBufferFlush", &pyobj_out))
+ return(NULL);
+ out = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_out);
+
+ c_retval = xmlOutputBufferFlush(out);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+#endif /* LIBXML_OUTPUT_ENABLED */
+
+
+/**
+ * xmlParserInputBufferCreatePythonFile:
+ * @file: a PyFile_Type
+ * @encoder: the encoding converter or NULL
+ *
+ * Create a buffered output for the progressive saving to a PyFile_Type
+ * buffered C I/O
+ *
+ * Returns the new parser output or NULL
+ */
+static xmlParserInputBufferPtr
+xmlParserInputBufferCreatePythonFile(PyObject *file,
+ xmlCharEncoding encoding) {
+ xmlParserInputBufferPtr ret;
+
+ if (file == NULL) return(NULL);
+
+ ret = xmlAllocParserInputBuffer(encoding);
+ if (ret != NULL) {
+ ret->context = file;
+ /* Py_INCREF(file); */
+ ret->readcallback = xmlPythonFileRead;
+ ret->closecallback = xmlPythonFileClose;
+ }
+
+ return(ret);
+}
+
+PyObject *
+libxml_xmlCreateInputBuffer(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) {
+ PyObject *py_retval;
+ PyObject *file;
+ xmlChar *encoding;
+ xmlCharEncoding enc = XML_CHAR_ENCODING_NONE;
+ xmlParserInputBufferPtr buffer;
+
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlParserInputBufferCreate",
+ &file, &encoding))
+ return(NULL);
+ if ((encoding != NULL) && (encoding[0] != 0)) {
+ enc = xmlParseCharEncoding((const char *) encoding);
+ }
+ buffer = xmlParserInputBufferCreatePythonFile(file, enc);
+ if (buffer == NULL)
+ printf("libxml_xmlParserInputBufferCreate: buffer == NULL\n");
+ py_retval = libxml_xmlParserInputBufferPtrWrap(buffer);
+ return(py_retval);
+}
+
+/************************************************************************
+ * *
+ * Providing the resolver at the Python level *
+ * *
+ ************************************************************************/
+
+static xmlExternalEntityLoader defaultExternalEntityLoader = NULL;
+static PyObject *pythonExternalEntityLoaderObjext;
+
+static xmlParserInputPtr
+pythonExternalEntityLoader(const char *URL, const char *ID,
+ xmlParserCtxtPtr ctxt) {
+ xmlParserInputPtr result = NULL;
+ if (pythonExternalEntityLoaderObjext != NULL) {
+ PyObject *ret;
+ PyObject *ctxtobj;
+
+ ctxtobj = libxml_xmlParserCtxtPtrWrap(ctxt);
+#ifdef DEBUG_LOADER
+ printf("pythonExternalEntityLoader: ready to call\n");
+#endif
+
+ ret = PyObject_CallFunction(pythonExternalEntityLoaderObjext,
+ (char *) "(ssO)", URL, ID, ctxtobj);
+ Py_XDECREF(ctxtobj);
+#ifdef DEBUG_LOADER
+ printf("pythonExternalEntityLoader: result ");
+ PyObject_Print(ret, stderr, 0);
+ printf("\n");
+#endif
+
+ if (ret != NULL) {
+ if (PyObject_HasAttrString(ret, (char *) "read")) {
+ xmlParserInputBufferPtr buf;
+
+ buf = xmlAllocParserInputBuffer(XML_CHAR_ENCODING_NONE);
+ if (buf != NULL) {
+ buf->context = ret;
+ buf->readcallback = xmlPythonFileReadRaw;
+ buf->closecallback = xmlPythonFileCloseRaw;
+ result = xmlNewIOInputStream(ctxt, buf,
+ XML_CHAR_ENCODING_NONE);
+ }
+ } else {
+ printf("pythonExternalEntityLoader: can't read\n");
+ }
+ if (result == NULL) {
+ Py_DECREF(ret);
+ } else if (URL != NULL) {
+ result->filename = (char *) xmlStrdup((const xmlChar *)URL);
+ result->directory = xmlParserGetDirectory((const char *) URL);
+ }
+ }
+ }
+ if ((result == NULL) && (defaultExternalEntityLoader != NULL)) {
+ result = defaultExternalEntityLoader(URL, ID, ctxt);
+ }
+ return(result);
+}
+
+PyObject *
+libxml_xmlSetEntityLoader(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) {
+ PyObject *py_retval;
+ PyObject *loader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:libxml_xmlSetEntityLoader",
+ &loader))
+ return(NULL);
+
+#ifdef DEBUG_LOADER
+ printf("libxml_xmlSetEntityLoader\n");
+#endif
+ if (defaultExternalEntityLoader == NULL)
+ defaultExternalEntityLoader = xmlGetExternalEntityLoader();
+
+ pythonExternalEntityLoaderObjext = loader;
+ xmlSetExternalEntityLoader(pythonExternalEntityLoader);
+
+ py_retval = PyInt_FromLong(0);
+ return(py_retval);
+}
+
+
+/************************************************************************
+ * *
+ * Handling SAX/xmllib/sgmlop callback interfaces *
+ * *
+ ************************************************************************/
+
+static void
+pythonStartElement(void *user_data, const xmlChar * name,
+ const xmlChar ** attrs)
+{
+ int i;
+ PyObject *handler;
+ PyObject *dict;
+ PyObject *attrname;
+ PyObject *attrvalue;
+ PyObject *result = NULL;
+ int type = 0;
+
+#ifdef DEBUG_SAX
+ printf("pythonStartElement(%s) called\n", name);
+#endif
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "startElement"))
+ type = 1;
+ else if (PyObject_HasAttrString(handler, (char *) "start"))
+ type = 2;
+ if (type != 0) {
+ /*
+ * the xmllib interface always generate a dictionnary,
+ * possibly empty
+ */
+ if ((attrs == NULL) && (type == 1)) {
+ Py_XINCREF(Py_None);
+ dict = Py_None;
+ } else if (attrs == NULL) {
+ dict = PyDict_New();
+ } else {
+ dict = PyDict_New();
+ for (i = 0; attrs[i] != NULL; i++) {
+ attrname = PyString_FromString((char *) attrs[i]);
+ i++;
+ if (attrs[i] != NULL) {
+ attrvalue = PyString_FromString((char *) attrs[i]);
+ } else {
+ Py_XINCREF(Py_None);
+ attrvalue = Py_None;
+ }
+ PyDict_SetItem(dict, attrname, attrvalue);
+ }
+ }
+
+ if (type == 1)
+ result = PyObject_CallMethod(handler, (char *) "startElement",
+ (char *) "sO", name, dict);
+ else if (type == 2)
+ result = PyObject_CallMethod(handler, (char *) "start",
+ (char *) "sO", name, dict);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(dict);
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonStartDocument(void *user_data)
+{
+ PyObject *handler;
+ PyObject *result;
+
+#ifdef DEBUG_SAX
+ printf("pythonStartDocument() called\n");
+#endif
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "startDocument")) {
+ result =
+ PyObject_CallMethod(handler, (char *) "startDocument", NULL);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonEndDocument(void *user_data)
+{
+ PyObject *handler;
+ PyObject *result;
+
+#ifdef DEBUG_SAX
+ printf("pythonEndDocument() called\n");
+#endif
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "endDocument")) {
+ result =
+ PyObject_CallMethod(handler, (char *) "endDocument", NULL);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+ /*
+ * The reference to the handler is released there
+ */
+ Py_XDECREF(handler);
+}
+
+static void
+pythonEndElement(void *user_data, const xmlChar * name)
+{
+ PyObject *handler;
+ PyObject *result;
+
+#ifdef DEBUG_SAX
+ printf("pythonEndElement(%s) called\n", name);
+#endif
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "endElement")) {
+ result = PyObject_CallMethod(handler, (char *) "endElement",
+ (char *) "s", name);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(result);
+ } else if (PyObject_HasAttrString(handler, (char *) "end")) {
+ result = PyObject_CallMethod(handler, (char *) "end",
+ (char *) "s", name);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonReference(void *user_data, const xmlChar * name)
+{
+ PyObject *handler;
+ PyObject *result;
+
+#ifdef DEBUG_SAX
+ printf("pythonReference(%s) called\n", name);
+#endif
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "reference")) {
+ result = PyObject_CallMethod(handler, (char *) "reference",
+ (char *) "s", name);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonCharacters(void *user_data, const xmlChar * ch, int len)
+{
+ PyObject *handler;
+ PyObject *result = NULL;
+ int type = 0;
+
+#ifdef DEBUG_SAX
+ printf("pythonCharacters(%s, %d) called\n", ch, len);
+#endif
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "characters"))
+ type = 1;
+ else if (PyObject_HasAttrString(handler, (char *) "data"))
+ type = 2;
+ if (type != 0) {
+ if (type == 1)
+ result = PyObject_CallMethod(handler, (char *) "characters",
+ (char *) "s#", ch, len);
+ else if (type == 2)
+ result = PyObject_CallMethod(handler, (char *) "data",
+ (char *) "s#", ch, len);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonIgnorableWhitespace(void *user_data, const xmlChar * ch, int len)
+{
+ PyObject *handler;
+ PyObject *result = NULL;
+ int type = 0;
+
+#ifdef DEBUG_SAX
+ printf("pythonIgnorableWhitespace(%s, %d) called\n", ch, len);
+#endif
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "ignorableWhitespace"))
+ type = 1;
+ else if (PyObject_HasAttrString(handler, (char *) "data"))
+ type = 2;
+ if (type != 0) {
+ if (type == 1)
+ result =
+ PyObject_CallMethod(handler,
+ (char *) "ignorableWhitespace",
+ (char *) "s#", ch, len);
+ else if (type == 2)
+ result =
+ PyObject_CallMethod(handler, (char *) "data",
+ (char *) "s#", ch, len);
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonProcessingInstruction(void *user_data,
+ const xmlChar * target, const xmlChar * data)
+{
+ PyObject *handler;
+ PyObject *result;
+
+#ifdef DEBUG_SAX
+ printf("pythonProcessingInstruction(%s, %s) called\n", target, data);
+#endif
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "processingInstruction")) {
+ result = PyObject_CallMethod(handler, (char *)
+ "processingInstruction",
+ (char *) "ss", target, data);
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonComment(void *user_data, const xmlChar * value)
+{
+ PyObject *handler;
+ PyObject *result;
+
+#ifdef DEBUG_SAX
+ printf("pythonComment(%s) called\n", value);
+#endif
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "comment")) {
+ result =
+ PyObject_CallMethod(handler, (char *) "comment", (char *) "s",
+ value);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonWarning(void *user_data, const char *msg, ...)
+{
+ PyObject *handler;
+ PyObject *result;
+ va_list args;
+ char buf[1024];
+
+#ifdef DEBUG_SAX
+ printf("pythonWarning(%s) called\n", msg);
+#endif
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "warning")) {
+ va_start(args, msg);
+ vsnprintf(buf, 1023, msg, args);
+ va_end(args);
+ buf[1023] = 0;
+ result =
+ PyObject_CallMethod(handler, (char *) "warning", (char *) "s",
+ buf);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonError(void *user_data, const char *msg, ...)
+{
+ PyObject *handler;
+ PyObject *result;
+ va_list args;
+ char buf[1024];
+
+#ifdef DEBUG_SAX
+ printf("pythonError(%s) called\n", msg);
+#endif
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "error")) {
+ va_start(args, msg);
+ vsnprintf(buf, 1023, msg, args);
+ va_end(args);
+ buf[1023] = 0;
+ result =
+ PyObject_CallMethod(handler, (char *) "error", (char *) "s",
+ buf);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonFatalError(void *user_data, const char *msg, ...)
+{
+ PyObject *handler;
+ PyObject *result;
+ va_list args;
+ char buf[1024];
+
+#ifdef DEBUG_SAX
+ printf("pythonFatalError(%s) called\n", msg);
+#endif
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "fatalError")) {
+ va_start(args, msg);
+ vsnprintf(buf, 1023, msg, args);
+ va_end(args);
+ buf[1023] = 0;
+ result =
+ PyObject_CallMethod(handler, (char *) "fatalError",
+ (char *) "s", buf);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonCdataBlock(void *user_data, const xmlChar * ch, int len)
+{
+ PyObject *handler;
+ PyObject *result = NULL;
+ int type = 0;
+
+#ifdef DEBUG_SAX
+ printf("pythonCdataBlock(%s, %d) called\n", ch, len);
+#endif
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "cdataBlock"))
+ type = 1;
+ else if (PyObject_HasAttrString(handler, (char *) "cdata"))
+ type = 2;
+ if (type != 0) {
+ if (type == 1)
+ result =
+ PyObject_CallMethod(handler, (char *) "cdataBlock",
+ (char *) "s#", ch, len);
+ else if (type == 2)
+ result =
+ PyObject_CallMethod(handler, (char *) "cdata",
+ (char *) "s#", ch, len);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonExternalSubset(void *user_data,
+ const xmlChar * name,
+ const xmlChar * externalID, const xmlChar * systemID)
+{
+ PyObject *handler;
+ PyObject *result;
+
+#ifdef DEBUG_SAX
+ printf("pythonExternalSubset(%s, %s, %s) called\n",
+ name, externalID, systemID);
+#endif
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "externalSubset")) {
+ result =
+ PyObject_CallMethod(handler, (char *) "externalSubset",
+ (char *) "sss", name, externalID,
+ systemID);
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonEntityDecl(void *user_data,
+ const xmlChar * name,
+ int type,
+ const xmlChar * publicId,
+ const xmlChar * systemId, xmlChar * content)
+{
+ PyObject *handler;
+ PyObject *result;
+
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "entityDecl")) {
+ result = PyObject_CallMethod(handler, (char *) "entityDecl",
+ (char *) "sisss", name, type,
+ publicId, systemId, content);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+}
+
+
+
+static void
+
+pythonNotationDecl(void *user_data,
+ const xmlChar * name,
+ const xmlChar * publicId, const xmlChar * systemId)
+{
+ PyObject *handler;
+ PyObject *result;
+
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "notationDecl")) {
+ result = PyObject_CallMethod(handler, (char *) "notationDecl",
+ (char *) "sss", name, publicId,
+ systemId);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonAttributeDecl(void *user_data,
+ const xmlChar * elem,
+ const xmlChar * name,
+ int type,
+ int def,
+ const xmlChar * defaultValue, xmlEnumerationPtr tree)
+{
+ PyObject *handler;
+ PyObject *nameList;
+ PyObject *newName;
+ xmlEnumerationPtr node;
+ PyObject *result;
+ int count;
+
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "attributeDecl")) {
+ count = 0;
+ for (node = tree; node != NULL; node = node->next) {
+ count++;
+ }
+ nameList = PyList_New(count);
+ count = 0;
+ for (node = tree; node != NULL; node = node->next) {
+ newName = PyString_FromString((char *) node->name);
+ PyList_SetItem(nameList, count, newName);
+ count++;
+ }
+ result = PyObject_CallMethod(handler, (char *) "attributeDecl",
+ (char *) "ssiisO", elem, name, type,
+ def, defaultValue, nameList);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(nameList);
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonElementDecl(void *user_data,
+ const xmlChar * name,
+ int type, ATTRIBUTE_UNUSED xmlElementContentPtr content)
+{
+ PyObject *handler;
+ PyObject *obj;
+ PyObject *result;
+
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "elementDecl")) {
+ /* TODO: wrap in an elementContent object */
+ printf
+ ("pythonElementDecl: xmlElementContentPtr wrapper missing !\n");
+ obj = Py_None;
+ /* Py_XINCREF(Py_None); isn't the reference just borrowed ??? */
+ result = PyObject_CallMethod(handler, (char *) "elementDecl",
+ (char *) "siO", name, type, obj);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonUnparsedEntityDecl(void *user_data,
+ const xmlChar * name,
+ const xmlChar * publicId,
+ const xmlChar * systemId,
+ const xmlChar * notationName)
+{
+ PyObject *handler;
+ PyObject *result;
+
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "unparsedEntityDecl")) {
+ result =
+ PyObject_CallMethod(handler, (char *) "unparsedEntityDecl",
+ (char *) "ssss", name, publicId, systemId,
+ notationName);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+}
+
+static void
+pythonInternalSubset(void *user_data, const xmlChar * name,
+ const xmlChar * ExternalID, const xmlChar * SystemID)
+{
+ PyObject *handler;
+ PyObject *result;
+
+#ifdef DEBUG_SAX
+ printf("pythonInternalSubset(%s, %s, %s) called\n",
+ name, ExternalID, SystemID);
+#endif
+ handler = (PyObject *) user_data;
+ if (PyObject_HasAttrString(handler, (char *) "internalSubset")) {
+ result = PyObject_CallMethod(handler, (char *) "internalSubset",
+ (char *) "sss", name, ExternalID,
+ SystemID);
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+}
+
+static xmlSAXHandler pythonSaxHandler = {
+ pythonInternalSubset,
+ NULL, /* TODO pythonIsStandalone, */
+ NULL, /* TODO pythonHasInternalSubset, */
+ NULL, /* TODO pythonHasExternalSubset, */
+ NULL, /* TODO pythonResolveEntity, */
+ NULL, /* TODO pythonGetEntity, */
+ pythonEntityDecl,
+ pythonNotationDecl,
+ pythonAttributeDecl,
+ pythonElementDecl,
+ pythonUnparsedEntityDecl,
+ NULL, /* OBSOLETED pythonSetDocumentLocator, */
+ pythonStartDocument,
+ pythonEndDocument,
+ pythonStartElement,
+ pythonEndElement,
+ pythonReference,
+ pythonCharacters,
+ pythonIgnorableWhitespace,
+ pythonProcessingInstruction,
+ pythonComment,
+ pythonWarning,
+ pythonError,
+ pythonFatalError,
+ NULL, /* TODO pythonGetParameterEntity, */
+ pythonCdataBlock,
+ pythonExternalSubset,
+ 1,
+ NULL, /* TODO mograte to SAX2 */
+ NULL,
+ NULL,
+ NULL
+};
+
+/************************************************************************
+ * *
+ * Handling of specific parser context *
+ * *
+ ************************************************************************/
+
+PyObject *
+libxml_xmlCreatePushParser(ATTRIBUTE_UNUSED PyObject * self,
+ PyObject * args)
+{
+ const char *chunk;
+ int size;
+ const char *URI;
+ PyObject *pyobj_SAX = NULL;
+ xmlSAXHandlerPtr SAX = NULL;
+ xmlParserCtxtPtr ret;
+ PyObject *pyret;
+
+ if (!PyArg_ParseTuple
+ (args, (char *) "Oziz:xmlCreatePushParser", &pyobj_SAX, &chunk,
+ &size, &URI))
+ return (NULL);
+
+#ifdef DEBUG
+ printf("libxml_xmlCreatePushParser(%p, %s, %d, %s) called\n",
+ pyobj_SAX, chunk, size, URI);
+#endif
+ if (pyobj_SAX != Py_None) {
+ SAX = &pythonSaxHandler;
+ Py_INCREF(pyobj_SAX);
+ /* The reference is released in pythonEndDocument() */
+ }
+ ret = xmlCreatePushParserCtxt(SAX, pyobj_SAX, chunk, size, URI);
+ pyret = libxml_xmlParserCtxtPtrWrap(ret);
+ return (pyret);
+}
+
+PyObject *
+libxml_htmlCreatePushParser(ATTRIBUTE_UNUSED PyObject * self,
+ PyObject * args)
+{
+ const char *chunk;
+ int size;
+ const char *URI;
+ PyObject *pyobj_SAX = NULL;
+ xmlSAXHandlerPtr SAX = NULL;
+ xmlParserCtxtPtr ret;
+ PyObject *pyret;
+
+ if (!PyArg_ParseTuple
+ (args, (char *) "Oziz:htmlCreatePushParser", &pyobj_SAX, &chunk,
+ &size, &URI))
+ return (NULL);
+
+#ifdef DEBUG
+ printf("libxml_htmlCreatePushParser(%p, %s, %d, %s) called\n",
+ pyobj_SAX, chunk, size, URI);
+#endif
+ if (pyobj_SAX != Py_None) {
+ SAX = &pythonSaxHandler;
+ Py_INCREF(pyobj_SAX);
+ /* The reference is released in pythonEndDocument() */
+ }
+ ret = htmlCreatePushParserCtxt(SAX, pyobj_SAX, chunk, size, URI,
+ XML_CHAR_ENCODING_NONE);
+ pyret = libxml_xmlParserCtxtPtrWrap(ret);
+ return (pyret);
+}
+
+PyObject *
+libxml_xmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ int recover;
+ const char *URI;
+ PyObject *pyobj_SAX = NULL;
+ xmlSAXHandlerPtr SAX = NULL;
+
+ if (!PyArg_ParseTuple(args, (char *) "Osi:xmlSAXParseFile", &pyobj_SAX,
+ &URI, &recover))
+ return (NULL);
+
+#ifdef DEBUG
+ printf("libxml_xmlSAXParseFile(%p, %s, %d) called\n",
+ pyobj_SAX, URI, recover);
+#endif
+ if (pyobj_SAX == Py_None) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ SAX = &pythonSaxHandler;
+ Py_INCREF(pyobj_SAX);
+ /* The reference is released in pythonEndDocument() */
+ xmlSAXParseFileWithData(SAX, URI, recover, pyobj_SAX);
+ Py_INCREF(Py_None);
+ return (Py_None);
+}
+
+PyObject *
+libxml_htmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ const char *URI;
+ const char *encoding;
+ PyObject *pyobj_SAX = NULL;
+ xmlSAXHandlerPtr SAX = NULL;
+
+ if (!PyArg_ParseTuple
+ (args, (char *) "Osz:htmlSAXParseFile", &pyobj_SAX, &URI,
+ &encoding))
+ return (NULL);
+
+#ifdef DEBUG
+ printf("libxml_htmlSAXParseFile(%p, %s, %s) called\n",
+ pyobj_SAX, URI, encoding);
+#endif
+ if (pyobj_SAX == Py_None) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ SAX = &pythonSaxHandler;
+ Py_INCREF(pyobj_SAX);
+ /* The reference is released in pythonEndDocument() */
+ htmlSAXParseFile(URI, encoding, SAX, pyobj_SAX);
+ Py_INCREF(Py_None);
+ return (Py_None);
+}
+
+/************************************************************************
+ * *
+ * Error message callback *
+ * *
+ ************************************************************************/
+
+static PyObject *libxml_xmlPythonErrorFuncHandler = NULL;
+static PyObject *libxml_xmlPythonErrorFuncCtxt = NULL;
+
+/* helper to build a xmlMalloc'ed string from a format and va_list */
+static char *
+libxml_buildMessage(const char *msg, va_list ap)
+{
+ int size;
+ int chars;
+ char *larger;
+ char *str;
+
+ str = (char *) xmlMalloc(150);
+ if (str == NULL)
+ return NULL;
+
+ size = 150;
+
+ while (1) {
+ chars = vsnprintf(str, size, msg, ap);
+ if ((chars > -1) && (chars < size))
+ break;
+ if (chars > -1)
+ size += chars + 1;
+ else
+ size += 100;
+ if ((larger = (char *) xmlRealloc(str, size)) == NULL) {
+ xmlFree(str);
+ return NULL;
+ }
+ str = larger;
+ }
+
+ return str;
+}
+
+static void
+libxml_xmlErrorFuncHandler(ATTRIBUTE_UNUSED void *ctx, const char *msg,
+ ...)
+{
+ va_list ap;
+ char *str;
+ PyObject *list;
+ PyObject *message;
+ PyObject *result;
+
+#ifdef DEBUG_ERROR
+ printf("libxml_xmlErrorFuncHandler(%p, %s, ...) called\n", ctx, msg);
+#endif
+
+
+ if (libxml_xmlPythonErrorFuncHandler == NULL) {
+ va_start(ap, msg);
+ vfprintf(stderr, msg, ap);
+ va_end(ap);
+ } else {
+ va_start(ap, msg);
+ str = libxml_buildMessage(msg,ap);
+ va_end(ap);
+
+ list = PyTuple_New(2);
+ PyTuple_SetItem(list, 0, libxml_xmlPythonErrorFuncCtxt);
+ Py_XINCREF(libxml_xmlPythonErrorFuncCtxt);
+ message = libxml_charPtrWrap(str);
+ PyTuple_SetItem(list, 1, message);
+ result = PyEval_CallObject(libxml_xmlPythonErrorFuncHandler, list);
+ Py_XDECREF(list);
+ Py_XDECREF(result);
+ }
+}
+
+static void
+libxml_xmlErrorInitialize(void)
+{
+#ifdef DEBUG_ERROR
+ printf("libxml_xmlErrorInitialize() called\n");
+#endif
+ xmlSetGenericErrorFunc(NULL, libxml_xmlErrorFuncHandler);
+ xmlThrDefSetGenericErrorFunc(NULL, libxml_xmlErrorFuncHandler);
+}
+
+static PyObject *
+libxml_xmlRegisterErrorHandler(ATTRIBUTE_UNUSED PyObject * self,
+ PyObject * args)
+{
+ PyObject *py_retval;
+ PyObject *pyobj_f;
+ PyObject *pyobj_ctx;
+
+ if (!PyArg_ParseTuple
+ (args, (char *) "OO:xmlRegisterErrorHandler", &pyobj_f,
+ &pyobj_ctx))
+ return (NULL);
+
+#ifdef DEBUG_ERROR
+ printf("libxml_registerXPathFunction(%p, %p) called\n", pyobj_ctx,
+ pyobj_f);
+#endif
+
+ if (libxml_xmlPythonErrorFuncHandler != NULL) {
+ Py_XDECREF(libxml_xmlPythonErrorFuncHandler);
+ }
+ if (libxml_xmlPythonErrorFuncCtxt != NULL) {
+ Py_XDECREF(libxml_xmlPythonErrorFuncCtxt);
+ }
+
+ Py_XINCREF(pyobj_ctx);
+ Py_XINCREF(pyobj_f);
+
+ /* TODO: check f is a function ! */
+ libxml_xmlPythonErrorFuncHandler = pyobj_f;
+ libxml_xmlPythonErrorFuncCtxt = pyobj_ctx;
+
+ py_retval = libxml_intWrap(1);
+ return (py_retval);
+}
+
+
+/************************************************************************
+ * *
+ * Per parserCtxt error handler *
+ * *
+ ************************************************************************/
+
+typedef struct
+{
+ PyObject *f;
+ PyObject *arg;
+} xmlParserCtxtPyCtxt;
+typedef xmlParserCtxtPyCtxt *xmlParserCtxtPyCtxtPtr;
+
+static void
+libxml_xmlParserCtxtGenericErrorFuncHandler(void *ctx, int severity, char *str)
+{
+ PyObject *list;
+ PyObject *result;
+ xmlParserCtxtPtr ctxt;
+ xmlParserCtxtPyCtxtPtr pyCtxt;
+
+#ifdef DEBUG_ERROR
+ printf("libxml_xmlParserCtxtGenericErrorFuncHandler(%p, %s, ...) called\n", ctx, msg);
+#endif
+
+ ctxt = (xmlParserCtxtPtr)ctx;
+ pyCtxt = (xmlParserCtxtPyCtxtPtr)ctxt->_private;
+
+ list = PyTuple_New(4);
+ PyTuple_SetItem(list, 0, pyCtxt->arg);
+ Py_XINCREF(pyCtxt->arg);
+ PyTuple_SetItem(list, 1, libxml_charPtrWrap(str));
+ PyTuple_SetItem(list, 2, libxml_intWrap(severity));
+ PyTuple_SetItem(list, 3, Py_None);
+ Py_INCREF(Py_None);
+ result = PyEval_CallObject(pyCtxt->f, list);
+ if (result == NULL)
+ {
+ /* TODO: manage for the exception to be propagated... */
+ PyErr_Print();
+ }
+ Py_XDECREF(list);
+ Py_XDECREF(result);
+}
+
+static void
+libxml_xmlParserCtxtErrorFuncHandler(void *ctx, const char *msg, ...)
+{
+ va_list ap;
+
+ va_start(ap, msg);
+ libxml_xmlParserCtxtGenericErrorFuncHandler(ctx,XML_PARSER_SEVERITY_ERROR,libxml_buildMessage(msg,ap));
+ va_end(ap);
+}
+
+static void
+libxml_xmlParserCtxtWarningFuncHandler(void *ctx, const char *msg, ...)
+{
+ va_list ap;
+
+ va_start(ap, msg);
+ libxml_xmlParserCtxtGenericErrorFuncHandler(ctx,XML_PARSER_SEVERITY_WARNING,libxml_buildMessage(msg,ap));
+ va_end(ap);
+}
+
+static void
+libxml_xmlParserCtxtValidityErrorFuncHandler(void *ctx, const char *msg, ...)
+{
+ va_list ap;
+
+ va_start(ap, msg);
+ libxml_xmlParserCtxtGenericErrorFuncHandler(ctx,XML_PARSER_SEVERITY_VALIDITY_ERROR,libxml_buildMessage(msg,ap));
+ va_end(ap);
+}
+
+static void
+libxml_xmlParserCtxtValidityWarningFuncHandler(void *ctx, const char *msg, ...)
+{
+ va_list ap;
+
+ va_start(ap, msg);
+ libxml_xmlParserCtxtGenericErrorFuncHandler(ctx,XML_PARSER_SEVERITY_VALIDITY_WARNING,libxml_buildMessage(msg,ap));
+ va_end(ap);
+}
+
+static PyObject *
+libxml_xmlParserCtxtSetErrorHandler(ATTRIBUTE_UNUSED PyObject *self, PyObject *args)
+{
+ PyObject *py_retval;
+ xmlParserCtxtPtr ctxt;
+ xmlParserCtxtPyCtxtPtr pyCtxt;
+ PyObject *pyobj_ctxt;
+ PyObject *pyobj_f;
+ PyObject *pyobj_arg;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOO:xmlParserCtxtSetErrorHandler",
+ &pyobj_ctxt, &pyobj_f, &pyobj_arg))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+ if (ctxt->_private == NULL) {
+ pyCtxt = xmlMalloc(sizeof(xmlParserCtxtPyCtxt));
+ if (pyCtxt == NULL) {
+ py_retval = libxml_intWrap(-1);
+ return(py_retval);
+ }
+ memset(pyCtxt,0,sizeof(xmlParserCtxtPyCtxt));
+ ctxt->_private = pyCtxt;
+ }
+ else {
+ pyCtxt = (xmlParserCtxtPyCtxtPtr)ctxt->_private;
+ }
+ /* TODO: check f is a function ! */
+ Py_XDECREF(pyCtxt->f);
+ Py_XINCREF(pyobj_f);
+ pyCtxt->f = pyobj_f;
+ Py_XDECREF(pyCtxt->arg);
+ Py_XINCREF(pyobj_arg);
+ pyCtxt->arg = pyobj_arg;
+
+ if (pyobj_f != Py_None) {
+ ctxt->sax->error = libxml_xmlParserCtxtErrorFuncHandler;
+ ctxt->sax->warning = libxml_xmlParserCtxtWarningFuncHandler;
+ ctxt->vctxt.error = libxml_xmlParserCtxtValidityErrorFuncHandler;
+ ctxt->vctxt.warning = libxml_xmlParserCtxtValidityWarningFuncHandler;
+ }
+ else {
+ ctxt->sax->error = xmlParserError;
+ ctxt->vctxt.error = xmlParserValidityError;
+ ctxt->sax->warning = xmlParserWarning;
+ ctxt->vctxt.warning = xmlParserValidityWarning;
+ }
+
+ py_retval = libxml_intWrap(1);
+ return(py_retval);
+}
+
+static PyObject *
+libxml_xmlParserCtxtGetErrorHandler(ATTRIBUTE_UNUSED PyObject *self, PyObject *args)
+{
+ PyObject *py_retval;
+ xmlParserCtxtPtr ctxt;
+ xmlParserCtxtPyCtxtPtr pyCtxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParserCtxtGetErrorHandler",
+ &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+ py_retval = PyTuple_New(2);
+ if (ctxt->_private != NULL) {
+ pyCtxt = (xmlParserCtxtPyCtxtPtr)ctxt->_private;
+
+ PyTuple_SetItem(py_retval, 0, pyCtxt->f);
+ Py_XINCREF(pyCtxt->f);
+ PyTuple_SetItem(py_retval, 1, pyCtxt->arg);
+ Py_XINCREF(pyCtxt->arg);
+ }
+ else {
+ /* no python error handler registered */
+ PyTuple_SetItem(py_retval, 0, Py_None);
+ Py_XINCREF(Py_None);
+ PyTuple_SetItem(py_retval, 1, Py_None);
+ Py_XINCREF(Py_None);
+ }
+ return(py_retval);
+}
+
+static PyObject *
+libxml_xmlFreeParserCtxt(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlParserCtxtPyCtxtPtr pyCtxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeParserCtxt", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ if (ctxt != NULL) {
+ pyCtxt = (xmlParserCtxtPyCtxtPtr)((xmlParserCtxtPtr)ctxt)->_private;
+ if (pyCtxt) {
+ Py_XDECREF(pyCtxt->f);
+ Py_XDECREF(pyCtxt->arg);
+ xmlFree(pyCtxt);
+ }
+ xmlFreeParserCtxt(ctxt);
+ }
+
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+/************************************************************************
+ * *
+ * Per xmlTextReader error handler *
+ * *
+ ************************************************************************/
+
+typedef struct
+{
+ PyObject *f;
+ PyObject *arg;
+} xmlTextReaderPyCtxt;
+typedef xmlTextReaderPyCtxt *xmlTextReaderPyCtxtPtr;
+
+static void
+libxml_xmlTextReaderErrorCallback(void *arg,
+ const char *msg,
+ int severity,
+ xmlTextReaderLocatorPtr locator)
+{
+ xmlTextReaderPyCtxt *pyCtxt = (xmlTextReaderPyCtxt *)arg;
+ PyObject *list;
+ PyObject *result;
+
+ list = PyTuple_New(4);
+ PyTuple_SetItem(list, 0, pyCtxt->arg);
+ Py_XINCREF(pyCtxt->arg);
+ PyTuple_SetItem(list, 1, libxml_charPtrConstWrap(msg));
+ PyTuple_SetItem(list, 2, libxml_intWrap(severity));
+ PyTuple_SetItem(list, 3, libxml_xmlTextReaderLocatorPtrWrap(locator));
+ result = PyEval_CallObject(pyCtxt->f, list);
+ if (result == NULL)
+ {
+ /* TODO: manage for the exception to be propagated... */
+ PyErr_Print();
+ }
+ Py_XDECREF(list);
+ Py_XDECREF(result);
+}
+
+static PyObject *
+libxml_xmlTextReaderSetErrorHandler(ATTRIBUTE_UNUSED PyObject *self, PyObject *args)
+{
+ xmlTextReaderPtr reader;
+ xmlTextReaderPyCtxtPtr pyCtxt;
+ xmlTextReaderErrorFunc f;
+ void *arg;
+ PyObject *pyobj_reader;
+ PyObject *pyobj_f;
+ PyObject *pyobj_arg;
+ PyObject *py_retval;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOO:xmlTextReaderSetErrorHandler", &pyobj_reader, &pyobj_f, &pyobj_arg))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+ /* clear previous error handler */
+ xmlTextReaderGetErrorHandler(reader,&f,&arg);
+ if (arg != NULL) {
+ if (f == (xmlTextReaderErrorFunc) libxml_xmlTextReaderErrorCallback) {
+ /* ok, it's our error handler! */
+ pyCtxt = (xmlTextReaderPyCtxtPtr)arg;
+ Py_XDECREF(pyCtxt->f);
+ Py_XDECREF(pyCtxt->arg);
+ xmlFree(pyCtxt);
+ }
+ else {
+ /*
+ * there already an arg, and it's not ours,
+ * there is definitely something wrong going on here...
+ * we don't know how to free it, so we bail out...
+ */
+ py_retval = libxml_intWrap(-1);
+ return(py_retval);
+ }
+ }
+ xmlTextReaderSetErrorHandler(reader,NULL,NULL);
+ /* set new error handler */
+ if (pyobj_f != Py_None)
+ {
+ pyCtxt = (xmlTextReaderPyCtxtPtr)xmlMalloc(sizeof(xmlTextReaderPyCtxt));
+ if (pyCtxt == NULL) {
+ py_retval = libxml_intWrap(-1);
+ return(py_retval);
+ }
+ Py_XINCREF(pyobj_f);
+ pyCtxt->f = pyobj_f;
+ Py_XINCREF(pyobj_arg);
+ pyCtxt->arg = pyobj_arg;
+ xmlTextReaderSetErrorHandler(reader,
+ (xmlTextReaderErrorFunc) libxml_xmlTextReaderErrorCallback,
+ pyCtxt);
+ }
+
+ py_retval = libxml_intWrap(1);
+ return(py_retval);
+}
+
+static PyObject *
+libxml_xmlTextReaderGetErrorHandler(ATTRIBUTE_UNUSED PyObject *self, PyObject *args)
+{
+ xmlTextReaderPtr reader;
+ xmlTextReaderPyCtxtPtr pyCtxt;
+ xmlTextReaderErrorFunc f;
+ void *arg;
+ PyObject *pyobj_reader;
+ PyObject *py_retval;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderSetErrorHandler", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+ xmlTextReaderGetErrorHandler(reader,&f,&arg);
+ py_retval = PyTuple_New(2);
+ if (f == (xmlTextReaderErrorFunc)libxml_xmlTextReaderErrorCallback) {
+ /* ok, it's our error handler! */
+ pyCtxt = (xmlTextReaderPyCtxtPtr)arg;
+ PyTuple_SetItem(py_retval, 0, pyCtxt->f);
+ Py_XINCREF(pyCtxt->f);
+ PyTuple_SetItem(py_retval, 1, pyCtxt->arg);
+ Py_XINCREF(pyCtxt->arg);
+ }
+ else
+ {
+ /* f is null or it's not our error handler */
+ PyTuple_SetItem(py_retval, 0, Py_None);
+ Py_XINCREF(Py_None);
+ PyTuple_SetItem(py_retval, 1, Py_None);
+ Py_XINCREF(Py_None);
+ }
+ return(py_retval);
+}
+
+static PyObject *
+libxml_xmlFreeTextReader(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) {
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ xmlTextReaderPyCtxtPtr pyCtxt;
+ xmlTextReaderErrorFunc f;
+ void *arg;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeTextReader", &pyobj_reader))
+ return(NULL);
+ if (!PyCObject_Check(pyobj_reader)) {
+ Py_INCREF(Py_None);
+ return(Py_None);
+ }
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+ if (reader == NULL) {
+ Py_INCREF(Py_None);
+ return(Py_None);
+ }
+
+ xmlTextReaderGetErrorHandler(reader,&f,&arg);
+ if (arg != NULL) {
+ if (f == (xmlTextReaderErrorFunc) libxml_xmlTextReaderErrorCallback) {
+ /* ok, it's our error handler! */
+ pyCtxt = (xmlTextReaderPyCtxtPtr)arg;
+ Py_XDECREF(pyCtxt->f);
+ Py_XDECREF(pyCtxt->arg);
+ xmlFree(pyCtxt);
+ }
+ /*
+ * else, something wrong happened, because the error handler is
+ * not owned by the python bindings...
+ */
+ }
+
+ xmlFreeTextReader(reader);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+/************************************************************************
+ * *
+ * XPath extensions *
+ * *
+ ************************************************************************/
+
+static int libxml_xpathCallbacksInitialized = 0;
+
+typedef struct libxml_xpathCallback {
+ xmlXPathContextPtr ctx;
+ xmlChar *name;
+ xmlChar *ns_uri;
+ PyObject *function;
+} libxml_xpathCallback, *libxml_xpathCallbackPtr;
+static libxml_xpathCallback libxml_xpathCallbacks[10];
+static int libxml_xpathCallbacksNb = 0;
+static int libxml_xpathCallbacksMax = 10;
+
+static void
+libxml_xmlXPathFuncCallback(xmlXPathParserContextPtr ctxt, int nargs)
+{
+ PyObject *list, *cur, *result;
+ xmlXPathObjectPtr obj;
+ xmlXPathContextPtr rctxt;
+ PyObject *current_function = NULL;
+ const xmlChar *name;
+ const xmlChar *ns_uri;
+ int i;
+
+ if (ctxt == NULL)
+ return;
+ rctxt = ctxt->context;
+ if (rctxt == NULL)
+ return;
+ name = rctxt->function;
+ ns_uri = rctxt->functionURI;
+#ifdef DEBUG_XPATH
+ printf("libxml_xmlXPathFuncCallback called name %s URI %s\n", name,
+ ns_uri);
+#endif
+
+ /*
+ * Find the function, it should be there it was there at lookup
+ */
+ for (i = 0; i < libxml_xpathCallbacksNb; i++) {
+ if ( /* TODO (ctxt == libxml_xpathCallbacks[i].ctx) && */
+ (xmlStrEqual(name, libxml_xpathCallbacks[i].name)) &&
+ (xmlStrEqual(ns_uri, libxml_xpathCallbacks[i].ns_uri))) {
+ current_function = libxml_xpathCallbacks[i].function;
+ }
+ }
+ if (current_function == NULL) {
+ printf
+ ("libxml_xmlXPathFuncCallback: internal error %s not found !\n",
+ name);
+ return;
+ }
+
+ list = PyTuple_New(nargs + 1);
+ PyTuple_SetItem(list, 0, libxml_xmlXPathParserContextPtrWrap(ctxt));
+ for (i = nargs - 1; i >= 0; i--) {
+ obj = valuePop(ctxt);
+ cur = libxml_xmlXPathObjectPtrWrap(obj);
+ PyTuple_SetItem(list, i + 1, cur);
+ }
+ result = PyEval_CallObject(current_function, list);
+ Py_DECREF(list);
+
+ obj = libxml_xmlXPathObjectPtrConvert(result);
+ valuePush(ctxt, obj);
+}
+
+static xmlXPathFunction
+libxml_xmlXPathFuncLookupFunc(void *ctxt, const xmlChar * name,
+ const xmlChar * ns_uri)
+{
+ int i;
+
+#ifdef DEBUG_XPATH
+ printf("libxml_xmlXPathFuncLookupFunc(%p, %s, %s) called\n",
+ ctxt, name, ns_uri);
+#endif
+ /*
+ * This is called once only. The address is then stored in the
+ * XPath expression evaluation, the proper object to call can
+ * then still be found using the execution context function
+ * and functionURI fields.
+ */
+ for (i = 0; i < libxml_xpathCallbacksNb; i++) {
+ if ((ctxt == libxml_xpathCallbacks[i].ctx) &&
+ (xmlStrEqual(name, libxml_xpathCallbacks[i].name)) &&
+ (xmlStrEqual(ns_uri, libxml_xpathCallbacks[i].ns_uri))) {
+ return (libxml_xmlXPathFuncCallback);
+ }
+ }
+ return (NULL);
+}
+
+static void
+libxml_xpathCallbacksInitialize(void)
+{
+ int i;
+
+ if (libxml_xpathCallbacksInitialized != 0)
+ return;
+
+#ifdef DEBUG_XPATH
+ printf("libxml_xpathCallbacksInitialized called\n");
+#endif
+
+ for (i = 0; i < libxml_xpathCallbacksMax; i++) {
+ libxml_xpathCallbacks[i].ctx = NULL;
+ libxml_xpathCallbacks[i].name = NULL;
+ libxml_xpathCallbacks[i].ns_uri = NULL;
+ libxml_xpathCallbacks[i].function = NULL;
+ }
+ libxml_xpathCallbacksInitialized = 1;
+}
+
+PyObject *
+libxml_xmlRegisterXPathFunction(ATTRIBUTE_UNUSED PyObject * self,
+ PyObject * args)
+{
+ PyObject *py_retval;
+ int c_retval = 0;
+ xmlChar *name;
+ xmlChar *ns_uri;
+ xmlXPathContextPtr ctx;
+ PyObject *pyobj_ctx;
+ PyObject *pyobj_f;
+ int i;
+
+ if (!PyArg_ParseTuple
+ (args, (char *) "OszO:registerXPathFunction", &pyobj_ctx, &name,
+ &ns_uri, &pyobj_f))
+ return (NULL);
+
+ ctx = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctx);
+ if (libxml_xpathCallbacksInitialized == 0)
+ libxml_xpathCallbacksInitialize();
+ xmlXPathRegisterFuncLookup(ctx, libxml_xmlXPathFuncLookupFunc, ctx);
+
+ if ((pyobj_ctx == NULL) || (name == NULL) || (pyobj_f == NULL)) {
+ py_retval = libxml_intWrap(-1);
+ return (py_retval);
+ }
+#ifdef DEBUG_XPATH
+ printf("libxml_registerXPathFunction(%p, %s, %s) called\n",
+ ctx, name, ns_uri);
+#endif
+ for (i = 0; i < libxml_xpathCallbacksNb; i++) {
+ if ((ctx == libxml_xpathCallbacks[i].ctx) &&
+ (xmlStrEqual(name, libxml_xpathCallbacks[i].name)) &&
+ (xmlStrEqual(ns_uri, libxml_xpathCallbacks[i].ns_uri))) {
+ Py_XINCREF(pyobj_f);
+ Py_XDECREF(libxml_xpathCallbacks[i].function);
+ libxml_xpathCallbacks[i].function = pyobj_f;
+ c_retval = 1;
+ goto done;
+ }
+ }
+ if (libxml_xpathCallbacksNb >= libxml_xpathCallbacksMax) {
+ printf("libxml_registerXPathFunction() table full\n");
+ } else {
+ i = libxml_xpathCallbacksNb++;
+ Py_XINCREF(pyobj_f);
+ libxml_xpathCallbacks[i].ctx = ctx;
+ libxml_xpathCallbacks[i].name = xmlStrdup(name);
+ libxml_xpathCallbacks[i].ns_uri = xmlStrdup(ns_uri);
+ libxml_xpathCallbacks[i].function = pyobj_f;
+ c_retval = 1;
+ }
+ done:
+ py_retval = libxml_intWrap((int) c_retval);
+ return (py_retval);
+}
+
+/************************************************************************
+ * *
+ * Global properties access *
+ * *
+ ************************************************************************/
+static PyObject *
+libxml_name(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ PyObject *resultobj, *obj;
+ xmlNodePtr cur;
+ const xmlChar *res;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:name", &obj))
+ return NULL;
+ cur = PyxmlNode_Get(obj);
+
+#ifdef DEBUG
+ printf("libxml_name: cur = %p type %d\n", cur, cur->type);
+#endif
+
+ switch (cur->type) {
+ case XML_DOCUMENT_NODE:
+#ifdef LIBXML_DOCB_ENABLED
+ case XML_DOCB_DOCUMENT_NODE:
+#endif
+ case XML_HTML_DOCUMENT_NODE:{
+ xmlDocPtr doc = (xmlDocPtr) cur;
+
+ res = doc->URL;
+ break;
+ }
+ case XML_ATTRIBUTE_NODE:{
+ xmlAttrPtr attr = (xmlAttrPtr) cur;
+
+ res = attr->name;
+ break;
+ }
+ case XML_NAMESPACE_DECL:{
+ xmlNsPtr ns = (xmlNsPtr) cur;
+
+ res = ns->prefix;
+ break;
+ }
+ default:
+ res = cur->name;
+ break;
+ }
+ resultobj = libxml_constxmlCharPtrWrap(res);
+
+ return resultobj;
+}
+
+static PyObject *
+libxml_doc(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ PyObject *resultobj, *obj;
+ xmlNodePtr cur;
+ xmlDocPtr res;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:doc", &obj))
+ return NULL;
+ cur = PyxmlNode_Get(obj);
+
+#ifdef DEBUG
+ printf("libxml_doc: cur = %p\n", cur);
+#endif
+
+ switch (cur->type) {
+ case XML_DOCUMENT_NODE:
+#ifdef LIBXML_DOCB_ENABLED
+ case XML_DOCB_DOCUMENT_NODE:
+#endif
+ case XML_HTML_DOCUMENT_NODE:
+ res = NULL;
+ break;
+ case XML_ATTRIBUTE_NODE:{
+ xmlAttrPtr attr = (xmlAttrPtr) cur;
+
+ res = attr->doc;
+ break;
+ }
+ case XML_NAMESPACE_DECL:
+ res = NULL;
+ break;
+ default:
+ res = cur->doc;
+ break;
+ }
+ resultobj = libxml_xmlDocPtrWrap(res);
+ return resultobj;
+}
+
+static PyObject *
+libxml_properties(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ PyObject *resultobj, *obj;
+ xmlNodePtr cur = NULL;
+ xmlAttrPtr res;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:properties", &obj))
+ return NULL;
+ cur = PyxmlNode_Get(obj);
+ if (cur->type == XML_ELEMENT_NODE)
+ res = cur->properties;
+ else
+ res = NULL;
+ resultobj = libxml_xmlAttrPtrWrap(res);
+ return resultobj;
+}
+
+static PyObject *
+libxml_next(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ PyObject *resultobj, *obj;
+ xmlNodePtr cur;
+ xmlNodePtr res;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:next", &obj))
+ return NULL;
+ cur = PyxmlNode_Get(obj);
+
+#ifdef DEBUG
+ printf("libxml_next: cur = %p\n", cur);
+#endif
+
+ switch (cur->type) {
+ case XML_DOCUMENT_NODE:
+#ifdef LIBXML_DOCB_ENABLED
+ case XML_DOCB_DOCUMENT_NODE:
+#endif
+ case XML_HTML_DOCUMENT_NODE:
+ res = NULL;
+ break;
+ case XML_ATTRIBUTE_NODE:{
+ xmlAttrPtr attr = (xmlAttrPtr) cur;
+
+ res = (xmlNodePtr) attr->next;
+ break;
+ }
+ case XML_NAMESPACE_DECL:{
+ xmlNsPtr ns = (xmlNsPtr) cur;
+
+ res = (xmlNodePtr) ns->next;
+ break;
+ }
+ default:
+ res = cur->next;
+ break;
+
+ }
+ resultobj = libxml_xmlNodePtrWrap(res);
+ return resultobj;
+}
+
+static PyObject *
+libxml_prev(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ PyObject *resultobj, *obj;
+ xmlNodePtr cur;
+ xmlNodePtr res;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:prev", &obj))
+ return NULL;
+ cur = PyxmlNode_Get(obj);
+
+#ifdef DEBUG
+ printf("libxml_prev: cur = %p\n", cur);
+#endif
+
+ switch (cur->type) {
+ case XML_DOCUMENT_NODE:
+#ifdef LIBXML_DOCB_ENABLED
+ case XML_DOCB_DOCUMENT_NODE:
+#endif
+ case XML_HTML_DOCUMENT_NODE:
+ res = NULL;
+ break;
+ case XML_ATTRIBUTE_NODE:{
+ xmlAttrPtr attr = (xmlAttrPtr) cur;
+
+ res = (xmlNodePtr) attr->prev;
+ }
+ case XML_NAMESPACE_DECL:
+ res = NULL;
+ break;
+ default:
+ res = cur->prev;
+ break;
+ }
+ resultobj = libxml_xmlNodePtrWrap(res);
+ return resultobj;
+}
+
+static PyObject *
+libxml_children(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ PyObject *resultobj, *obj;
+ xmlNodePtr cur;
+ xmlNodePtr res;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:children", &obj))
+ return NULL;
+ cur = PyxmlNode_Get(obj);
+
+#ifdef DEBUG
+ printf("libxml_children: cur = %p\n", cur);
+#endif
+
+ switch (cur->type) {
+ case XML_ELEMENT_NODE:
+ case XML_ENTITY_REF_NODE:
+ case XML_ENTITY_NODE:
+ case XML_PI_NODE:
+ case XML_COMMENT_NODE:
+ case XML_DOCUMENT_NODE:
+#ifdef LIBXML_DOCB_ENABLED
+ case XML_DOCB_DOCUMENT_NODE:
+#endif
+ case XML_HTML_DOCUMENT_NODE:
+ case XML_DTD_NODE:
+ res = cur->children;
+ break;
+ case XML_ATTRIBUTE_NODE:{
+ xmlAttrPtr attr = (xmlAttrPtr) cur;
+
+ res = attr->children;
+ break;
+ }
+ default:
+ res = NULL;
+ break;
+ }
+ resultobj = libxml_xmlNodePtrWrap(res);
+ return resultobj;
+}
+
+static PyObject *
+libxml_last(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ PyObject *resultobj, *obj;
+ xmlNodePtr cur;
+ xmlNodePtr res;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:last", &obj))
+ return NULL;
+ cur = PyxmlNode_Get(obj);
+
+#ifdef DEBUG
+ printf("libxml_last: cur = %p\n", cur);
+#endif
+
+ switch (cur->type) {
+ case XML_ELEMENT_NODE:
+ case XML_ENTITY_REF_NODE:
+ case XML_ENTITY_NODE:
+ case XML_PI_NODE:
+ case XML_COMMENT_NODE:
+ case XML_DOCUMENT_NODE:
+#ifdef LIBXML_DOCB_ENABLED
+ case XML_DOCB_DOCUMENT_NODE:
+#endif
+ case XML_HTML_DOCUMENT_NODE:
+ case XML_DTD_NODE:
+ res = cur->last;
+ break;
+ case XML_ATTRIBUTE_NODE:{
+ xmlAttrPtr attr = (xmlAttrPtr) cur;
+
+ res = attr->last;
+ }
+ default:
+ res = NULL;
+ break;
+ }
+ resultobj = libxml_xmlNodePtrWrap(res);
+ return resultobj;
+}
+
+static PyObject *
+libxml_parent(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ PyObject *resultobj, *obj;
+ xmlNodePtr cur;
+ xmlNodePtr res;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:parent", &obj))
+ return NULL;
+ cur = PyxmlNode_Get(obj);
+
+#ifdef DEBUG
+ printf("libxml_parent: cur = %p\n", cur);
+#endif
+
+ switch (cur->type) {
+ case XML_DOCUMENT_NODE:
+ case XML_HTML_DOCUMENT_NODE:
+#ifdef LIBXML_DOCB_ENABLED
+ case XML_DOCB_DOCUMENT_NODE:
+#endif
+ res = NULL;
+ break;
+ case XML_ATTRIBUTE_NODE:{
+ xmlAttrPtr attr = (xmlAttrPtr) cur;
+
+ res = attr->parent;
+ }
+ case XML_ENTITY_DECL:
+ case XML_NAMESPACE_DECL:
+ case XML_XINCLUDE_START:
+ case XML_XINCLUDE_END:
+ res = NULL;
+ break;
+ default:
+ res = cur->parent;
+ break;
+ }
+ resultobj = libxml_xmlNodePtrWrap(res);
+ return resultobj;
+}
+
+static PyObject *
+libxml_type(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ PyObject *resultobj, *obj;
+ xmlNodePtr cur;
+ const xmlChar *res = NULL;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:last", &obj))
+ return NULL;
+ cur = PyxmlNode_Get(obj);
+
+#ifdef DEBUG
+ printf("libxml_type: cur = %p\n", cur);
+#endif
+
+ switch (cur->type) {
+ case XML_ELEMENT_NODE:
+ res = (const xmlChar *) "element";
+ break;
+ case XML_ATTRIBUTE_NODE:
+ res = (const xmlChar *) "attribute";
+ break;
+ case XML_TEXT_NODE:
+ res = (const xmlChar *) "text";
+ break;
+ case XML_CDATA_SECTION_NODE:
+ res = (const xmlChar *) "cdata";
+ break;
+ case XML_ENTITY_REF_NODE:
+ res = (const xmlChar *) "entity_ref";
+ break;
+ case XML_ENTITY_NODE:
+ res = (const xmlChar *) "entity";
+ break;
+ case XML_PI_NODE:
+ res = (const xmlChar *) "pi";
+ break;
+ case XML_COMMENT_NODE:
+ res = (const xmlChar *) "comment";
+ break;
+ case XML_DOCUMENT_NODE:
+ res = (const xmlChar *) "document_xml";
+ break;
+ case XML_DOCUMENT_TYPE_NODE:
+ res = (const xmlChar *) "doctype";
+ break;
+ case XML_DOCUMENT_FRAG_NODE:
+ res = (const xmlChar *) "fragment";
+ break;
+ case XML_NOTATION_NODE:
+ res = (const xmlChar *) "notation";
+ break;
+ case XML_HTML_DOCUMENT_NODE:
+ res = (const xmlChar *) "document_html";
+ break;
+ case XML_DTD_NODE:
+ res = (const xmlChar *) "dtd";
+ break;
+ case XML_ELEMENT_DECL:
+ res = (const xmlChar *) "elem_decl";
+ break;
+ case XML_ATTRIBUTE_DECL:
+ res = (const xmlChar *) "attribute_decl";
+ break;
+ case XML_ENTITY_DECL:
+ res = (const xmlChar *) "entity_decl";
+ break;
+ case XML_NAMESPACE_DECL:
+ res = (const xmlChar *) "namespace";
+ break;
+ case XML_XINCLUDE_START:
+ res = (const xmlChar *) "xinclude_start";
+ break;
+ case XML_XINCLUDE_END:
+ res = (const xmlChar *) "xinclude_end";
+ break;
+#ifdef LIBXML_DOCB_ENABLED
+ case XML_DOCB_DOCUMENT_NODE:
+ res = (const xmlChar *) "document_docbook";
+ break;
+#endif
+ }
+#ifdef DEBUG
+ printf("libxml_type: cur = %p: %s\n", cur, res);
+#endif
+
+ resultobj = libxml_constxmlCharPtrWrap(res);
+ return resultobj;
+}
+
+/************************************************************************
+ * *
+ * Specific accessor functions *
+ * *
+ ************************************************************************/
+PyObject *
+libxml_xmlNodeGetNsDefs(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ PyObject *py_retval;
+ xmlNsPtr c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+
+ if (!PyArg_ParseTuple
+ (args, (char *) "O:xmlNodeGetNsDefs", &pyobj_node))
+ return (NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ if ((node == NULL) || (node->type != XML_ELEMENT_NODE)) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ c_retval = node->nsDef;
+ py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval);
+ return (py_retval);
+}
+
+PyObject *
+libxml_xmlNodeGetNs(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ PyObject *py_retval;
+ xmlNsPtr c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:xmlNodeGetNs", &pyobj_node))
+ return (NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ if ((node == NULL) ||
+ ((node->type != XML_ELEMENT_NODE) &&
+ (node->type != XML_ATTRIBUTE_NODE))) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ c_retval = node->ns;
+ py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval);
+ return (py_retval);
+}
+
+#ifdef LIBXML_OUTPUT_ENABLED
+/************************************************************************
+ * *
+ * Serialization front-end *
+ * *
+ ************************************************************************/
+
+static PyObject *
+libxml_serializeNode(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ PyObject *py_retval = NULL;
+ xmlChar *c_retval;
+ PyObject *pyobj_node;
+ xmlNodePtr node;
+ xmlDocPtr doc;
+ const char *encoding;
+ int format;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *) "Ozi:serializeNode", &pyobj_node,
+ &encoding, &format))
+ return (NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ if (node == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ if (node->type == XML_DOCUMENT_NODE) {
+ doc = (xmlDocPtr) node;
+ xmlDocDumpFormatMemoryEnc(doc, &c_retval, &len,
+ (const char *) encoding, format);
+ py_retval = libxml_charPtrWrap((char *) c_retval);
+ } else if (node->type == XML_HTML_DOCUMENT_NODE) {
+ xmlOutputBufferPtr buf;
+ xmlCharEncodingHandlerPtr handler = NULL;
+
+ doc = (xmlDocPtr) node;
+ if (encoding != NULL)
+ htmlSetMetaEncoding(doc, (const xmlChar *) encoding);
+ encoding = (const char *) htmlGetMetaEncoding(doc);
+
+ if (encoding != NULL) {
+ handler = xmlFindCharEncodingHandler(encoding);
+ if (handler == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ }
+
+ /*
+ * Fallback to HTML or ASCII when the encoding is unspecified
+ */
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler("HTML");
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler("ascii");
+
+ buf = xmlAllocOutputBuffer(handler);
+ if (buf == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ htmlDocContentDumpFormatOutput(buf, doc, encoding, format);
+ xmlOutputBufferFlush(buf);
+ if (buf->conv != NULL) {
+ len = buf->conv->use;
+ c_retval = buf->conv->content;
+ buf->conv->content = NULL;
+ } else {
+ len = buf->buffer->use;
+ c_retval = buf->buffer->content;
+ buf->buffer->content = NULL;
+ }
+ (void) xmlOutputBufferClose(buf);
+ py_retval = libxml_charPtrWrap((char *) c_retval);
+ } else {
+ if (node->type == XML_NAMESPACE_DECL)
+ doc = NULL;
+ else
+ doc = node->doc;
+ if ((doc == NULL) || (doc->type == XML_DOCUMENT_NODE)) {
+ xmlOutputBufferPtr buf;
+ xmlCharEncodingHandlerPtr handler = NULL;
+
+ if (encoding != NULL) {
+ handler = xmlFindCharEncodingHandler(encoding);
+ if (handler == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ }
+
+ buf = xmlAllocOutputBuffer(handler);
+ if (buf == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ xmlNodeDumpOutput(buf, doc, node, 0, format, encoding);
+ xmlOutputBufferFlush(buf);
+ if (buf->conv != NULL) {
+ len = buf->conv->use;
+ c_retval = buf->conv->content;
+ buf->conv->content = NULL;
+ } else {
+ len = buf->buffer->use;
+ c_retval = buf->buffer->content;
+ buf->buffer->content = NULL;
+ }
+ (void) xmlOutputBufferClose(buf);
+ py_retval = libxml_charPtrWrap((char *) c_retval);
+ } else if (doc->type == XML_HTML_DOCUMENT_NODE) {
+ xmlOutputBufferPtr buf;
+ xmlCharEncodingHandlerPtr handler = NULL;
+
+ if (encoding != NULL)
+ htmlSetMetaEncoding(doc, (const xmlChar *) encoding);
+ encoding = (const char *) htmlGetMetaEncoding(doc);
+ if (encoding != NULL) {
+ handler = xmlFindCharEncodingHandler(encoding);
+ if (handler == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ }
+
+ /*
+ * Fallback to HTML or ASCII when the encoding is unspecified
+ */
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler("HTML");
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler("ascii");
+
+ buf = xmlAllocOutputBuffer(handler);
+ if (buf == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ htmlNodeDumpFormatOutput(buf, doc, node, encoding, format);
+ xmlOutputBufferFlush(buf);
+ if (buf->conv != NULL) {
+ len = buf->conv->use;
+ c_retval = buf->conv->content;
+ buf->conv->content = NULL;
+ } else {
+ len = buf->buffer->use;
+ c_retval = buf->buffer->content;
+ buf->buffer->content = NULL;
+ }
+ (void) xmlOutputBufferClose(buf);
+ py_retval = libxml_charPtrWrap((char *) c_retval);
+ } else {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ }
+ return (py_retval);
+}
+
+static PyObject *
+libxml_saveNodeTo(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ PyObject *py_file = NULL;
+ FILE *output;
+ PyObject *pyobj_node;
+ xmlNodePtr node;
+ xmlDocPtr doc;
+ const char *encoding;
+ int format;
+ int len;
+ xmlOutputBufferPtr buf;
+ xmlCharEncodingHandlerPtr handler = NULL;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOzi:serializeNode", &pyobj_node,
+ &py_file, &encoding, &format))
+ return (NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ if (node == NULL) {
+ return (PyInt_FromLong((long) -1));
+ }
+ if ((py_file == NULL) || (!(PyFile_Check(py_file)))) {
+ return (PyInt_FromLong((long) -1));
+ }
+ output = PyFile_AsFile(py_file);
+ if (output == NULL) {
+ return (PyInt_FromLong((long) -1));
+ }
+
+ if (node->type == XML_DOCUMENT_NODE) {
+ doc = (xmlDocPtr) node;
+ } else if (node->type == XML_HTML_DOCUMENT_NODE) {
+ doc = (xmlDocPtr) node;
+ } else {
+ doc = node->doc;
+ }
+ if (doc->type == XML_HTML_DOCUMENT_NODE) {
+ if (encoding == NULL)
+ encoding = (const char *) htmlGetMetaEncoding(doc);
+ }
+ if (encoding != NULL) {
+ handler = xmlFindCharEncodingHandler(encoding);
+ if (handler == NULL) {
+ return (PyInt_FromLong((long) -1));
+ }
+ }
+ if (doc->type == XML_HTML_DOCUMENT_NODE) {
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler("HTML");
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler("ascii");
+ }
+
+ buf = xmlOutputBufferCreateFile(output, handler);
+ if (node->type == XML_DOCUMENT_NODE) {
+ len = xmlSaveFormatFileTo(buf, doc, encoding, format);
+ } else if (node->type == XML_HTML_DOCUMENT_NODE) {
+ htmlDocContentDumpFormatOutput(buf, doc, encoding, format);
+ len = xmlOutputBufferClose(buf);
+ } else if (doc->type == XML_HTML_DOCUMENT_NODE) {
+ htmlNodeDumpFormatOutput(buf, doc, node, encoding, format);
+ len = xmlOutputBufferClose(buf);
+ } else {
+ xmlNodeDumpOutput(buf, doc, node, 0, format, encoding);
+ len = xmlOutputBufferClose(buf);
+ }
+ return (PyInt_FromLong((long) len));
+}
+#endif /* LIBXML_OUTPUT_ENABLED */
+
+/************************************************************************
+ * *
+ * Extra stuff *
+ * *
+ ************************************************************************/
+PyObject *
+libxml_xmlNewNode(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ PyObject *py_retval;
+ xmlChar *name;
+ xmlNodePtr node;
+
+ if (!PyArg_ParseTuple(args, (char *) "s:xmlNewNode", &name))
+ return (NULL);
+ node = (xmlNodePtr) xmlNewNode(NULL, name);
+#ifdef DEBUG
+ printf("NewNode: %s : %p\n", name, (void *) node);
+#endif
+
+ if (node == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ py_retval = libxml_xmlNodePtrWrap(node);
+ return (py_retval);
+}
+
+
+/************************************************************************
+ * *
+ * Local Catalog stuff *
+ * *
+ ************************************************************************/
+static PyObject *
+libxml_addLocalCatalog(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ xmlChar *URL;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"Os:addLocalCatalog", &pyobj_ctxt, &URL))
+ return(NULL);
+
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ if (URL != NULL) {
+ ctxt->catalogs = xmlCatalogAddLocal(ctxt->catalogs, URL);
+ }
+
+#ifdef DEBUG
+ printf("LocalCatalog: %s\n", URL);
+#endif
+
+ Py_INCREF(Py_None);
+ return (Py_None);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+
+/************************************************************************
+ * *
+ * RelaxNG error handler registration *
+ * *
+ ************************************************************************/
+
+typedef struct
+{
+ PyObject *warn;
+ PyObject *error;
+ PyObject *arg;
+} xmlRelaxNGValidCtxtPyCtxt;
+typedef xmlRelaxNGValidCtxtPyCtxt *xmlRelaxNGValidCtxtPyCtxtPtr;
+
+static void
+libxml_xmlRelaxNGValidityGenericErrorFuncHandler(void *ctx, char *str)
+{
+ PyObject *list;
+ PyObject *result;
+ xmlRelaxNGValidCtxtPyCtxtPtr pyCtxt;
+
+#ifdef DEBUG_ERROR
+ printf("libxml_xmlRelaxNGValidityGenericErrorFuncHandler(%p, %s, ...) called\n", ctx, str);
+#endif
+
+ pyCtxt = (xmlRelaxNGValidCtxtPyCtxtPtr)ctx;
+
+ list = PyTuple_New(2);
+ PyTuple_SetItem(list, 0, libxml_charPtrWrap(str));
+ PyTuple_SetItem(list, 1, pyCtxt->arg);
+ Py_XINCREF(pyCtxt->arg);
+ result = PyEval_CallObject(pyCtxt->error, list);
+ if (result == NULL)
+ {
+ /* TODO: manage for the exception to be propagated... */
+ PyErr_Print();
+ }
+ Py_XDECREF(list);
+ Py_XDECREF(result);
+}
+
+static void
+libxml_xmlRelaxNGValidityGenericWarningFuncHandler(void *ctx, char *str)
+{
+ PyObject *list;
+ PyObject *result;
+ xmlRelaxNGValidCtxtPyCtxtPtr pyCtxt;
+
+#ifdef DEBUG_ERROR
+ printf("libxml_xmlRelaxNGValidityGenericWarningFuncHandler(%p, %s, ...) called\n", ctx, str);
+#endif
+
+ pyCtxt = (xmlRelaxNGValidCtxtPyCtxtPtr)ctx;
+
+ list = PyTuple_New(2);
+ PyTuple_SetItem(list, 0, libxml_charPtrWrap(str));
+ PyTuple_SetItem(list, 1, pyCtxt->arg);
+ Py_XINCREF(pyCtxt->arg);
+ result = PyEval_CallObject(pyCtxt->warn, list);
+ if (result == NULL)
+ {
+ /* TODO: manage for the exception to be propagated... */
+ PyErr_Print();
+ }
+ Py_XDECREF(list);
+ Py_XDECREF(result);
+}
+
+static void
+libxml_xmlRelaxNGValidityErrorFunc(void *ctx, const char *msg, ...)
+{
+ va_list ap;
+
+ va_start(ap, msg);
+ libxml_xmlRelaxNGValidityGenericErrorFuncHandler(ctx, libxml_buildMessage(msg, ap));
+ va_end(ap);
+}
+
+static void
+libxml_xmlRelaxNGValidityWarningFunc(void *ctx, const char *msg, ...)
+{
+ va_list ap;
+
+ va_start(ap, msg);
+ libxml_xmlRelaxNGValidityGenericWarningFuncHandler(ctx, libxml_buildMessage(msg, ap));
+ va_end(ap);
+}
+
+static PyObject *
+libxml_xmlRelaxNGSetValidErrors(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+{
+ PyObject *py_retval;
+ PyObject *pyobj_error;
+ PyObject *pyobj_warn;
+ PyObject *pyobj_ctx;
+ PyObject *pyobj_arg = Py_None;
+ xmlRelaxNGValidCtxtPtr ctxt;
+ xmlRelaxNGValidCtxtPyCtxtPtr pyCtxt;
+
+ if (!PyArg_ParseTuple
+ (args, (char *) "OOO|O:xmlRelaxNGSetValidErrors", &pyobj_ctx, &pyobj_error, &pyobj_warn, &pyobj_arg))
+ return (NULL);
+
+#ifdef DEBUG_ERROR
+ printf("libxml_xmlRelaxNGSetValidErrors(%p, %p, %p) called\n", pyobj_ctx, pyobj_error, pyobj_warn);
+#endif
+
+ ctxt = PyrelaxNgValidCtxt_Get(pyobj_ctx);
+ if (xmlRelaxNGGetValidErrors(ctxt, NULL, NULL, (void **) &pyCtxt) == -1)
+ {
+ py_retval = libxml_intWrap(-1);
+ return(py_retval);
+ }
+
+ if (pyCtxt == NULL)
+ {
+ /* first time to set the error handlers */
+ pyCtxt = xmlMalloc(sizeof(xmlRelaxNGValidCtxtPyCtxt));
+ if (pyCtxt == NULL) {
+ py_retval = libxml_intWrap(-1);
+ return(py_retval);
+ }
+ memset(pyCtxt, 0, sizeof(xmlRelaxNGValidCtxtPyCtxt));
+ }
+
+ /* TODO: check warn and error is a function ! */
+ Py_XDECREF(pyCtxt->error);
+ Py_XINCREF(pyobj_error);
+ pyCtxt->error = pyobj_error;
+
+ Py_XDECREF(pyCtxt->warn);
+ Py_XINCREF(pyobj_warn);
+ pyCtxt->warn = pyobj_warn;
+
+ Py_XDECREF(pyCtxt->arg);
+ Py_XINCREF(pyobj_arg);
+ pyCtxt->arg = pyobj_arg;
+
+ xmlRelaxNGSetValidErrors(ctxt, &libxml_xmlRelaxNGValidityErrorFunc, &libxml_xmlRelaxNGValidityWarningFunc, pyCtxt);
+
+ py_retval = libxml_intWrap(1);
+ return (py_retval);
+}
+
+static PyObject *
+libxml_xmlRelaxNGFreeValidCtxt(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) {
+ xmlRelaxNGValidCtxtPtr ctxt;
+ xmlRelaxNGValidCtxtPyCtxtPtr pyCtxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlRelaxNGFreeValidCtxt", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt);
+
+ if (xmlRelaxNGGetValidErrors(ctxt, NULL, NULL, (void **) &pyCtxt) == 0)
+ {
+ if (pyCtxt != NULL)
+ {
+ Py_XDECREF(pyCtxt->error);
+ Py_XDECREF(pyCtxt->warn);
+ Py_XDECREF(pyCtxt->arg);
+ xmlFree(pyCtxt);
+ }
+ }
+
+ xmlRelaxNGFreeValidCtxt(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif
+
+#ifdef LIBXML_C14N_ENABLED
+#ifdef LIBXML_OUTPUT_ENABLED
+
+/************************************************************************
+ * *
+ * XML Canonicalization c14n *
+ * *
+ ************************************************************************/
+
+static int
+PyxmlNodeSet_Convert(PyObject *py_nodeset, xmlNodeSetPtr *result)
+{
+ xmlNodeSetPtr nodeSet;
+ int is_tuple = 0;
+
+ if (PyTuple_Check(py_nodeset))
+ is_tuple = 1;
+ else if (PyList_Check(py_nodeset))
+ is_tuple = 0;
+ else if (py_nodeset == Py_None) {
+ *result = NULL;
+ return 0;
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError,
+ "must be a tuple or list of nodes.");
+ return -1;
+ }
+
+ nodeSet = (xmlNodeSetPtr) xmlMalloc(sizeof(xmlNodeSet));
+ if (nodeSet == NULL) {
+ PyErr_SetString(PyExc_MemoryError, "");
+ return -1;
+ }
+
+ nodeSet->nodeNr = 0;
+ nodeSet->nodeMax = (is_tuple
+ ? PyTuple_GET_SIZE(py_nodeset)
+ : PyList_GET_SIZE(py_nodeset));
+ nodeSet->nodeTab
+ = (xmlNodePtr *) xmlMalloc (nodeSet->nodeMax
+ * sizeof(xmlNodePtr));
+ if (nodeSet->nodeTab == NULL) {
+ xmlFree(nodeSet);
+ PyErr_SetString(PyExc_MemoryError, "");
+ return -1;
+ }
+ memset(nodeSet->nodeTab, 0 ,
+ nodeSet->nodeMax * sizeof(xmlNodePtr));
+
+ {
+ int idx;
+ for (idx=0; idx < nodeSet->nodeMax; ++idx) {
+ xmlNodePtr pynode =
+ PyxmlNode_Get (is_tuple
+ ? PyTuple_GET_ITEM(py_nodeset, idx)
+ : PyList_GET_ITEM(py_nodeset, idx));
+ if (pynode)
+ nodeSet->nodeTab[nodeSet->nodeNr++] = pynode;
+ }
+ }
+ *result = nodeSet;
+ return 0;
+}
+
+static int
+PystringSet_Convert(PyObject *py_strings, xmlChar *** result)
+{
+ /* NOTE: the array should be freed, but the strings are shared
+ with the python strings and so must not be freed. */
+
+ xmlChar ** strings;
+ int is_tuple = 0;
+ int count;
+ int init_index = 0;
+
+ if (PyTuple_Check(py_strings))
+ is_tuple = 1;
+ else if (PyList_Check(py_strings))
+ is_tuple = 0;
+ else if (py_strings == Py_None) {
+ *result = NULL;
+ return 0;
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError,
+ "must be a tuple or list of strings.");
+ return -1;
+ }
+
+ count = (is_tuple
+ ? PyTuple_GET_SIZE(py_strings)
+ : PyList_GET_SIZE(py_strings));
+
+ strings = (xmlChar **) xmlMalloc(sizeof(xmlChar *) * count);
+
+ if (strings == NULL) {
+ PyErr_SetString(PyExc_MemoryError, "");
+ return -1;
+ }
+
+ memset(strings, 0 , sizeof(xmlChar *) * count);
+
+ {
+ int idx;
+ for (idx=0; idx < count; ++idx) {
+ char* s = PyString_AsString
+ (is_tuple
+ ? PyTuple_GET_ITEM(py_strings, idx)
+ : PyList_GET_ITEM(py_strings, idx));
+ if (s)
+ strings[init_index++] = (xmlChar *)s;
+ else {
+ xmlFree(strings);
+ PyErr_SetString(PyExc_TypeError,
+ "must be a tuple or list of strings.");
+ return -1;
+ }
+ }
+ }
+
+ *result = strings;
+ return 0;
+}
+
+static PyObject *
+libxml_C14NDocDumpMemory(ATTRIBUTE_UNUSED PyObject * self,
+ PyObject * args)
+{
+ PyObject *py_retval = NULL;
+
+ PyObject *pyobj_doc;
+ PyObject *pyobj_nodes;
+ int exclusive;
+ PyObject *pyobj_prefixes;
+ int with_comments;
+
+ xmlDocPtr doc;
+ xmlNodeSetPtr nodes;
+ xmlChar **prefixes = NULL;
+ xmlChar *doc_txt;
+
+ int result;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOiOi:C14NDocDumpMemory",
+ &pyobj_doc,
+ &pyobj_nodes,
+ &exclusive,
+ &pyobj_prefixes,
+ &with_comments))
+ return (NULL);
+
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ if (!doc) {
+ PyErr_SetString(PyExc_TypeError, "bad document.");
+ return NULL;
+ }
+
+ result = PyxmlNodeSet_Convert(pyobj_nodes, &nodes);
+ if (result < 0) return NULL;
+
+ if (exclusive) {
+ result = PystringSet_Convert(pyobj_prefixes, &prefixes);
+ if (result < 0) {
+ if (nodes) {
+ xmlFree(nodes->nodeTab);
+ xmlFree(nodes);
+ }
+ return NULL;
+ }
+ }
+
+ result = xmlC14NDocDumpMemory(doc,
+ nodes,
+ exclusive,
+ prefixes,
+ with_comments,
+ &doc_txt);
+
+ if (nodes) {
+ xmlFree(nodes->nodeTab);
+ xmlFree(nodes);
+ }
+ if (prefixes) {
+ xmlChar ** idx = prefixes;
+ while (*idx) xmlFree(*(idx++));
+ xmlFree(prefixes);
+ }
+
+ if (result < 0) {
+ PyErr_SetString(PyExc_Exception,
+ "libxml2 xmlC14NDocDumpMemory failure.");
+ return NULL;
+ }
+ else {
+ py_retval = PyString_FromStringAndSize((const char *) doc_txt,
+ result);
+ xmlFree(doc_txt);
+ return py_retval;
+ }
+}
+
+static PyObject *
+libxml_C14NDocSaveTo(ATTRIBUTE_UNUSED PyObject * self,
+ PyObject * args)
+{
+ PyObject *pyobj_doc;
+ PyObject *py_file;
+ PyObject *pyobj_nodes;
+ int exclusive;
+ PyObject *pyobj_prefixes;
+ int with_comments;
+
+ xmlDocPtr doc;
+ xmlNodeSetPtr nodes;
+ xmlChar **prefixes = NULL;
+ FILE * output;
+ xmlOutputBufferPtr buf;
+
+ int result;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOiOiO:C14NDocSaveTo",
+ &pyobj_doc,
+ &pyobj_nodes,
+ &exclusive,
+ &pyobj_prefixes,
+ &with_comments,
+ &py_file))
+ return (NULL);
+
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ if (!doc) {
+ PyErr_SetString(PyExc_TypeError, "bad document.");
+ return NULL;
+ }
+
+ if ((py_file == NULL) || (!(PyFile_Check(py_file)))) {
+ PyErr_SetString(PyExc_TypeError, "bad file.");
+ return NULL;
+ }
+ output = PyFile_AsFile(py_file);
+ if (output == NULL) {
+ PyErr_SetString(PyExc_TypeError, "bad file.");
+ return NULL;
+ }
+ buf = xmlOutputBufferCreateFile(output, NULL);
+
+ result = PyxmlNodeSet_Convert(pyobj_nodes, &nodes);
+ if (result < 0) return NULL;
+
+ if (exclusive) {
+ result = PystringSet_Convert(pyobj_prefixes, &prefixes);
+ if (result < 0) {
+ if (nodes) {
+ xmlFree(nodes->nodeTab);
+ xmlFree(nodes);
+ }
+ return NULL;
+ }
+ }
+
+ result = xmlC14NDocSaveTo(doc,
+ nodes,
+ exclusive,
+ prefixes,
+ with_comments,
+ buf);
+
+ if (nodes) {
+ xmlFree(nodes->nodeTab);
+ xmlFree(nodes);
+ }
+ if (prefixes) {
+ xmlChar ** idx = prefixes;
+ while (*idx) xmlFree(*(idx++));
+ xmlFree(prefixes);
+ }
+
+ len = xmlOutputBufferClose(buf);
+
+ if (result < 0) {
+ PyErr_SetString(PyExc_Exception,
+ "libxml2 xmlC14NDocSaveTo failure.");
+ return NULL;
+ }
+ else
+ return PyInt_FromLong((long) len);
+}
+
+#endif
+#endif
+
+
+
+/************************************************************************
+ * *
+ * The registration stuff *
+ * *
+ ************************************************************************/
+static PyMethodDef libxmlMethods[] = {
+#include "libxml2-export.c"
+ {(char *) "name", libxml_name, METH_VARARGS, NULL},
+ {(char *) "children", libxml_children, METH_VARARGS, NULL},
+ {(char *) "properties", libxml_properties, METH_VARARGS, NULL},
+ {(char *) "last", libxml_last, METH_VARARGS, NULL},
+ {(char *) "prev", libxml_prev, METH_VARARGS, NULL},
+ {(char *) "next", libxml_next, METH_VARARGS, NULL},
+ {(char *) "parent", libxml_parent, METH_VARARGS, NULL},
+ {(char *) "type", libxml_type, METH_VARARGS, NULL},
+ {(char *) "doc", libxml_doc, METH_VARARGS, NULL},
+ {(char *) "xmlNewNode", libxml_xmlNewNode, METH_VARARGS, NULL},
+#ifdef LIBXML_OUTPUT_ENABLED
+ {(char *) "serializeNode", libxml_serializeNode, METH_VARARGS, NULL},
+ {(char *) "saveNodeTo", libxml_saveNodeTo, METH_VARARGS, NULL},
+ {(char *) "outputBufferCreate", libxml_xmlCreateOutputBuffer, METH_VARARGS, NULL},
+ {(char *) "outputBufferGetPythonFile", libxml_outputBufferGetPythonFile, METH_VARARGS, NULL},
+ {(char *) "xmlOutputBufferClose", libxml_xmlOutputBufferClose, METH_VARARGS, NULL},
+ { (char *)"xmlOutputBufferFlush", libxml_xmlOutputBufferFlush, METH_VARARGS, NULL },
+#endif /* LIBXML_OUTPUT_ENABLED */
+ {(char *) "inputBufferCreate", libxml_xmlCreateInputBuffer, METH_VARARGS, NULL},
+ {(char *) "setEntityLoader", libxml_xmlSetEntityLoader, METH_VARARGS, NULL},
+ {(char *)"xmlRegisterErrorHandler", libxml_xmlRegisterErrorHandler, METH_VARARGS, NULL },
+ {(char *)"xmlParserCtxtSetErrorHandler", libxml_xmlParserCtxtSetErrorHandler, METH_VARARGS, NULL },
+ {(char *)"xmlParserCtxtGetErrorHandler", libxml_xmlParserCtxtGetErrorHandler, METH_VARARGS, NULL },
+ {(char *)"xmlFreeParserCtxt", libxml_xmlFreeParserCtxt, METH_VARARGS, NULL },
+ {(char *)"xmlTextReaderSetErrorHandler", libxml_xmlTextReaderSetErrorHandler, METH_VARARGS, NULL },
+ {(char *)"xmlTextReaderGetErrorHandler", libxml_xmlTextReaderGetErrorHandler, METH_VARARGS, NULL },
+ {(char *)"xmlFreeTextReader", libxml_xmlFreeTextReader, METH_VARARGS, NULL },
+ {(char *)"addLocalCatalog", libxml_addLocalCatalog, METH_VARARGS, NULL },
+#ifdef LIBXML_SCHEMAS_ENABLED
+ {(char *)"xmlRelaxNGSetValidErrors", libxml_xmlRelaxNGSetValidErrors, METH_VARARGS, NULL},
+ {(char *)"xmlRelaxNGFreeValidCtxt", libxml_xmlRelaxNGFreeValidCtxt, METH_VARARGS, NULL},
+#endif
+#ifdef LIBXML_C14N_ENABLED
+#ifdef LIBXML_OUTPUT_ENABLED
+ {(char *)"xmlC14NDocDumpMemory", libxml_C14NDocDumpMemory, METH_VARARGS, NULL},
+ {(char *)"xmlC14NDocSaveTo", libxml_C14NDocSaveTo, METH_VARARGS, NULL},
+#endif
+#endif
+ {NULL, NULL, 0, NULL}
+};
+
+#ifdef MERGED_MODULES
+extern void initlibxsltmod(void);
+#endif
+
+void
+initlibxml2mod(void)
+{
+ static int initialized = 0;
+ PyObject *m;
+
+ if (initialized != 0)
+ return;
+ /* XXX xmlInitParser does much more than this */
+ xmlInitGlobals();
+#ifdef LIBXML_OUTPUT_ENABLED
+ xmlRegisterDefaultOutputCallbacks();
+#endif /* LIBXML_OUTPUT_ENABLED */
+ xmlRegisterDefaultInputCallbacks();
+ m = Py_InitModule((char *) "libxml2mod", libxmlMethods);
+ initialized = 1;
+ libxml_xmlErrorInitialize();
+
+#ifdef MERGED_MODULES
+ initlibxsltmod();
+#endif
+}
diff --git a/python/libxml.py b/python/libxml.py
new file mode 100644
index 0000000..0c3ba6c
--- /dev/null
+++ b/python/libxml.py
@@ -0,0 +1,628 @@
+import libxml2mod
+import types
+
+#
+# Errors raised by the wrappers when some tree handling failed.
+#
+class treeError:
+ def __init__(self, msg):
+ self.msg = msg
+ def __str__(self):
+ return self.msg
+
+class parserError:
+ def __init__(self, msg):
+ self.msg = msg
+ def __str__(self):
+ return self.msg
+
+class uriError:
+ def __init__(self, msg):
+ self.msg = msg
+ def __str__(self):
+ return self.msg
+
+class xpathError:
+ def __init__(self, msg):
+ self.msg = msg
+ def __str__(self):
+ return self.msg
+
+class ioWrapper:
+ def __init__(self, _obj):
+ self.__io = _obj
+ self._o = None
+
+ def io_close(self):
+ if self.__io == None:
+ return(-1)
+ self.__io.close()
+ self.__io = None
+ return(0)
+
+ def io_flush(self):
+ if self.__io == None:
+ return(-1)
+ self.__io.flush()
+ return(0)
+
+ def io_read(self, len = -1):
+ if self.__io == None:
+ return(-1)
+ if len < 0:
+ return(self.__io.read())
+ return(self.__io.read(len))
+
+ def io_write(self, str, len = -1):
+ if self.__io == None:
+ return(-1)
+ if len < 0:
+ return(self.__io.write(str))
+ return(self.__io.write(str, len))
+
+class ioReadWrapper(ioWrapper):
+ def __init__(self, _obj, enc = ""):
+ ioWrapper.__init__(self, _obj)
+ self._o = libxml2mod.xmlCreateInputBuffer(self, enc)
+
+ def __del__(self):
+ print "__del__"
+ self.io_close()
+ if self._o != None:
+ libxml2mod.xmlFreeParserInputBuffer(self._o)
+ self._o = None
+
+ def close(self):
+ self.io_close()
+ if self._o != None:
+ libxml2mod.xmlFreeParserInputBuffer(self._o)
+ self._o = None
+
+class ioWriteWrapper(ioWrapper):
+ def __init__(self, _obj, enc = ""):
+# print "ioWriteWrapper.__init__", _obj
+ if type(_obj) == type(''):
+ print "write io from a string"
+ self.o = None
+ elif type(_obj) == types.InstanceType:
+ print "write io from instance of %s" % (_obj.__class__)
+ ioWrapper.__init__(self, _obj)
+ self._o = libxml2mod.xmlCreateOutputBuffer(self, enc)
+ else:
+ file = libxml2mod.outputBufferGetPythonFile(_obj)
+ if file != None:
+ ioWrapper.__init__(self, file)
+ else:
+ ioWrapper.__init__(self, _obj)
+ self._o = _obj
+
+ def __del__(self):
+# print "__del__"
+ self.io_close()
+ if self._o != None:
+ libxml2mod.xmlOutputBufferClose(self._o)
+ self._o = None
+
+ def flush(self):
+ self.io_flush()
+ if self._o != None:
+ libxml2mod.xmlOutputBufferClose(self._o)
+ self._o = None
+
+ def close(self):
+ self.io_flush()
+ if self._o != None:
+ libxml2mod.xmlOutputBufferClose(self._o)
+ self._o = None
+
+#
+# Example of a class to handle SAX events
+#
+class SAXCallback:
+ """Base class for SAX handlers"""
+ def startDocument(self):
+ """called at the start of the document"""
+ pass
+
+ def endDocument(self):
+ """called at the end of the document"""
+ pass
+
+ def startElement(self, tag, attrs):
+ """called at the start of every element, tag is the name of
+ the element, attrs is a dictionary of the element's attributes"""
+ pass
+
+ def endElement(self, tag):
+ """called at the start of every element, tag is the name of
+ the element"""
+ pass
+
+ def characters(self, data):
+ """called when character data have been read, data is the string
+ containing the data, multiple consecutive characters() callback
+ are possible."""
+ pass
+
+ def cdataBlock(self, data):
+ """called when CDATA section have been read, data is the string
+ containing the data, multiple consecutive cdataBlock() callback
+ are possible."""
+ pass
+
+ def reference(self, name):
+ """called when an entity reference has been found"""
+ pass
+
+ def ignorableWhitespace(self, data):
+ """called when potentially ignorable white spaces have been found"""
+ pass
+
+ def processingInstruction(self, target, data):
+ """called when a PI has been found, target contains the PI name and
+ data is the associated data in the PI"""
+ pass
+
+ def comment(self, content):
+ """called when a comment has been found, content contains the comment"""
+ pass
+
+ def externalSubset(self, name, externalID, systemID):
+ """called when a DOCTYPE declaration has been found, name is the
+ DTD name and externalID, systemID are the DTD public and system
+ identifier for that DTd if available"""
+ pass
+
+ def internalSubset(self, name, externalID, systemID):
+ """called when a DOCTYPE declaration has been found, name is the
+ DTD name and externalID, systemID are the DTD public and system
+ identifier for that DTD if available"""
+ pass
+
+ def entityDecl(self, name, type, externalID, systemID, content):
+ """called when an ENTITY declaration has been found, name is the
+ entity name and externalID, systemID are the entity public and
+ system identifier for that entity if available, type indicates
+ the entity type, and content reports it's string content"""
+ pass
+
+ def notationDecl(self, name, externalID, systemID):
+ """called when an NOTATION declaration has been found, name is the
+ notation name and externalID, systemID are the notation public and
+ system identifier for that notation if available"""
+ pass
+
+ def attributeDecl(self, elem, name, type, defi, defaultValue, nameList):
+ """called when an ATTRIBUTE definition has been found"""
+ pass
+
+ def elementDecl(self, name, type, content):
+ """called when an ELEMENT definition has been found"""
+ pass
+
+ def entityDecl(self, name, publicId, systemID, notationName):
+ """called when an unparsed ENTITY declaration has been found,
+ name is the entity name and publicId,, systemID are the entity
+ public and system identifier for that entity if available,
+ and notationName indicate the associated NOTATION"""
+ pass
+
+ def warning(self, msg):
+ print msg
+
+ def error(self, msg):
+ raise parserError(msg)
+
+ def fatalError(self, msg):
+ raise parserError(msg)
+
+#
+# This class is the ancestor of all the Node classes. It provides
+# the basic functionalities shared by all nodes (and handle
+# gracefylly the exception), like name, navigation in the tree,
+# doc reference, content access and serializing to a string or URI
+#
+class xmlCore:
+ def __init__(self, _obj=None):
+ if _obj != None:
+ self._o = _obj;
+ return
+ self._o = None
+ def get_parent(self):
+ ret = libxml2mod.parent(self._o)
+ if ret == None:
+ return None
+ return xmlNode(_obj=ret)
+ def get_children(self):
+ ret = libxml2mod.children(self._o)
+ if ret == None:
+ return None
+ return xmlNode(_obj=ret)
+ def get_last(self):
+ ret = libxml2mod.last(self._o)
+ if ret == None:
+ return None
+ return xmlNode(_obj=ret)
+ def get_next(self):
+ ret = libxml2mod.next(self._o)
+ if ret == None:
+ return None
+ return xmlNode(_obj=ret)
+ def get_properties(self):
+ ret = libxml2mod.properties(self._o)
+ if ret == None:
+ return None
+ return xmlAttr(_obj=ret)
+ def get_prev(self):
+ ret = libxml2mod.prev(self._o)
+ if ret == None:
+ return None
+ return xmlNode(_obj=ret)
+ def get_content(self):
+ return libxml2mod.xmlNodeGetContent(self._o)
+ getContent = get_content # why is this duplicate naming needed ?
+ def get_name(self):
+ return libxml2mod.name(self._o)
+ def get_type(self):
+ return libxml2mod.type(self._o)
+ def get_doc(self):
+ ret = libxml2mod.doc(self._o)
+ if ret == None:
+ if self.type in ["document_xml", "document_html"]:
+ return xmlDoc(_obj=self._o)
+ else:
+ return None
+ return xmlDoc(_obj=ret)
+ #
+ # Those are common attributes to nearly all type of nodes
+ # defined as python2 properties
+ #
+ import sys
+ if float(sys.version[0:3]) < 2.2:
+ def __getattr__(self, attr):
+ if attr == "parent":
+ ret = libxml2mod.parent(self._o)
+ if ret == None:
+ return None
+ return xmlNode(_obj=ret)
+ elif attr == "properties":
+ ret = libxml2mod.properties(self._o)
+ if ret == None:
+ return None
+ return xmlAttr(_obj=ret)
+ elif attr == "children":
+ ret = libxml2mod.children(self._o)
+ if ret == None:
+ return None
+ return xmlNode(_obj=ret)
+ elif attr == "last":
+ ret = libxml2mod.last(self._o)
+ if ret == None:
+ return None
+ return xmlNode(_obj=ret)
+ elif attr == "next":
+ ret = libxml2mod.next(self._o)
+ if ret == None:
+ return None
+ return xmlNode(_obj=ret)
+ elif attr == "prev":
+ ret = libxml2mod.prev(self._o)
+ if ret == None:
+ return None
+ return xmlNode(_obj=ret)
+ elif attr == "content":
+ return libxml2mod.xmlNodeGetContent(self._o)
+ elif attr == "name":
+ return libxml2mod.name(self._o)
+ elif attr == "type":
+ return libxml2mod.type(self._o)
+ elif attr == "doc":
+ ret = libxml2mod.doc(self._o)
+ if ret == None:
+ if self.type == "document_xml" or self.type == "document_html":
+ return xmlDoc(_obj=self._o)
+ else:
+ return None
+ return xmlDoc(_obj=ret)
+ raise AttributeError,attr
+ else:
+ parent = property(get_parent, None, None, "Parent node")
+ children = property(get_children, None, None, "First child node")
+ last = property(get_last, None, None, "Last sibling node")
+ next = property(get_next, None, None, "Next sibling node")
+ prev = property(get_prev, None, None, "Previous sibling node")
+ properties = property(get_properties, None, None, "List of properies")
+ content = property(get_content, None, None, "Content of this node")
+ name = property(get_name, None, None, "Node name")
+ type = property(get_type, None, None, "Node type")
+ doc = property(get_doc, None, None, "The document this node belongs to")
+
+ #
+ # Serialization routines, the optional arguments have the following
+ # meaning:
+ # encoding: string to ask saving in a specific encoding
+ # indent: if 1 the serializer is asked to indent the output
+ #
+ def serialize(self, encoding = None, format = 0):
+ return libxml2mod.serializeNode(self._o, encoding, format)
+ def saveTo(self, file, encoding = None, format = 0):
+ return libxml2mod.saveNodeTo(self._o, file, encoding, format)
+
+ #
+ # Canonicalization routines:
+ #
+ # nodes: the node set (tuple or list) to be included in the
+ # canonized image or None if all document nodes should be
+ # included.
+ # exclusive: the exclusive flag (0 - non-exclusive
+ # canonicalization; otherwise - exclusive canonicalization)
+ # prefixes: the list of inclusive namespace prefixes (strings),
+ # or None if there is no inclusive namespaces (only for
+ # exclusive canonicalization, ignored otherwise)
+ # with_comments: include comments in the result (!=0) or not
+ # (==0)
+ def c14nMemory(self,
+ nodes=None,
+ exclusive=0,
+ prefixes=None,
+ with_comments=0):
+ if nodes:
+ nodes = map(lambda n: n._o, nodes)
+ return libxml2mod.xmlC14NDocDumpMemory(
+ self.get_doc()._o,
+ nodes,
+ exclusive != 0,
+ prefixes,
+ with_comments != 0)
+ def c14nSaveTo(self,
+ file,
+ nodes=None,
+ exclusive=0,
+ prefixes=None,
+ with_comments=0):
+ if nodes:
+ nodes = map(lambda n: n._o, nodes)
+ return libxml2mod.xmlC14NDocSaveTo(
+ self.get_doc()._o,
+ nodes,
+ exclusive != 0,
+ prefixes,
+ with_comments != 0,
+ file)
+
+ #
+ # Selecting nodes using XPath, a bit slow because the context
+ # is allocated/freed every time but convenient.
+ #
+ def xpathEval(self, expr):
+ doc = self.doc
+ if doc == None:
+ return None
+ ctxt = doc.xpathNewContext()
+ ctxt.setContextNode(self)
+ res = ctxt.xpathEval(expr)
+ ctxt.xpathFreeContext()
+ return res
+
+# #
+# # Selecting nodes using XPath, faster because the context
+# # is allocated just once per xmlDoc.
+# #
+# # Removed: DV memleaks c.f. #126735
+# #
+# def xpathEval2(self, expr):
+# doc = self.doc
+# if doc == None:
+# return None
+# try:
+# doc._ctxt.setContextNode(self)
+# except:
+# doc._ctxt = doc.xpathNewContext()
+# doc._ctxt.setContextNode(self)
+# res = doc._ctxt.xpathEval(expr)
+# return res
+ def xpathEval2(self, expr):
+ return self.xpathEval(expr)
+
+ # support for python2 iterators
+ def walk_depth_first(self):
+ return xmlCoreDepthFirstItertor(self)
+ def walk_breadth_first(self):
+ return xmlCoreBreadthFirstItertor(self)
+ __iter__ = walk_depth_first
+
+ def free(self):
+ try:
+ self.doc._ctxt.xpathFreeContext()
+ except:
+ pass
+ libxml2mod.xmlFreeDoc(self._o)
+
+
+#
+# implements the depth-first iterator for libxml2 DOM tree
+#
+class xmlCoreDepthFirstItertor:
+ def __init__(self, node):
+ self.node = node
+ self.parents = []
+ def __iter__(self):
+ return self
+ def next(self):
+ while 1:
+ if self.node:
+ ret = self.node
+ self.parents.append(self.node)
+ self.node = self.node.children
+ return ret
+ try:
+ parent = self.parents.pop()
+ except IndexError:
+ raise StopIteration
+ self.node = parent.next
+
+#
+# implements the breadth-first iterator for libxml2 DOM tree
+#
+class xmlCoreBreadthFirstItertor:
+ def __init__(self, node):
+ self.node = node
+ self.parents = []
+ def __iter__(self):
+ return self
+ def next(self):
+ while 1:
+ if self.node:
+ ret = self.node
+ self.parents.append(self.node)
+ self.node = self.node.next
+ return ret
+ try:
+ parent = self.parents.pop()
+ except IndexError:
+ raise StopIteration
+ self.node = parent.children
+
+#
+# converters to present a nicer view of the XPath returns
+#
+def nodeWrap(o):
+ # TODO try to cast to the most appropriate node class
+ name = libxml2mod.name(o)
+ if name == "element" or name == "text":
+ return xmlNode(_obj=o)
+ if name == "attribute":
+ return xmlAttr(_obj=o)
+ if name[0:8] == "document":
+ return xmlDoc(_obj=o)
+ if name[0:8] == "namespace":
+ return xmlNs(_obj=o)
+ if name == "elem_decl":
+ return xmlElement(_obj=o)
+ if name == "attribute_decl":
+ return xmlAtribute(_obj=o)
+ if name == "entity_decl":
+ return xmlEntity(_obj=o)
+ if name == "dtd":
+ return xmlDtd(_obj=o)
+ return xmlNode(_obj=o)
+
+def xpathObjectRet(o):
+ if type(o) == type([]) or type(o) == type(()):
+ ret = map(lambda x: nodeWrap(x), o)
+ return ret
+ return o
+
+#
+# register an XPath function
+#
+def registerXPathFunction(ctxt, name, ns_uri, f):
+ ret = libxml2mod.xmlRegisterXPathFunction(ctxt, name, ns_uri, f)
+
+#
+# For the xmlTextReader parser configuration
+#
+PARSER_LOADDTD=1
+PARSER_DEFAULTATTRS=2
+PARSER_VALIDATE=3
+PARSER_SUBST_ENTITIES=4
+
+#
+# For the error callback severities
+#
+PARSER_SEVERITY_VALIDITY_WARNING=1
+PARSER_SEVERITY_VALIDITY_ERROR=2
+PARSER_SEVERITY_WARNING=3
+PARSER_SEVERITY_ERROR=4
+
+#
+# register the libxml2 error handler
+#
+def registerErrorHandler(f, ctx):
+ """Register a Python written function to for error reporting.
+ The function is called back as f(ctx, error). """
+ import sys
+ if not sys.modules.has_key('libxslt'):
+ # normal behaviour when libxslt is not imported
+ ret = libxml2mod.xmlRegisterErrorHandler(f,ctx)
+ else:
+ # when libxslt is already imported, one must
+ # use libxst's error handler instead
+ import libxslt
+ ret = libxslt.registerErrorHandler(f,ctx)
+ return ret
+
+class parserCtxtCore:
+
+ def __init__(self, _obj=None):
+ if _obj != None:
+ self._o = _obj;
+ return
+ self._o = None
+
+ def __del__(self):
+ if self._o != None:
+ libxml2mod.xmlFreeParserCtxt(self._o)
+ self._o = None
+
+ def setErrorHandler(self,f,arg):
+ """Register an error handler that will be called back as
+ f(arg,msg,severity,reserved).
+
+ @reserved is currently always None."""
+ libxml2mod.xmlParserCtxtSetErrorHandler(self._o,f,arg)
+
+ def getErrorHandler(self):
+ """Return (f,arg) as previously registered with setErrorHandler
+ or (None,None)."""
+ return libxml2mod.xmlParserCtxtGetErrorHandler(self._o)
+
+ def addLocalCatalog(self, uri):
+ """Register a local catalog with the parser"""
+ return libxml2mod.addLocalCatalog(self._o, uri)
+
+
+def _xmlTextReaderErrorFunc((f,arg),msg,severity,locator):
+ """Intermediate callback to wrap the locator"""
+ return f(arg,msg,severity,xmlTextReaderLocator(locator))
+
+class xmlTextReaderCore:
+
+ def __init__(self, _obj=None):
+ self.input = None
+ if _obj != None:self._o = _obj;return
+ self._o = None
+
+ def __del__(self):
+ if self._o != None:
+ libxml2mod.xmlFreeTextReader(self._o)
+ self._o = None
+
+ def SetErrorHandler(self,f,arg):
+ """Register an error handler that will be called back as
+ f(arg,msg,severity,locator)."""
+ if f is None:
+ libxml2mod.xmlTextReaderSetErrorHandler(\
+ self._o,None,None)
+ else:
+ libxml2mod.xmlTextReaderSetErrorHandler(\
+ self._o,_xmlTextReaderErrorFunc,(f,arg))
+
+ def GetErrorHandler(self):
+ """Return (f,arg) as previously registered with setErrorHandler
+ or (None,None)."""
+ f,arg = libxml2mod.xmlTextReaderGetErrorHandler(self._o)
+ if f is None:
+ return None,None
+ else:
+ # assert f is _xmlTextReaderErrorFunc
+ return arg
+
+
+# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+#
+# Everything before this line comes from libxml.py
+# Everything after this line is automatically generated
+#
+# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+
diff --git a/python/libxml2-py.c b/python/libxml2-py.c
new file mode 100644
index 0000000..2e3bf22
--- /dev/null
+++ b/python/libxml2-py.c
@@ -0,0 +1,12873 @@
+/* Generated */
+
+#include <Python.h>
+#include <libxml/xmlversion.h>
+#include <libxml/tree.h>
+#include <libxml/xmlschemastypes.h>
+#include "libxml_wrap.h"
+#include "libxml2-py.h"
+
+PyObject *
+libxml_xmlUCSIsBlockElements(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsBlockElements", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsBlockElements(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlGetDocEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlEntityPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetDocEntity", &pyobj_doc, &name))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlGetDocEntity(doc, name);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsBopomofo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsBopomofo", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsBopomofo(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNodeGetBase(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlNodeGetBase", &pyobj_doc, &pyobj_cur))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlNodeGetBase(doc, cur);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNextAncestorOrSelf(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextAncestorOrSelf", &pyobj_ctxt, &pyobj_cur))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlXPathNextAncestorOrSelf(ctxt, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlStrstr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlChar * str;
+ xmlChar * val;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:xmlStrstr", &str, &val))
+ return(NULL);
+
+ c_retval = xmlStrstr(str, val);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlReaderForFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlTextReaderPtr c_retval;
+ char * filename;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"zzi:xmlReaderForFile", &filename, &encoding, &options))
+ return(NULL);
+
+ c_retval = xmlReaderForFile(filename, encoding, options);
+ py_retval = libxml_xmlTextReaderPtrWrap((xmlTextReaderPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderExpand(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderExpand", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderExpand(reader);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlAddSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+ xmlNodePtr elem;
+ PyObject *pyobj_elem;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlAddSibling", &pyobj_cur, &pyobj_elem))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+ elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem);
+
+ c_retval = xmlAddSibling(cur, elem);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlScanName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlScanName", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlScanName(ctxt);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlFreeParserInputBuffer(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserInputBufferPtr in;
+ PyObject *pyobj_in;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeParserInputBuffer", &pyobj_in))
+ return(NULL);
+ in = (xmlParserInputBufferPtr) PyinputBuffer_Get(pyobj_in);
+
+ xmlFreeParserInputBuffer(in);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlRegisterDefaultInputCallbacks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlRegisterDefaultInputCallbacks();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsMathematicalAlphanumericSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMathematicalAlphanumericSymbols", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsMathematicalAlphanumericSymbols(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNsLookup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlChar * prefix;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlXPathNsLookup", &pyobj_ctxt, &prefix))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ c_retval = xmlXPathNsLookup(ctxt, prefix);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_DEBUG_ENABLED
+PyObject *
+libxml_xmlDebugDumpEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * output;
+ PyObject *pyobj_output;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlDebugDumpEntities", &pyobj_output, &pyobj_doc))
+ return(NULL);
+ output = (FILE *) PyFile_Get(pyobj_output);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ xmlDebugDumpEntities(output, doc);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_DEBUG_ENABLED */
+#ifdef LIBXML_DEBUG_ENABLED
+PyObject *
+libxml_xmlDebugDumpNodeList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * output;
+ PyObject *pyobj_output;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ int depth;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOi:xmlDebugDumpNodeList", &pyobj_output, &pyobj_node, &depth))
+ return(NULL);
+ output = (FILE *) PyFile_Get(pyobj_output);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ xmlDebugDumpNodeList(output, node, depth);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_DEBUG_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNextAncestor(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextAncestor", &pyobj_ctxt, &pyobj_cur))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlXPathNextAncestor(ctxt, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathCastNumberToBoolean(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ double val;
+
+ if (!PyArg_ParseTuple(args, (char *)"d:xmlXPathCastNumberToBoolean", &val))
+ return(NULL);
+
+ c_retval = xmlXPathCastNumberToBoolean(val);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsCatCs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatCs", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatCs(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatCf(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatCf", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatCf(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNodeAddContent(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+ xmlChar * content;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNodeAddContent", &pyobj_cur, &content))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlNodeAddContent(cur, content);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsCatCo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatCo", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatCo(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNanoFTPCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlNanoFTPCleanup();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlRecoverMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ char * buffer;
+ int size;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlRecoverMemory", &buffer, &size))
+ return(NULL);
+
+ c_retval = xmlRecoverMemory(buffer, size);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlValidateNCName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * value;
+ int space;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlValidateNCName", &value, &space))
+ return(NULL);
+
+ c_retval = xmlValidateNCName(value, space);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderIsDefault(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderIsDefault", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderIsDefault(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsTagalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsTagalog", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsTagalog(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxNGFree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlRelaxNGPtr schema;
+ PyObject *pyobj_schema;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlRelaxNGFree", &pyobj_schema))
+ return(NULL);
+ schema = (xmlRelaxNGPtr) PyrelaxNgSchema_Get(pyobj_schema);
+
+ xmlRelaxNGFree(schema);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+PyObject *
+libxml_xmlUCSIsMalayalam(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMalayalam", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsMalayalam(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathInit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlXPathInit();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxNGFreeParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlRelaxNGParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlRelaxNGFreeParserCtxt", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlRelaxNGParserCtxtPtr) PyrelaxNgParserCtxt_Get(pyobj_ctxt);
+
+ xmlRelaxNGFreeParserCtxt(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+PyObject *
+libxml_xmlCheckLanguageID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * lang;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlCheckLanguageID", &lang))
+ return(NULL);
+
+ c_retval = xmlCheckLanguageID(lang);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlFreeNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNsPtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeNs", &pyobj_cur))
+ return(NULL);
+ cur = (xmlNsPtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlFreeNs(cur);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlReaderNewMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ char * buffer;
+ int size;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozizzi:xmlReaderNewMemory", &pyobj_reader, &buffer, &size, &URL, &encoding, &options))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlReaderNewMemory(reader, buffer, size, URL, encoding, options);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNormalizeFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathNormalizeFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathNormalizeFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlGetNoNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetNoNsProp", &pyobj_node, &name))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlGetNoNsProp(node, name);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNewString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ xmlChar * val;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlXPathNewString", &val))
+ return(NULL);
+
+ c_retval = xmlXPathNewString(val);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlNewProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlAttrPtr c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlChar * name;
+ xmlChar * value;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlNewProp", &pyobj_node, &name, &value))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlNewProp(node, name, value);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParserGetDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParserGetDoc", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = ctxt->myDoc;
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNodeAddContentLen(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+ xmlChar * content;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlNodeAddContentLen", &pyobj_cur, &content, &len))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlNodeAddContentLen(cur, content, len);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlRegisterDefaultOutputCallbacks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlRegisterDefaultOutputCallbacks();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlCleanupCharEncodingHandlers(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlCleanupCharEncodingHandlers();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlNodeDumpFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * out;
+ PyObject *pyobj_out;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOO:htmlNodeDumpFile", &pyobj_out, &pyobj_doc, &pyobj_cur))
+ return(NULL);
+ out = (FILE *) PyFile_Get(pyobj_out);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ htmlNodeDumpFile(out, doc, cur);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathModValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathModValues", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathModValues(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlParseEntityRef(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlEntityPtr c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseEntityRef", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseEntityRef(ctxt);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCatalogIsEmpty(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlCatalogPtr catal;
+ PyObject *pyobj_catal;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlCatalogIsEmpty", &pyobj_catal))
+ return(NULL);
+ catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal);
+
+ c_retval = xmlCatalogIsEmpty(catal);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_htmlInitAutoClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ htmlInitAutoClose();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlTextReaderReadOuterXml(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderReadOuterXml", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderReadOuterXml(reader);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlLoadSGMLSuperCatalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlCatalogPtr c_retval;
+ char * filename;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlLoadSGMLSuperCatalog", &filename))
+ return(NULL);
+
+ c_retval = xmlLoadSGMLSuperCatalog(filename);
+ py_retval = libxml_xmlCatalogPtrWrap((xmlCatalogPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsTamil(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsTamil", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsTamil(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlXPathSetContextDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathSetContextDoc", &pyobj_ctxt, &pyobj_doc))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ ctxt->doc = doc;
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_DEBUG_ENABLED
+PyObject *
+libxml_xmlDebugDumpString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * output;
+ PyObject *pyobj_output;
+ xmlChar * str;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlDebugDumpString", &pyobj_output, &str))
+ return(NULL);
+ output = (FILE *) PyFile_Get(pyobj_output);
+
+ xmlDebugDumpString(output, str);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_DEBUG_ENABLED */
+PyObject *
+libxml_xmlCopyChar(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int len;
+ xmlChar * out;
+ int val;
+
+ if (!PyArg_ParseTuple(args, (char *)"izi:xmlCopyChar", &len, &out, &val))
+ return(NULL);
+
+ c_retval = xmlCopyChar(len, out, val);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCleanupGlobals(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlCleanupGlobals();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathRegisteredVariablesCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathRegisteredVariablesCleanup", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ xmlXPathRegisteredVariablesCleanup(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlEncodeEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * input;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlEncodeEntities", &pyobj_doc, &input))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlEncodeEntities(doc, input);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlGetDtdQElementDesc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlElementPtr c_retval;
+ xmlDtdPtr dtd;
+ PyObject *pyobj_dtd;
+ xmlChar * name;
+ xmlChar * prefix;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlGetDtdQElementDesc", &pyobj_dtd, &name, &prefix))
+ return(NULL);
+ dtd = (xmlDtdPtr) PyxmlNode_Get(pyobj_dtd);
+
+ c_retval = xmlGetDtdQElementDesc(dtd, name, prefix);
+ py_retval = libxml_xmlElementPtrWrap((xmlElementPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseNamespace(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseNamespace", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseNamespace(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlStrncasecmp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * str1;
+ xmlChar * str2;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"zzi:xmlStrncasecmp", &str1, &str2, &len))
+ return(NULL);
+
+ c_retval = xmlStrncasecmp(str1, str2, len);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathLocalNameFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathLocalNameFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathLocalNameFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlCanonicPath(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * path;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlCanonicPath", &path))
+ return(NULL);
+
+ c_retval = xmlCanonicPath(path);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNextPrecedingSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextPrecedingSibling", &pyobj_ctxt, &pyobj_cur))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlXPathNextPrecedingSibling(ctxt, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlCatalogCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlCatalogCleanup();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlNextChar(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlNextChar", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlNextChar(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlNanoHTTPInit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlNanoHTTPInit();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlCopyNamespaceList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNsPtr c_retval;
+ xmlNsPtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlCopyNamespaceList", &pyobj_cur))
+ return(NULL);
+ cur = (xmlNsPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlCopyNamespaceList(cur);
+ py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlIsID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr elem;
+ PyObject *pyobj_elem;
+ xmlAttrPtr attr;
+ PyObject *pyobj_attr;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOO:xmlIsID", &pyobj_doc, &pyobj_elem, &pyobj_attr))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem);
+ attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr);
+
+ c_retval = xmlIsID(doc, elem, attr);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsSpecials(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSpecials", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsSpecials(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseCDSect(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseCDSect", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseCDSect(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsLatinExtendedB(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLatinExtendedB", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsLatinExtendedB(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsLatinExtendedA(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLatinExtendedA", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsLatinExtendedA(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseExtParsedEnt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseExtParsedEnt", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseExtParsedEnt(ctxt);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCopyDtd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDtdPtr c_retval;
+ xmlDtdPtr dtd;
+ PyObject *pyobj_dtd;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlCopyDtd", &pyobj_dtd))
+ return(NULL);
+ dtd = (xmlDtdPtr) PyxmlNode_Get(pyobj_dtd);
+
+ c_retval = xmlCopyDtd(dtd);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNodeListGetRawString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr list;
+ PyObject *pyobj_list;
+ int inLine;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOi:xmlNodeListGetRawString", &pyobj_doc, &pyobj_list, &inLine))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ list = (xmlNodePtr) PyxmlNode_Get(pyobj_list);
+
+ c_retval = xmlNodeListGetRawString(doc, list, inLine);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlErrorGetLine(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlErrorPtr Error;
+ PyObject *pyobj_Error;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlErrorGetLine", &pyobj_Error))
+ return(NULL);
+ Error = (xmlErrorPtr) PyError_Get(pyobj_Error);
+
+ c_retval = Error->line;
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlStringLenDecodeEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlChar * str;
+ int len;
+ int what;
+ xmlChar end;
+ xmlChar end2;
+ xmlChar end3;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oziiccc:xmlStringLenDecodeEntities", &pyobj_ctxt, &str, &len, &what, &end, &end2, &end3))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlStringLenDecodeEntities(ctxt, str, len, what, end, end2, end3);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCJKUnifiedIdeographsExtensionA(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKUnifiedIdeographsExtensionA", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCJKUnifiedIdeographsExtensionB(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKUnifiedIdeographsExtensionB", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlCreateMemoryParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ htmlParserCtxtPtr c_retval;
+ char * buffer;
+ int size;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:htmlCreateMemoryParserCtxt", &buffer, &size))
+ return(NULL);
+
+ c_retval = htmlCreateMemoryParserCtxt(buffer, size);
+ py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlNewDocNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNsPtr ns;
+ PyObject *pyobj_ns;
+ xmlChar * name;
+ xmlChar * content;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlNewDocNode", &pyobj_doc, &pyobj_ns, &name, &content))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns);
+
+ c_retval = xmlNewDocNode(doc, ns, name, content);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlIsDigit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ unsigned int ch;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlIsDigit", &ch))
+ return(NULL);
+
+ c_retval = xmlIsDigit(ch);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlParseDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ htmlDocPtr c_retval;
+ xmlChar * cur;
+ char * encoding;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:htmlParseDoc", &cur, &encoding))
+ return(NULL);
+
+ c_retval = htmlParseDoc(cur, encoding);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlCatalogSetDebug(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int level;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlCatalogSetDebug", &level))
+ return(NULL);
+
+ c_retval = xmlCatalogSetDebug(level);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsMiscellaneousMathematicalSymbolsB(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMiscellaneousMathematicalSymbolsB", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParserGetDirectory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ char * c_retval;
+ char * filename;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlParserGetDirectory", &filename))
+ return(NULL);
+
+ c_retval = xmlParserGetDirectory(filename);
+ py_retval = libxml_charPtrWrap((char *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsMiscellaneousMathematicalSymbolsA(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMiscellaneousMathematicalSymbolsA", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlSchemaCleanupTypes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlSchemaCleanupTypes();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathFreeParserContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathFreeParserContext", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathFreeParserContext(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlFreeNsList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNsPtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeNsList", &pyobj_cur))
+ return(NULL);
+ cur = (xmlNsPtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlFreeNsList(cur);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlParseEntityDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseEntityDecl", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseEntityDecl(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlDocCopyNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ int extended;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOi:xmlDocCopyNode", &pyobj_node, &pyobj_doc, &extended))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlDocCopyNode(node, doc, extended);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_nodePop(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:nodePop", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = nodePop(ctxt);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCreateURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+ PyObject *py_retval;
+ xmlURIPtr c_retval;
+
+ c_retval = xmlCreateURI();
+ py_retval = libxml_xmlURIPtrWrap((xmlURIPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNextDescendant(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextDescendant", &pyobj_ctxt, &pyobj_cur))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlXPathNextDescendant(ctxt, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlStrcat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * cur;
+ xmlChar * add;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:xmlStrcat", &cur, &add))
+ return(NULL);
+
+ c_retval = xmlStrcat(cur, add);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlInitializeCatalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlInitializeCatalog();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlParseEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ char * filename;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlParseEntity", &filename))
+ return(NULL);
+
+ c_retval = xmlParseEntity(filename);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlDocGetRootElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlDocGetRootElement", &pyobj_doc))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlDocGetRootElement(doc);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsKhmerSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsKhmerSymbols", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsKhmerSymbols(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseMarkupDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseMarkupDecl", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseMarkupDecl(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_htmlCreateFileParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ htmlParserCtxtPtr c_retval;
+ char * filename;
+ char * encoding;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:htmlCreateFileParserCtxt", &filename, &encoding))
+ return(NULL);
+
+ c_retval = htmlCreateFileParserCtxt(filename, encoding);
+ py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlHasNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlAttrPtr c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlChar * name;
+ xmlChar * nameSpace;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlHasNsProp", &pyobj_node, &name, &nameSpace))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlHasNsProp(node, name, nameSpace);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlAddPrevSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+ xmlNodePtr elem;
+ PyObject *pyobj_elem;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlAddPrevSibling", &pyobj_cur, &pyobj_elem))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+ elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem);
+
+ c_retval = xmlAddPrevSibling(cur, elem);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderMoveToAttribute(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlTextReaderMoveToAttribute", &pyobj_reader, &name))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderMoveToAttribute(reader, name);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCyrillic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCyrillic", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCyrillic(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlGetDtdAttrDesc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlAttributePtr c_retval;
+ xmlDtdPtr dtd;
+ PyObject *pyobj_dtd;
+ xmlChar * elem;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlGetDtdAttrDesc", &pyobj_dtd, &elem, &name))
+ return(NULL);
+ dtd = (xmlDtdPtr) PyxmlNode_Get(pyobj_dtd);
+
+ c_retval = xmlGetDtdAttrDesc(dtd, elem, name);
+ py_retval = libxml_xmlAttributePtrWrap((xmlAttributePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCJKCompatibilityForms(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKCompatibilityForms", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCJKCompatibilityForms(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlGetMetaEncoding(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ htmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:htmlGetMetaEncoding", &pyobj_doc))
+ return(NULL);
+ doc = (htmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = htmlGetMetaEncoding(doc);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlCharStrdup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ char * cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlCharStrdup", &cur))
+ return(NULL);
+
+ c_retval = xmlCharStrdup(cur);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlElemDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * f;
+ PyObject *pyobj_f;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOO:xmlElemDump", &pyobj_f, &pyobj_doc, &pyobj_cur))
+ return(NULL);
+ f = (FILE *) PyFile_Get(pyobj_f);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlElemDump(f, doc, cur);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsEnclosedCJKLettersandMonths(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsEnclosedCJKLettersandMonths", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsEnclosedCJKLettersandMonths(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlGetIntSubset(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDtdPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlGetIntSubset", &pyobj_doc))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlGetIntSubset(doc);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlRecoverDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ xmlChar * cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlRecoverDoc", &cur))
+ return(NULL);
+
+ c_retval = xmlRecoverDoc(cur);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCleanupInputCallbacks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlCleanupInputCallbacks();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlNormalizeURIPath(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ char * path;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlNormalizeURIPath", &path))
+ return(NULL);
+
+ c_retval = xmlNormalizeURIPath(path);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewTextReader(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlTextReaderPtr c_retval;
+ xmlParserInputBufferPtr input;
+ PyObject *pyobj_input;
+ char * URI;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNewTextReader", &pyobj_input, &URI))
+ return(NULL);
+ input = (xmlParserInputBufferPtr) PyinputBuffer_Get(pyobj_input);
+
+ c_retval = xmlNewTextReader(input, URI);
+ py_retval = libxml_xmlTextReaderPtrWrap((xmlTextReaderPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCombiningDiacriticalMarksforSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCombiningDiacriticalMarksforSymbols", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_DEBUG_ENABLED
+PyObject *
+libxml_xmlDebugDumpAttrList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * output;
+ PyObject *pyobj_output;
+ xmlAttrPtr attr;
+ PyObject *pyobj_attr;
+ int depth;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOi:xmlDebugDumpAttrList", &pyobj_output, &pyobj_attr, &depth))
+ return(NULL);
+ output = (FILE *) PyFile_Get(pyobj_output);
+ attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr);
+
+ xmlDebugDumpAttrList(output, attr, depth);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_DEBUG_ENABLED */
+PyObject *
+libxml_xmlTextReaderGetAttributeNo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ int no;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlTextReaderGetAttributeNo", &pyobj_reader, &no))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderGetAttributeNo(reader, no);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParserInputBufferRead(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserInputBufferPtr in;
+ PyObject *pyobj_in;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlParserInputBufferRead", &pyobj_in, &len))
+ return(NULL);
+ in = (xmlParserInputBufferPtr) PyinputBuffer_Get(pyobj_in);
+
+ c_retval = xmlParserInputBufferRead(in, len);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathOrderDocElems(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ long c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathOrderDocElems", &pyobj_doc))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlXPathOrderDocElems(doc);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsLinearBIdeograms(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLinearBIdeograms", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsLinearBIdeograms(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseCharData(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int cdata;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlParseCharData", &pyobj_ctxt, &cdata))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseCharData(ctxt, cdata);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsHangulJamo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHangulJamo", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsHangulJamo(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsThai(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsThai", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsThai(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlCtxtReset(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ htmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:htmlCtxtReset", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ htmlCtxtReset(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlCtxtReadFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ char * filename;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozzi:xmlCtxtReadFile", &pyobj_ctxt, &filename, &encoding, &options))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlCtxtReadFile(ctxt, filename, encoding, options);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNewFloat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ double val;
+
+ if (!PyArg_ParseTuple(args, (char *)"d:xmlXPathNewFloat", &val))
+ return(NULL);
+
+ c_retval = xmlXPathNewFloat(val);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathRegisterNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlChar * prefix;
+ xmlChar * ns_uri;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlXPathRegisterNs", &pyobj_ctxt, &prefix, &ns_uri))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ c_retval = xmlXPathRegisterNs(ctxt, prefix, ns_uri);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlIOFTPMatch(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ char * filename;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlIOFTPMatch", &filename))
+ return(NULL);
+
+ c_retval = xmlIOFTPMatch(filename);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCopyNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ int extended;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlCopyNode", &pyobj_node, &extended))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlCopyNode(node, extended);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCatalogResolveSystem(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * sysID;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlCatalogResolveSystem", &sysID))
+ return(NULL);
+
+ c_retval = xmlCatalogResolveSystem(sysID);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderConstLocalName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderConstLocalName", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderConstLocalName(reader);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlURISetServer(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+ char * server;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetServer", &pyobj_URI, &server))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ if (URI->server != NULL) xmlFree(URI->server);
+ URI->server = (char *)xmlStrdup((const xmlChar *)server);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathLastFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathLastFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathLastFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsSpacingModifierLetters(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSpacingModifierLetters", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsSpacingModifierLetters(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsOpticalCharacterRecognition(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsOpticalCharacterRecognition", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsOpticalCharacterRecognition(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlThrDefSubstituteEntitiesDefaultValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int v;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefSubstituteEntitiesDefaultValue", &v))
+ return(NULL);
+
+ c_retval = xmlThrDefSubstituteEntitiesDefaultValue(v);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlAttrPtr c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlNsPtr ns;
+ PyObject *pyobj_ns;
+ xmlChar * name;
+ xmlChar * value;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlNewNsProp", &pyobj_node, &pyobj_ns, &name, &value))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+ ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns);
+
+ c_retval = xmlNewNsProp(node, ns, name, value);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlThrDefIndentTreeOutput(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int v;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefIndentTreeOutput", &v))
+ return(NULL);
+
+ c_retval = xmlThrDefIndentTreeOutput(v);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewCatalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlCatalogPtr c_retval;
+ int sgml;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlNewCatalog", &sgml))
+ return(NULL);
+
+ c_retval = xmlNewCatalog(sgml);
+ py_retval = libxml_xmlCatalogPtrWrap((xmlCatalogPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsYijingHexagramSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsYijingHexagramSymbols", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsYijingHexagramSymbols(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsHighPrivateUseSurrogates(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHighPrivateUseSurrogates", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsHighPrivateUseSurrogates(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPTR_ENABLED
+PyObject *
+libxml_xmlXPtrNewContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathContextPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr here;
+ PyObject *pyobj_here;
+ xmlNodePtr origin;
+ PyObject *pyobj_origin;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOO:xmlXPtrNewContext", &pyobj_doc, &pyobj_here, &pyobj_origin))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ here = (xmlNodePtr) PyxmlNode_Get(pyobj_here);
+ origin = (xmlNodePtr) PyxmlNode_Get(pyobj_origin);
+
+ c_retval = xmlXPtrNewContext(doc, here, origin);
+ py_retval = libxml_xmlXPathContextPtrWrap((xmlXPathContextPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPTR_ENABLED */
+PyObject *
+libxml_xmlDefaultSAXHandlerInit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlDefaultSAXHandlerInit();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsBraillePatterns(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsBraillePatterns", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsBraillePatterns(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseAttValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseAttValue", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseAttValue(ctxt);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCreateMemoryParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlParserCtxtPtr c_retval;
+ char * buffer;
+ int size;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlCreateMemoryParserCtxt", &buffer, &size))
+ return(NULL);
+
+ c_retval = xmlCreateMemoryParserCtxt(buffer, size);
+ py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlStringGetNodeList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * value;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlStringGetNodeList", &pyobj_doc, &value))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlStringGetNodeList(doc, value);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlHandleOmittedElem(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int val;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:htmlHandleOmittedElem", &val))
+ return(NULL);
+
+ c_retval = htmlHandleOmittedElem(val);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlParseName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseName", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseName(ctxt);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathTrueFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathTrueFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathTrueFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlCatalogAdd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * type;
+ xmlChar * orig;
+ xmlChar * replace;
+
+ if (!PyArg_ParseTuple(args, (char *)"zzz:xmlCatalogAdd", &type, &orig, &replace))
+ return(NULL);
+
+ c_retval = xmlCatalogAdd(type, orig, replace);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCombiningDiacriticalMarks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCombiningDiacriticalMarks", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCombiningDiacriticalMarks(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathCastStringToBoolean(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * val;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlXPathCastStringToBoolean", &val))
+ return(NULL);
+
+ c_retval = xmlXPathCastStringToBoolean(val);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathEqualValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathEqualValues", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ c_retval = xmlXPathEqualValues(ctxt);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlCtxtUseOptions(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlCtxtUseOptions", &pyobj_ctxt, &options))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlCtxtUseOptions(ctxt, options);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsShavian(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsShavian", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsShavian(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderMoveToElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderMoveToElement", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderMoveToElement(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlIsAutoClosed(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ htmlDocPtr doc;
+ PyObject *pyobj_doc;
+ htmlNodePtr elem;
+ PyObject *pyobj_elem;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:htmlIsAutoClosed", &pyobj_doc, &pyobj_elem))
+ return(NULL);
+ doc = (htmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ elem = (htmlNodePtr) PyxmlNode_Get(pyobj_elem);
+
+ c_retval = htmlIsAutoClosed(doc, elem);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlUCSIsUgaritic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsUgaritic", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsUgaritic(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCJKCompatibilityIdeographsSupplement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKCompatibilityIdeographsSupplement", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatCc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatCc", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatCc(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsHebrew(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHebrew", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsHebrew(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlReconciliateNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr tree;
+ PyObject *pyobj_tree;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlReconciliateNs", &pyobj_doc, &pyobj_tree))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ tree = (xmlNodePtr) PyxmlNode_Get(pyobj_tree);
+
+ c_retval = xmlReconciliateNs(doc, tree);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathLangFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathLangFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathLangFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathEvalExpression(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ xmlChar * str;
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"zO:xmlXPathEvalExpression", &str, &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ c_retval = xmlXPathEvalExpression(str, ctxt);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlCopyError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlErrorPtr from;
+ PyObject *pyobj_from;
+ xmlErrorPtr to;
+ PyObject *pyobj_to;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlCopyError", &pyobj_from, &pyobj_to))
+ return(NULL);
+ from = (xmlErrorPtr) PyError_Get(pyobj_from);
+ to = (xmlErrorPtr) PyError_Get(pyobj_to);
+
+ c_retval = xmlCopyError(from, to);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxNGValidateDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlRelaxNGValidCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlRelaxNGValidateDoc", &pyobj_ctxt, &pyobj_doc))
+ return(NULL);
+ ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlRelaxNGValidateDoc(ctxt, doc);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+PyObject *
+libxml_xmlNewChild(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlNodePtr parent;
+ PyObject *pyobj_parent;
+ xmlNsPtr ns;
+ PyObject *pyobj_ns;
+ xmlChar * name;
+ xmlChar * content;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlNewChild", &pyobj_parent, &pyobj_ns, &name, &content))
+ return(NULL);
+ parent = (xmlNodePtr) PyxmlNode_Get(pyobj_parent);
+ ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns);
+
+ c_retval = xmlNewChild(parent, ns, name, content);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlSearchNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNsPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlChar * nameSpace;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOz:xmlSearchNs", &pyobj_doc, &pyobj_node, &nameSpace))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlSearchNs(doc, node, nameSpace);
+ py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsKangxiRadicals(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsKangxiRadicals", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsKangxiRadicals(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNodeSetSpacePreserve(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+ int val;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlNodeSetSpacePreserve", &pyobj_cur, &val))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlNodeSetSpacePreserve(cur, val);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsArmenian(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsArmenian", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsArmenian(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCreateIntSubset(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDtdPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * name;
+ xmlChar * ExternalID;
+ xmlChar * SystemID;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozzz:xmlCreateIntSubset", &pyobj_doc, &name, &ExternalID, &SystemID))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlCreateIntSubset(doc, name, ExternalID, SystemID);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathSubValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathSubValues", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathSubValues(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsArabicPresentationFormsA(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsArabicPresentationFormsA", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsArabicPresentationFormsA(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsArabicPresentationFormsB(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsArabicPresentationFormsB", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsArabicPresentationFormsB(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsGeometricShapes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGeometricShapes", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsGeometricShapes(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathCastNodeToNumber(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ double c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathCastNodeToNumber", &pyobj_node))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlXPathCastNodeToNumber(node);
+ py_retval = libxml_doubleWrap((double) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlGetPredefinedEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlEntityPtr c_retval;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlGetPredefinedEntity", &name))
+ return(NULL);
+
+ c_retval = xmlGetPredefinedEntity(name);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewText(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlChar * content;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlNewText", &content))
+ return(NULL);
+
+ c_retval = xmlNewText(content);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlSaveFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ char * filename;
+ xmlDocPtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"zO:xmlSaveFile", &filename, &pyobj_cur))
+ return(NULL);
+ cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlSaveFile(filename, cur);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNextNamespace(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextNamespace", &pyobj_ctxt, &pyobj_cur))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlXPathNextNamespace(ctxt, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlTextReaderRelaxNGValidate(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ char * rng;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlTextReaderRelaxNGValidate", &pyobj_reader, &rng))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderRelaxNGValidate(reader, rng);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewDocText(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * content;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNewDocText", &pyobj_doc, &content))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlNewDocText(doc, content);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsBuhid(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsBuhid", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsBuhid(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlReadDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ xmlChar * cur;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"zzzi:xmlReadDoc", &cur, &URL, &encoding, &options))
+ return(NULL);
+
+ c_retval = xmlReadDoc(cur, URL, encoding, options);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNewValueTree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ xmlNodePtr val;
+ PyObject *pyobj_val;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathNewValueTree", &pyobj_val))
+ return(NULL);
+ val = (xmlNodePtr) PyxmlNode_Get(pyobj_val);
+
+ c_retval = xmlXPathNewValueTree(val);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlReaderNewFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ char * filename;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozzi:xmlReaderNewFile", &pyobj_reader, &filename, &encoding, &options))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlReaderNewFile(reader, filename, encoding, options);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsSupplementalMathematicalOperators(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSupplementalMathematicalOperators", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsSupplementalMathematicalOperators(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlFreeDtd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlDtdPtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeDtd", &pyobj_cur))
+ return(NULL);
+ cur = (xmlDtdPtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlFreeDtd(cur);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlOutputBufferWriteString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlOutputBufferPtr out;
+ PyObject *pyobj_out;
+ char * str;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlOutputBufferWriteString", &pyobj_out, &str))
+ return(NULL);
+ out = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_out);
+
+ c_retval = xmlOutputBufferWriteString(out, str);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlSetListDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNodePtr list;
+ PyObject *pyobj_list;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlSetListDoc", &pyobj_list, &pyobj_doc))
+ return(NULL);
+ list = (xmlNodePtr) PyxmlNode_Get(pyobj_list);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ xmlSetListDoc(list, doc);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlReadFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ htmlDocPtr c_retval;
+ char * filename;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"zzi:htmlReadFile", &filename, &encoding, &options))
+ return(NULL);
+
+ c_retval = htmlReadFile(filename, encoding, options);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlCtxtReadFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ htmlDocPtr c_retval;
+ htmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ char * filename;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozzi:htmlCtxtReadFile", &pyobj_ctxt, &filename, &encoding, &options))
+ return(NULL);
+ ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = htmlCtxtReadFile(ctxt, filename, encoding, options);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlThrDefLineNumbersDefaultValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int v;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefLineNumbersDefaultValue", &v))
+ return(NULL);
+
+ c_retval = xmlThrDefLineNumbersDefaultValue(v);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XINCLUDE_ENABLED
+PyObject *
+libxml_xmlXIncludeProcessTreeFlags(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlNodePtr tree;
+ PyObject *pyobj_tree;
+ int flags;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXIncludeProcessTreeFlags", &pyobj_tree, &flags))
+ return(NULL);
+ tree = (xmlNodePtr) PyxmlNode_Get(pyobj_tree);
+
+ c_retval = xmlXIncludeProcessTreeFlags(tree, flags);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XINCLUDE_ENABLED */
+PyObject *
+libxml_xmlGetID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlAttrPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * ID;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetID", &pyobj_doc, &ID))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlGetID(doc, ID);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCombiningHalfMarks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCombiningHalfMarks", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCombiningHalfMarks(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlIsBlank(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ unsigned int ch;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlIsBlank", &ch))
+ return(NULL);
+
+ c_retval = xmlIsBlank(ch);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPTR_ENABLED
+PyObject *
+libxml_xmlXPtrNewLocationSetNodes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ xmlNodePtr start;
+ PyObject *pyobj_start;
+ xmlNodePtr end;
+ PyObject *pyobj_end;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPtrNewLocationSetNodes", &pyobj_start, &pyobj_end))
+ return(NULL);
+ start = (xmlNodePtr) PyxmlNode_Get(pyobj_start);
+ end = (xmlNodePtr) PyxmlNode_Get(pyobj_end);
+
+ c_retval = xmlXPtrNewLocationSetNodes(start, end);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPTR_ENABLED */
+PyObject *
+libxml_xmlUCSIsCombiningMarksforSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCombiningMarksforSymbols", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCombiningMarksforSymbols(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatSc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatSc", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatSc(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsLao(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLao", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsLao(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatSk(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatSk", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatSk(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewDocFragment(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlNewDocFragment", &pyobj_doc))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlNewDocFragment(doc);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlValidateName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * value;
+ int space;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlValidateName", &value, &space))
+ return(NULL);
+
+ c_retval = xmlValidateName(value, space);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathFreeContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathFreeContext", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ xmlXPathFreeContext(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlURIGetAuthority(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const char * c_retval;
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetAuthority", &pyobj_URI))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ c_retval = URI->authority;
+ py_retval = libxml_charPtrConstWrap((const char *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseEncodingDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseEncodingDecl", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseEncodingDecl(ctxt);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsMiscellaneousSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMiscellaneousSymbols", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsMiscellaneousSymbols(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlSaveFileEnc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ char * filename;
+ xmlDocPtr cur;
+ PyObject *pyobj_cur;
+ char * encoding;
+
+ if (!PyArg_ParseTuple(args, (char *)"zOz:htmlSaveFileEnc", &filename, &pyobj_cur, &encoding))
+ return(NULL);
+ cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = htmlSaveFileEnc(filename, cur, encoding);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_namePop(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:namePop", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = namePop(ctxt);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseContent(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseContent", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseContent(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlReadMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ char * buffer;
+ int size;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"zizzi:xmlReadMemory", &buffer, &size, &URL, &encoding, &options))
+ return(NULL);
+
+ c_retval = xmlReadMemory(buffer, size, URL, encoding, options);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlThrDefGetWarningsDefaultValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int v;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefGetWarningsDefaultValue", &v))
+ return(NULL);
+
+ c_retval = xmlThrDefGetWarningsDefaultValue(v);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsMongolian(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMongolian", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsMongolian(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderHasAttributes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderHasAttributes", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderHasAttributes(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCJKRadicalsSupplement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKRadicalsSupplement", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCJKRadicalsSupplement(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsGothic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGothic", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsGothic(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNodeDumpOutput(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlOutputBufferPtr buf;
+ PyObject *pyobj_buf;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+ int level;
+ int format;
+ char * encoding;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOOiiz:xmlNodeDumpOutput", &pyobj_buf, &pyobj_doc, &pyobj_cur, &level, &format, &encoding))
+ return(NULL);
+ buf = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_buf);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlNodeDumpOutput(buf, doc, cur, level, format, encoding);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlCopyNamespace(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNsPtr c_retval;
+ xmlNsPtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlCopyNamespace", &pyobj_cur))
+ return(NULL);
+ cur = (xmlNsPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlCopyNamespace(cur);
+ py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathRegisteredFuncsCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathRegisteredFuncsCleanup", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ xmlXPathRegisteredFuncsCleanup(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsBlock(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+ char * block;
+
+ if (!PyArg_ParseTuple(args, (char *)"iz:xmlUCSIsBlock", &code, &block))
+ return(NULL);
+
+ c_retval = xmlUCSIsBlock(code, block);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderMoveToNextAttribute(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderMoveToNextAttribute", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderMoveToNextAttribute(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatNd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatNd", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatNd(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseSDDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseSDDecl", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseSDDecl(ctxt);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlReaderNewWalker(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlReaderNewWalker", &pyobj_reader, &pyobj_doc))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlReaderNewWalker(reader, doc);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlURISetFragment(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+ char * fragment;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetFragment", &pyobj_URI, &fragment))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ if (URI->fragment != NULL) xmlFree(URI->fragment);
+ URI->fragment = (char *)xmlStrdup((const xmlChar *)fragment);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsCatNl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatNl", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatNl(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatNo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatNo", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatNo(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathSumFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathSumFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathSumFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlSkipBlankChars(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlSkipBlankChars", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlSkipBlankChars(ctxt);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlValidateNmtokenValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * value;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlValidateNmtokenValue", &value))
+ return(NULL);
+
+ c_retval = xmlValidateNmtokenValue(value);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlGetNodePath(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlGetNodePath", &pyobj_node))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlGetNodePath(node);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlDocContentDumpOutput(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlOutputBufferPtr buf;
+ PyObject *pyobj_buf;
+ xmlDocPtr cur;
+ PyObject *pyobj_cur;
+ char * encoding;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOz:htmlDocContentDumpOutput", &pyobj_buf, &pyobj_cur, &encoding))
+ return(NULL);
+ buf = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_buf);
+ cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
+
+ htmlDocContentDumpOutput(buf, cur, encoding);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlParseChunk(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ htmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ char * chunk;
+ int size;
+ int terminate;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozii:htmlParseChunk", &pyobj_ctxt, &chunk, &size, &terminate))
+ return(NULL);
+ ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = htmlParseChunk(ctxt, chunk, size, terminate);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathPopBoolean(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathPopBoolean", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ c_retval = xmlXPathPopBoolean(ctxt);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathIdFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathIdFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathIdFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlCreateURLParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlParserCtxtPtr c_retval;
+ char * filename;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlCreateURLParserCtxt", &filename, &options))
+ return(NULL);
+
+ c_retval = xmlCreateURLParserCtxt(filename, options);
+ py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderRead(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderRead", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderRead(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlSaveUri(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlURIPtr uri;
+ PyObject *pyobj_uri;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlSaveUri", &pyobj_uri))
+ return(NULL);
+ uri = (xmlURIPtr) PyURI_Get(pyobj_uri);
+
+ c_retval = xmlSaveUri(uri);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlIsChar(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ unsigned int ch;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlIsChar", &ch))
+ return(NULL);
+
+ c_retval = xmlIsChar(ch);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlURIGetServer(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const char * c_retval;
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetServer", &pyobj_URI))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ c_retval = URI->server;
+ py_retval = libxml_charPtrConstWrap((const char *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlIsIdeographic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ unsigned int ch;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlIsIdeographic", &ch))
+ return(NULL);
+
+ c_retval = xmlIsIdeographic(ch);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlCtxtReadFd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ htmlDocPtr c_retval;
+ htmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int fd;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oizzi:htmlCtxtReadFd", &pyobj_ctxt, &fd, &URL, &encoding, &options))
+ return(NULL);
+ ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = htmlCtxtReadFd(ctxt, fd, URL, encoding, options);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlUCSIsLatinExtendedAdditional(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLatinExtendedAdditional", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsLatinExtendedAdditional(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlPedanticParserDefault(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int val;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlPedanticParserDefault", &val))
+ return(NULL);
+
+ c_retval = xmlPedanticParserDefault(val);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlURISetAuthority(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+ char * authority;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetAuthority", &pyobj_URI, &authority))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ if (URI->authority != NULL) xmlFree(URI->authority);
+ URI->authority = (char *)xmlStrdup((const xmlChar *)authority);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxNGValidatePushCData(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlRelaxNGValidCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlChar * data;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlRelaxNGValidatePushCData", &pyobj_ctxt, &data, &len))
+ return(NULL);
+ ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlRelaxNGValidatePushCData(ctxt, data, len);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+PyObject *
+libxml_xmlGetLastError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+ PyObject *py_retval;
+ xmlErrorPtr c_retval;
+
+ c_retval = xmlGetLastError();
+ py_retval = libxml_xmlErrorPtrWrap((xmlErrorPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ xmlChar * cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlParseDoc", &cur))
+ return(NULL);
+
+ c_retval = xmlParseDoc(cur);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathParseNCName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathParseNCName", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ c_retval = xmlXPathParseNCName(ctxt);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxNGNewDocParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlRelaxNGParserCtxtPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlRelaxNGNewDocParserCtxt", &pyobj_doc))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlRelaxNGNewDocParserCtxt(doc);
+ py_retval = libxml_xmlRelaxNGParserCtxtPtrWrap((xmlRelaxNGParserCtxtPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+PyObject *
+libxml_xmlConvertSGMLCatalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlCatalogPtr catal;
+ PyObject *pyobj_catal;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlConvertSGMLCatalog", &pyobj_catal))
+ return(NULL);
+ catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal);
+
+ c_retval = xmlConvertSGMLCatalog(catal);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlEncodeEntitiesReentrant(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * input;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlEncodeEntitiesReentrant", &pyobj_doc, &input))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlEncodeEntitiesReentrant(doc, input);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlRemoveProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlAttrPtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlRemoveProp", &pyobj_cur))
+ return(NULL);
+ cur = (xmlAttrPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlRemoveProp(cur);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlACatalogDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlCatalogPtr catal;
+ PyObject *pyobj_catal;
+ FILE * out;
+ PyObject *pyobj_out;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlACatalogDump", &pyobj_catal, &pyobj_out))
+ return(NULL);
+ catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal);
+ out = (FILE *) PyFile_Get(pyobj_out);
+
+ xmlACatalogDump(catal, out);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNewParserContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathParserContextPtr c_retval;
+ xmlChar * str;
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"zO:xmlXPathNewParserContext", &str, &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ c_retval = xmlXPathNewParserContext(str, ctxt);
+ py_retval = libxml_xmlXPathParserContextPtrWrap((xmlXPathParserContextPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlReadFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ char * filename;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"zzi:xmlReadFile", &filename, &encoding, &options))
+ return(NULL);
+
+ c_retval = xmlReadFile(filename, encoding, options);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsNumberForms(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsNumberForms", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsNumberForms(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseDocument(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseDocument", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseDocument(ctxt);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlStrncmp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * str1;
+ xmlChar * str2;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"zzi:xmlStrncmp", &str1, &str2, &len))
+ return(NULL);
+
+ c_retval = xmlStrncmp(str1, str2, len);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlFreeNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeNode", &pyobj_cur))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlFreeNode(cur);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlCatalogGetPublic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlChar * pubID;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlCatalogGetPublic", &pubID))
+ return(NULL);
+
+ c_retval = xmlCatalogGetPublic(pubID);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxNGValidatePushElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlRelaxNGValidCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr elem;
+ PyObject *pyobj_elem;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOO:xmlRelaxNGValidatePushElement", &pyobj_ctxt, &pyobj_doc, &pyobj_elem))
+ return(NULL);
+ ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem);
+
+ c_retval = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+PyObject *
+libxml_xmlUCSIsSinhala(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSinhala", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsSinhala(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParserInputBufferPush(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserInputBufferPtr in;
+ PyObject *pyobj_in;
+ int len;
+ char * buf;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oiz:xmlParserInputBufferPush", &pyobj_in, &len, &buf))
+ return(NULL);
+ in = (xmlParserInputBufferPtr) PyinputBuffer_Get(pyobj_in);
+
+ c_retval = xmlParserInputBufferPush(in, len, buf);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlSaveFormatFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ char * filename;
+ xmlDocPtr cur;
+ PyObject *pyobj_cur;
+ int format;
+
+ if (!PyArg_ParseTuple(args, (char *)"zOi:xmlSaveFormatFile", &filename, &pyobj_cur, &format))
+ return(NULL);
+ cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlSaveFormatFile(filename, cur, format);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlFileMatch(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ char * filename;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlFileMatch", &filename))
+ return(NULL);
+
+ c_retval = xmlFileMatch(filename);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlStrEqual(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * str1;
+ xmlChar * str2;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:xmlStrEqual", &str1, &str2))
+ return(NULL);
+
+ c_retval = xmlStrEqual(str1, str2);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderPreserve(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderPreserve", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderPreserve(reader);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsKatakanaPhoneticExtensions(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsKatakanaPhoneticExtensions", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsKatakanaPhoneticExtensions(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxNGNewParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlRelaxNGParserCtxtPtr c_retval;
+ char * URL;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlRelaxNGNewParserCtxt", &URL))
+ return(NULL);
+
+ c_retval = xmlRelaxNGNewParserCtxt(URL);
+ py_retval = libxml_xmlRelaxNGParserCtxtPtrWrap((xmlRelaxNGParserCtxtPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+PyObject *
+libxml_xmlParseXMLDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseXMLDecl", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseXMLDecl(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlNewComment(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlChar * content;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlNewComment", &content))
+ return(NULL);
+
+ c_retval = xmlNewComment(content);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxNGNewValidCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlRelaxNGValidCtxtPtr c_retval;
+ xmlRelaxNGPtr schema;
+ PyObject *pyobj_schema;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlRelaxNGNewValidCtxt", &pyobj_schema))
+ return(NULL);
+ schema = (xmlRelaxNGPtr) PyrelaxNgSchema_Get(pyobj_schema);
+
+ c_retval = xmlRelaxNGNewValidCtxt(schema);
+ py_retval = libxml_xmlRelaxNGValidCtxtPtrWrap((xmlRelaxNGValidCtxtPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+PyObject *
+libxml_xmlUCSIsKatakana(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsKatakana", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsKatakana(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XINCLUDE_ENABLED
+PyObject *
+libxml_xmlXIncludeProcess(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXIncludeProcess", &pyobj_doc))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlXIncludeProcess(doc);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XINCLUDE_ENABLED */
+PyObject *
+libxml_xmlURIGetPath(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const char * c_retval;
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetPath", &pyobj_URI))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ c_retval = URI->path;
+ py_retval = libxml_charPtrConstWrap((const char *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsHalfwidthandFullwidthForms(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHalfwidthandFullwidthForms", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsHalfwidthandFullwidthForms(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlValidateNamesValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * value;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlValidateNamesValue", &value))
+ return(NULL);
+
+ c_retval = xmlValidateNamesValue(value);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseURIReference(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlURIPtr uri;
+ PyObject *pyobj_uri;
+ char * str;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlParseURIReference", &pyobj_uri, &str))
+ return(NULL);
+ uri = (xmlURIPtr) PyURI_Get(pyobj_uri);
+
+ c_retval = xmlParseURIReference(uri, str);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUTF8Size(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * utf;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlUTF8Size", &utf))
+ return(NULL);
+
+ c_retval = xmlUTF8Size(utf);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlIsRef(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr elem;
+ PyObject *pyobj_elem;
+ xmlAttrPtr attr;
+ PyObject *pyobj_attr;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOO:xmlIsRef", &pyobj_doc, &pyobj_elem, &pyobj_attr))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem);
+ attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr);
+
+ c_retval = xmlIsRef(doc, elem, attr);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsGurmukhi(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGurmukhi", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsGurmukhi(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_namePush(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlChar * value;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:namePush", &pyobj_ctxt, &value))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = namePush(ctxt, value);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNodeSetBase(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+ xmlChar * uri;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNodeSetBase", &pyobj_cur, &uri))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlNodeSetBase(cur, uri);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlTextReaderRelaxNGSetSchema(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ xmlRelaxNGPtr schema;
+ PyObject *pyobj_schema;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlTextReaderRelaxNGSetSchema", &pyobj_reader, &pyobj_schema))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+ schema = (xmlRelaxNGPtr) PyrelaxNgSchema_Get(pyobj_schema);
+
+ c_retval = xmlTextReaderRelaxNGSetSchema(reader, schema);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsKanbun(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsKanbun", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsKanbun(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_DEBUG_ENABLED
+PyObject *
+libxml_xmlDebugDumpAttr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * output;
+ PyObject *pyobj_output;
+ xmlAttrPtr attr;
+ PyObject *pyobj_attr;
+ int depth;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOi:xmlDebugDumpAttr", &pyobj_output, &pyobj_attr, &depth))
+ return(NULL);
+ output = (FILE *) PyFile_Get(pyobj_output);
+ attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr);
+
+ xmlDebugDumpAttr(output, attr, depth);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_DEBUG_ENABLED */
+PyObject *
+libxml_xmlCleanupOutputCallbacks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlCleanupOutputCallbacks();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsLatin1Supplement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLatin1Supplement", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsLatin1Supplement(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlXPathSetContextNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathSetContextNode", &pyobj_ctxt, &pyobj_node))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ ctxt->node = node;
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlSaveFileEnc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ char * filename;
+ xmlDocPtr cur;
+ PyObject *pyobj_cur;
+ char * encoding;
+
+ if (!PyArg_ParseTuple(args, (char *)"zOz:xmlSaveFileEnc", &filename, &pyobj_cur, &encoding))
+ return(NULL);
+ cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlSaveFileEnc(filename, cur, encoding);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlXPathGetFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathGetFunction", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ c_retval = ctxt->function;
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_DEBUG_ENABLED
+PyObject *
+libxml_xmlDebugDumpOneNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * output;
+ PyObject *pyobj_output;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ int depth;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOi:xmlDebugDumpOneNode", &pyobj_output, &pyobj_node, &depth))
+ return(NULL);
+ output = (FILE *) PyFile_Get(pyobj_output);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ xmlDebugDumpOneNode(output, node, depth);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_DEBUG_ENABLED */
+PyObject *
+libxml_xmlUCSIsSyriac(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSyriac", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsSyriac(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUTF8Strloc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * utf;
+ xmlChar * utfchar;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:xmlUTF8Strloc", &utf, &utfchar))
+ return(NULL);
+
+ c_retval = xmlUTF8Strloc(utf, utfchar);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsDeseret(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsDeseret", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsDeseret(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCreateDocParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlParserCtxtPtr c_retval;
+ xmlChar * cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlCreateDocParserCtxt", &cur))
+ return(NULL);
+
+ c_retval = xmlCreateDocParserCtxt(cur);
+ py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathRoundFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathRoundFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathRoundFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsDingbats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsDingbats", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsDingbats(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlStrcasestr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlChar * str;
+ xmlChar * val;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:xmlStrcasestr", &str, &val))
+ return(NULL);
+
+ c_retval = xmlStrcasestr(str, val);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderReadState(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderReadState", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderReadState(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsPrivateUse(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsPrivateUse", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsPrivateUse(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsHangulSyllables(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHangulSyllables", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsHangulSyllables(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlRecoverFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ char * filename;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlRecoverFile", &filename))
+ return(NULL);
+
+ c_retval = xmlRecoverFile(filename);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNextFollowingSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextFollowingSibling", &pyobj_ctxt, &pyobj_cur))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlXPathNextFollowingSibling(ctxt, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlValidateQName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * value;
+ int space;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlValidateQName", &value, &space))
+ return(NULL);
+
+ c_retval = xmlValidateQName(value, space);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathCompareValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int inf;
+ int strict;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oii:xmlXPathCompareValues", &pyobj_ctxt, &inf, &strict))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ c_retval = xmlXPathCompareValues(ctxt, inf, strict);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlStrQEqual(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * pref;
+ xmlChar * name;
+ xmlChar * str;
+
+ if (!PyArg_ParseTuple(args, (char *)"zzz:xmlStrQEqual", &pref, &name, &str))
+ return(NULL);
+
+ c_retval = xmlStrQEqual(pref, name, str);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlBuildURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * URI;
+ xmlChar * base;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:xmlBuildURI", &URI, &base))
+ return(NULL);
+
+ c_retval = xmlBuildURI(URI, base);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlIsExtender(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ unsigned int ch;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlIsExtender", &ch))
+ return(NULL);
+
+ c_retval = xmlIsExtender(ch);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathCastBooleanToString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ int val;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlXPathCastBooleanToString", &val))
+ return(NULL);
+
+ c_retval = xmlXPathCastBooleanToString(val);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUTF8Charcmp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * utf1;
+ xmlChar * utf2;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:xmlUTF8Charcmp", &utf1, &utf2))
+ return(NULL);
+
+ c_retval = xmlUTF8Charcmp(utf1, utf2);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPTR_ENABLED
+PyObject *
+libxml_xmlXPtrNewRangeNodes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ xmlNodePtr start;
+ PyObject *pyobj_start;
+ xmlNodePtr end;
+ PyObject *pyobj_end;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPtrNewRangeNodes", &pyobj_start, &pyobj_end))
+ return(NULL);
+ start = (xmlNodePtr) PyxmlNode_Get(pyobj_start);
+ end = (xmlNodePtr) PyxmlNode_Get(pyobj_end);
+
+ c_retval = xmlXPtrNewRangeNodes(start, end);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPTR_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_valuePop(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:valuePop", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ c_retval = valuePop(ctxt);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathContainsFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathContainsFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathContainsFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlCtxtUseOptions(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ htmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:htmlCtxtUseOptions", &pyobj_ctxt, &options))
+ return(NULL);
+ ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = htmlCtxtUseOptions(ctxt, options);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlStringDecodeEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlChar * str;
+ int what;
+ xmlChar end;
+ xmlChar end2;
+ xmlChar end3;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oziccc:xmlStringDecodeEntities", &pyobj_ctxt, &str, &what, &end, &end2, &end3))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlStringDecodeEntities(ctxt, str, what, end, end2, end3);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlFreeCatalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlCatalogPtr catal;
+ PyObject *pyobj_catal;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeCatalog", &pyobj_catal))
+ return(NULL);
+ catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal);
+
+ xmlFreeCatalog(catal);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlNewReference(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNewReference", &pyobj_doc, &name))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlNewReference(doc, name);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsOgham(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsOgham", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsOgham(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewDocComment(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * content;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNewDocComment", &pyobj_doc, &content))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlNewDocComment(doc, content);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsBopomofoExtended(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsBopomofoExtended", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsBopomofoExtended(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsArrows(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsArrows", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsArrows(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsMusicalSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMusicalSymbols", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsMusicalSymbols(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCJKCompatibility(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKCompatibility", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCJKCompatibility(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxNGValidateFullElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlRelaxNGValidCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr elem;
+ PyObject *pyobj_elem;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOO:xmlRelaxNGValidateFullElement", &pyobj_ctxt, &pyobj_doc, &pyobj_elem))
+ return(NULL);
+ ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem);
+
+ c_retval = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+PyObject *
+libxml_xmlUCSIsLimbu(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLimbu", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsLimbu(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlAddEncodingAlias(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ char * name;
+ char * alias;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:xmlAddEncodingAlias", &name, &alias))
+ return(NULL);
+
+ c_retval = xmlAddEncodingAlias(name, alias);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatPc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatPc", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatPc(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewTextChild(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlNodePtr parent;
+ PyObject *pyobj_parent;
+ xmlNsPtr ns;
+ PyObject *pyobj_ns;
+ xmlChar * name;
+ xmlChar * content;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlNewTextChild", &pyobj_parent, &pyobj_ns, &name, &content))
+ return(NULL);
+ parent = (xmlNodePtr) PyxmlNode_Get(pyobj_parent);
+ ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns);
+
+ c_retval = xmlNewTextChild(parent, ns, name, content);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatPf(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatPf", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatPf(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatPe(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatPe", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatPe(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatPd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatPd", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatPd(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlCtxtReadMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ htmlDocPtr c_retval;
+ htmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ char * buffer;
+ int size;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozizzi:htmlCtxtReadMemory", &pyobj_ctxt, &buffer, &size, &URL, &encoding, &options))
+ return(NULL);
+ ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = htmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlUCSIsCatPi(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatPi", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatPi(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatPo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatPo", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatPo(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatPs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatPs", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatPs(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathTranslateFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathTranslateFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathTranslateFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsHighSurrogates(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHighSurrogates", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsHighSurrogates(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNodeGetSpacePreserve(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlNodeGetSpacePreserve", &pyobj_cur))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlNodeGetSpacePreserve(cur);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlResetLastError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlResetLastError();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlAddDocEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlEntityPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * name;
+ int type;
+ xmlChar * ExternalID;
+ xmlChar * SystemID;
+ xmlChar * content;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozizzz:xmlAddDocEntity", &pyobj_doc, &name, &type, &ExternalID, &SystemID, &content))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlAddDocEntity(doc, name, type, ExternalID, SystemID, content);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCatalogResolveURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * URI;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlCatalogResolveURI", &URI))
+ return(NULL);
+
+ c_retval = xmlCatalogResolveURI(URI);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathIsNaN(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ double val;
+
+ if (!PyArg_ParseTuple(args, (char *)"d:xmlXPathIsNaN", &val))
+ return(NULL);
+
+ c_retval = xmlXPathIsNaN(val);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNotEqualValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathNotEqualValues", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ c_retval = xmlXPathNotEqualValues(ctxt);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlParseEncName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseEncName", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseEncName(ctxt);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPTR_ENABLED
+PyObject *
+libxml_xmlXPtrRangeToFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPtrRangeToFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPtrRangeToFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPTR_ENABLED */
+PyObject *
+libxml_xmlTextReaderLocatorLineNumber(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderLocatorPtr locator;
+ PyObject *pyobj_locator;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderLocatorLineNumber", &pyobj_locator))
+ return(NULL);
+ locator = (xmlTextReaderLocatorPtr) PyxmlTextReaderLocator_Get(pyobj_locator);
+
+ c_retval = xmlTextReaderLocatorLineNumber(locator);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPTR_ENABLED
+PyObject *
+libxml_xmlXPtrEvalRangePredicate(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPtrEvalRangePredicate", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPtrEvalRangePredicate(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPTR_ENABLED */
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlAutoCloseTag(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ htmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * name;
+ htmlNodePtr elem;
+ PyObject *pyobj_elem;
+
+ if (!PyArg_ParseTuple(args, (char *)"OzO:htmlAutoCloseTag", &pyobj_doc, &name, &pyobj_elem))
+ return(NULL);
+ doc = (htmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ elem = (htmlNodePtr) PyxmlNode_Get(pyobj_elem);
+
+ c_retval = htmlAutoCloseTag(doc, name, elem);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlUCSIsCatLo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatLo", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatLo(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderAttributeCount(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderAttributeCount", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderAttributeCount(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCharStrndup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ char * cur;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlCharStrndup", &cur, &len))
+ return(NULL);
+
+ c_retval = xmlCharStrndup(cur, len);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlThrDefLoadExtDtdDefaultValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int v;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefLoadExtDtdDefaultValue", &v))
+ return(NULL);
+
+ c_retval = xmlThrDefLoadExtDtdDefaultValue(v);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlThrDefTreeIndentString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const char * c_retval;
+ char * v;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlThrDefTreeIndentString", &v))
+ return(NULL);
+
+ c_retval = xmlThrDefTreeIndentString(v);
+ py_retval = libxml_charPtrConstWrap((const char *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsAlphabeticPresentationForms(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsAlphabeticPresentationForms", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsAlphabeticPresentationForms(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCJKUnifiedIdeographs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKUnifiedIdeographs", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCJKUnifiedIdeographs(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlGetDocCompressMode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlGetDocCompressMode", &pyobj_doc))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlGetDocCompressMode(doc);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNextChild(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextChild", &pyobj_ctxt, &pyobj_cur))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlXPathNextChild(ctxt, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_DEBUG_ENABLED
+PyObject *
+libxml_xmlDebugDumpDocumentHead(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * output;
+ PyObject *pyobj_output;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlDebugDumpDocumentHead", &pyobj_output, &pyobj_doc))
+ return(NULL);
+ output = (FILE *) PyFile_Get(pyobj_output);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ xmlDebugDumpDocumentHead(output, doc);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_DEBUG_ENABLED */
+PyObject *
+libxml_xmlUCSIsUnifiedCanadianAboriginalSyllabics(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsUnifiedCanadianAboriginalSyllabics", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlNodeDumpOutput(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlOutputBufferPtr buf;
+ PyObject *pyobj_buf;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+ char * encoding;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOOz:htmlNodeDumpOutput", &pyobj_buf, &pyobj_doc, &pyobj_cur, &encoding))
+ return(NULL);
+ buf = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_buf);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ htmlNodeDumpOutput(buf, doc, cur, encoding);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlParseElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ htmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:htmlParseElement", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ htmlParseElement(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlCopyPropList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlAttrPtr c_retval;
+ xmlNodePtr target;
+ PyObject *pyobj_target;
+ xmlAttrPtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlCopyPropList", &pyobj_target, &pyobj_cur))
+ return(NULL);
+ target = (xmlNodePtr) PyxmlNode_Get(pyobj_target);
+ cur = (xmlAttrPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlCopyPropList(target, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlSubstituteEntitiesDefault(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int val;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlSubstituteEntitiesDefault", &val))
+ return(NULL);
+
+ c_retval = xmlSubstituteEntitiesDefault(val);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsGreek(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGreek", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsGreek(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlDocFormatDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ FILE * f;
+ PyObject *pyobj_f;
+ xmlDocPtr cur;
+ PyObject *pyobj_cur;
+ int format;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOi:xmlDocFormatDump", &pyobj_f, &pyobj_cur, &format))
+ return(NULL);
+ f = (FILE *) PyFile_Get(pyobj_f);
+ cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlDocFormatDump(f, cur, format);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsOriya(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsOriya", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsOriya(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCtxtReset(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlCtxtReset", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlCtxtReset(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlDecodeEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int len;
+ int what;
+ xmlChar end;
+ xmlChar end2;
+ xmlChar end3;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oiiccc:xmlDecodeEntities", &pyobj_ctxt, &len, &what, &end, &end2, &end3))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlDecodeEntities(ctxt, len, what, end, end2, end3);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUTF8Strndup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * utf;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlUTF8Strndup", &utf, &len))
+ return(NULL);
+
+ c_retval = xmlUTF8Strndup(utf, len);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlXPathGetContextDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathGetContextDoc", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ c_retval = ctxt->doc;
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathPopString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathPopString", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ c_retval = xmlXPathPopString(ctxt);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlURIGetPort(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetPort", &pyobj_URI))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ c_retval = URI->port;
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderGetRemainder(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlParserInputBufferPtr c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderGetRemainder", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderGetRemainder(reader);
+ py_retval = libxml_xmlParserInputBufferPtrWrap((xmlParserInputBufferPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatC(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatC", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatC(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsTaiLe(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsTaiLe", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsTaiLe(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathCastNumberToString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ double val;
+
+ if (!PyArg_ParseTuple(args, (char *)"d:xmlXPathCastNumberToString", &val))
+ return(NULL);
+
+ c_retval = xmlXPathCastNumberToString(val);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlParseComment(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseComment", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseComment(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathSubstringAfterFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathSubstringAfterFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathSubstringAfterFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlCatalogRemove(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * value;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlCatalogRemove", &value))
+ return(NULL);
+
+ c_retval = xmlCatalogRemove(value);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlSaveFormatFileEnc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ char * filename;
+ xmlDocPtr cur;
+ PyObject *pyobj_cur;
+ char * encoding;
+ int format;
+
+ if (!PyArg_ParseTuple(args, (char *)"zOzi:xmlSaveFormatFileEnc", &filename, &pyobj_cur, &encoding, &format))
+ return(NULL);
+ cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlSaveFormatFileEnc(filename, cur, encoding, format);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxNGParse(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlRelaxNGPtr c_retval;
+ xmlRelaxNGParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlRelaxNGParse", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlRelaxNGParserCtxtPtr) PyrelaxNgParserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlRelaxNGParse(ctxt);
+ py_retval = libxml_xmlRelaxNGPtrWrap((xmlRelaxNGPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlParseCharRef(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ htmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:htmlParseCharRef", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = htmlParseCharRef(ctxt);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlParseNmtoken(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseNmtoken", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseNmtoken(ctxt);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParserGetIsValid(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParserGetIsValid", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = ctxt->valid;
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseReference(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseReference", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseReference(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathPositionFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathPositionFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathPositionFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlNanoHTTPScanProxy(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ char * URL;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlNanoHTTPScanProxy", &URL))
+ return(NULL);
+
+ xmlNanoHTTPScanProxy(URL);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsMathematicalOperators(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMathematicalOperators", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsMathematicalOperators(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_DEBUG_ENABLED
+PyObject *
+libxml_xmlDebugDumpDTD(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * output;
+ PyObject *pyobj_output;
+ xmlDtdPtr dtd;
+ PyObject *pyobj_dtd;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlDebugDumpDTD", &pyobj_output, &pyobj_dtd))
+ return(NULL);
+ output = (FILE *) PyFile_Get(pyobj_output);
+ dtd = (xmlDtdPtr) PyxmlNode_Get(pyobj_dtd);
+
+ xmlDebugDumpDTD(output, dtd);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_DEBUG_ENABLED */
+#ifdef LIBXML_XPTR_ENABLED
+PyObject *
+libxml_xmlXPtrNewCollapsedRange(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ xmlNodePtr start;
+ PyObject *pyobj_start;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPtrNewCollapsedRange", &pyobj_start))
+ return(NULL);
+ start = (xmlNodePtr) PyxmlNode_Get(pyobj_start);
+
+ c_retval = xmlXPtrNewCollapsedRange(start);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPTR_ENABLED */
+PyObject *
+libxml_xmlCleanupParser(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlCleanupParser();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlTextConcat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlChar * content;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlTextConcat", &pyobj_node, &content, &len))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlTextConcat(node, content, len);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatMc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatMc", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatMc(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlStringLenGetNodeList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * value;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlStringLenGetNodeList", &pyobj_doc, &value, &len))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlStringLenGetNodeList(doc, value, len);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderLocatorBaseURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlTextReaderLocatorPtr locator;
+ PyObject *pyobj_locator;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderLocatorBaseURI", &pyobj_locator))
+ return(NULL);
+ locator = (xmlTextReaderLocatorPtr) PyxmlTextReaderLocator_Get(pyobj_locator);
+
+ c_retval = xmlTextReaderLocatorBaseURI(locator);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlSetNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlAttrPtr c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlNsPtr ns;
+ PyObject *pyobj_ns;
+ xmlChar * name;
+ xmlChar * value;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlSetNsProp", &pyobj_node, &pyobj_ns, &name, &value))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+ ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns);
+
+ c_retval = xmlSetNsProp(node, ns, name, value);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlURIGetUser(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const char * c_retval;
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetUser", &pyobj_URI))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ c_retval = URI->user;
+ py_retval = libxml_charPtrConstWrap((const char *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlSAXDefaultVersion(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int version;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlSAXDefaultVersion", &version))
+ return(NULL);
+
+ c_retval = xmlSAXDefaultVersion(version);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlLoadCatalogs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ char * pathss;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlLoadCatalogs", &pathss))
+ return(NULL);
+
+ xmlLoadCatalogs(pathss);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlCtxtReadDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ htmlDocPtr c_retval;
+ htmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlChar * cur;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozzzi:htmlCtxtReadDoc", &pyobj_ctxt, &cur, &URL, &encoding, &options))
+ return(NULL);
+ ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = htmlCtxtReadDoc(ctxt, cur, URL, encoding, options);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlGetCompressMode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+ PyObject *py_retval;
+ int c_retval;
+
+ c_retval = xmlGetCompressMode();
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseChunk(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ char * chunk;
+ int size;
+ int terminate;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozii:xmlParseChunk", &pyobj_ctxt, &chunk, &size, &terminate))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseChunk(ctxt, chunk, size, terminate);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlNewDocNoDtD(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ htmlDocPtr c_retval;
+ xmlChar * URI;
+ xmlChar * ExternalID;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:htmlNewDocNoDtD", &URI, &ExternalID))
+ return(NULL);
+
+ c_retval = htmlNewDocNoDtD(URI, ExternalID);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlParseElementDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseElementDecl", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseElementDecl(ctxt);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlURIEscape(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * str;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlURIEscape", &str))
+ return(NULL);
+
+ c_retval = xmlURIEscape(str);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlReaderForFd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlTextReaderPtr c_retval;
+ int fd;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"izzi:xmlReaderForFd", &fd, &URL, &encoding, &options))
+ return(NULL);
+
+ c_retval = xmlReaderForFd(fd, URL, encoding, options);
+ py_retval = libxml_xmlTextReaderPtrWrap((xmlTextReaderPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlDocContentDumpFormatOutput(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlOutputBufferPtr buf;
+ PyObject *pyobj_buf;
+ xmlDocPtr cur;
+ PyObject *pyobj_cur;
+ char * encoding;
+ int format;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOzi:htmlDocContentDumpFormatOutput", &pyobj_buf, &pyobj_cur, &encoding, &format))
+ return(NULL);
+ buf = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_buf);
+ cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
+
+ htmlDocContentDumpFormatOutput(buf, cur, encoding, format);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNextDescendantOrSelf(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextDescendantOrSelf", &pyobj_ctxt, &pyobj_cur))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlXPathNextDescendantOrSelf(ctxt, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsCJKCompatibilityIdeographs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKCompatibilityIdeographs", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCJKCompatibilityIdeographs(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlURISetQuery(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+ char * query;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetQuery", &pyobj_URI, &query))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ if (URI->query != NULL) xmlFree(URI->query);
+ URI->query = (char *)xmlStrdup((const xmlChar *)query);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsGreekandCoptic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGreekandCoptic", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsGreekandCoptic(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderMoveToFirstAttribute(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderMoveToFirstAttribute", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderMoveToFirstAttribute(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUTF8Strlen(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * utf;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlUTF8Strlen", &utf))
+ return(NULL);
+
+ c_retval = xmlUTF8Strlen(utf);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathAddValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathAddValues", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathAddValues(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlStrchr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlChar * str;
+ xmlChar val;
+
+ if (!PyArg_ParseTuple(args, (char *)"zc:xmlStrchr", &str, &val))
+ return(NULL);
+
+ c_retval = xmlStrchr(str, val);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParserHandleReference(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParserHandleReference", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParserHandleReference(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlTextReaderGetAttributeNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ xmlChar * localName;
+ xmlChar * namespaceURI;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlTextReaderGetAttributeNs", &pyobj_reader, &localName, &namespaceURI))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderGetAttributeNs(reader, localName, namespaceURI);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlURIGetQuery(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const char * c_retval;
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetQuery", &pyobj_URI))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ c_retval = URI->query;
+ py_retval = libxml_charPtrConstWrap((const char *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewTextLen(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlChar * content;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlNewTextLen", &content, &len))
+ return(NULL);
+
+ c_retval = xmlNewTextLen(content, len);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlXPathGetContextSize(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathGetContextSize", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ c_retval = ctxt->contextSize;
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathIsInf(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ double val;
+
+ if (!PyArg_ParseTuple(args, (char *)"d:xmlXPathIsInf", &val))
+ return(NULL);
+
+ c_retval = xmlXPathIsInf(val);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsGeneralPunctuation(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGeneralPunctuation", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsGeneralPunctuation(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsControlPictures(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsControlPictures", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsControlPictures(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlIsBooleanAttr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:htmlIsBooleanAttr", &name))
+ return(NULL);
+
+ c_retval = htmlIsBooleanAttr(name);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlNodeListGetString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr list;
+ PyObject *pyobj_list;
+ int inLine;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOi:xmlNodeListGetString", &pyobj_doc, &pyobj_list, &inLine))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ list = (xmlNodePtr) PyxmlNode_Get(pyobj_list);
+
+ c_retval = xmlNodeListGetString(doc, list, inLine);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsBengali(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsBengali", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsBengali(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlBuildQName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * ncname;
+ xmlChar * prefix;
+ xmlChar * memory;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"zzzi:xmlBuildQName", &ncname, &prefix, &memory, &len))
+ return(NULL);
+
+ c_retval = xmlBuildQName(ncname, prefix, memory, len);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlEncodeSpecialChars(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * input;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlEncodeSpecialChars", &pyobj_doc, &input))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlEncodeSpecialChars(doc, input);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlFreePropList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlAttrPtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlFreePropList", &pyobj_cur))
+ return(NULL);
+ cur = (xmlAttrPtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlFreePropList(cur);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlTextReaderConstString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ xmlChar * str;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlTextReaderConstString", &pyobj_reader, &str))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderConstString(reader, str);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathStringFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathStringFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathStringFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlAddNextSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+ xmlNodePtr elem;
+ PyObject *pyobj_elem;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlAddNextSibling", &pyobj_cur, &pyobj_elem))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+ elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem);
+
+ c_retval = xmlAddNextSibling(cur, elem);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsSupplementalArrowsA(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSupplementalArrowsA", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsSupplementalArrowsA(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsSupplementalArrowsB(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSupplementalArrowsB", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsSupplementalArrowsB(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlInitParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlInitParserCtxt", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlInitParserCtxt(ctxt);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlErrorGetMessage(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const char * c_retval;
+ xmlErrorPtr Error;
+ PyObject *pyobj_Error;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlErrorGetMessage", &pyobj_Error))
+ return(NULL);
+ Error = (xmlErrorPtr) PyError_Get(pyobj_Error);
+
+ c_retval = Error->message;
+ py_retval = libxml_charPtrConstWrap((const char *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlRemoveID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlAttrPtr attr;
+ PyObject *pyobj_attr;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlRemoveID", &pyobj_doc, &pyobj_attr))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr);
+
+ c_retval = xmlRemoveID(doc, attr);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsTagbanwa(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsTagbanwa", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsTagbanwa(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathFalseFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathFalseFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathFalseFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlTextReaderHasValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderHasValue", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderHasValue(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxNGDumpTree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * output;
+ PyObject *pyobj_output;
+ xmlRelaxNGPtr schema;
+ PyObject *pyobj_schema;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlRelaxNGDumpTree", &pyobj_output, &pyobj_schema))
+ return(NULL);
+ output = (FILE *) PyFile_Get(pyobj_output);
+ schema = (xmlRelaxNGPtr) PyrelaxNgSchema_Get(pyobj_schema);
+
+ xmlRelaxNGDumpTree(output, schema);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+PyObject *
+libxml_xmlUCSIsCatSo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatSo", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatSo(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderConstBaseUri(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderConstBaseUri", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderConstBaseUri(reader);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_REGEXP_ENABLED
+PyObject *
+libxml_xmlRegexpPrint(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * output;
+ PyObject *pyobj_output;
+ xmlRegexpPtr regexp;
+ PyObject *pyobj_regexp;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlRegexpPrint", &pyobj_output, &pyobj_regexp))
+ return(NULL);
+ output = (FILE *) PyFile_Get(pyobj_output);
+ regexp = (xmlRegexpPtr) PyxmlReg_Get(pyobj_regexp);
+
+ xmlRegexpPrint(output, regexp);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_REGEXP_ENABLED */
+PyObject *
+libxml_xmlUCSIsCatSm(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatSm", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatSm(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlURIEscapeStr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * str;
+ xmlChar * list;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:xmlURIEscapeStr", &str, &list))
+ return(NULL);
+
+ c_retval = xmlURIEscapeStr(str, list);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderMoveToAttributeNo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ int no;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlTextReaderMoveToAttributeNo", &pyobj_reader, &no))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderMoveToAttributeNo(reader, no);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathCountFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathCountFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathCountFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlParserHandlePEReference(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParserHandlePEReference", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParserHandlePEReference(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlTextReaderMoveToAttributeNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ xmlChar * localName;
+ xmlChar * namespaceURI;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlTextReaderMoveToAttributeNs", &pyobj_reader, &localName, &namespaceURI))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderMoveToAttributeNs(reader, localName, namespaceURI);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderNext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderNext", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderNext(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNewBoolean(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ int val;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlXPathNewBoolean", &val))
+ return(NULL);
+
+ c_retval = xmlXPathNewBoolean(val);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsPrivateUseArea(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsPrivateUseArea", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsPrivateUseArea(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlXPathGetContextNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathGetContextNode", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ c_retval = ctxt->node;
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParserSetPedantic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int pedantic;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlParserSetPedantic", &pyobj_ctxt, &pedantic))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ ctxt->pedantic = pedantic;
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsCatLu(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatLu", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatLu(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatLt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatLt", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatLt(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCtxtReadFd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int fd;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oizzi:xmlCtxtReadFd", &pyobj_ctxt, &fd, &URL, &encoding, &options))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlCtxtReadFd(ctxt, fd, URL, encoding, options);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlIsPubidChar(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ unsigned int ch;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlIsPubidChar", &ch))
+ return(NULL);
+
+ c_retval = xmlIsPubidChar(ch);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatLm(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatLm", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatLm(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatLl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatLl", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatLl(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlReadMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ htmlDocPtr c_retval;
+ char * buffer;
+ int size;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"zizzi:htmlReadMemory", &buffer, &size, &URL, &encoding, &options))
+ return(NULL);
+
+ c_retval = htmlReadMemory(buffer, size, URL, encoding, options);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlUCSIsCypriotSyllabary(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCypriotSyllabary", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCypriotSyllabary(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlGetNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlChar * name;
+ xmlChar * nameSpace;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlGetNsProp", &pyobj_node, &name, &nameSpace))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlGetNsProp(node, name, nameSpace);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewDocProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlAttrPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * name;
+ xmlChar * value;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlNewDocProp", &pyobj_doc, &name, &value))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlNewDocProp(doc, name, value);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatN(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatN", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatN(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatL(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatL", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatL(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatM(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatM", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatM(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlLoadACatalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlCatalogPtr c_retval;
+ char * filename;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlLoadACatalog", &filename))
+ return(NULL);
+
+ c_retval = xmlLoadACatalog(filename);
+ py_retval = libxml_xmlCatalogPtrWrap((xmlCatalogPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCtxtResetPush(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ char * chunk;
+ int size;
+ char * filename;
+ char * encoding;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozizz:xmlCtxtResetPush", &pyobj_ctxt, &chunk, &size, &filename, &encoding))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlCtxtResetPush(ctxt, chunk, size, filename, encoding);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatS(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatS", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatS(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatP(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatP", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatP(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCatalogGetSystem(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlChar * sysID;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlCatalogGetSystem", &sysID))
+ return(NULL);
+
+ c_retval = xmlCatalogGetSystem(sysID);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatZ(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatZ", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatZ(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_REGEXP_ENABLED
+PyObject *
+libxml_xmlRegexpExec(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlRegexpPtr comp;
+ PyObject *pyobj_comp;
+ xmlChar * content;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlRegexpExec", &pyobj_comp, &content))
+ return(NULL);
+ comp = (xmlRegexpPtr) PyxmlReg_Get(pyobj_comp);
+
+ c_retval = xmlRegexpExec(comp, content);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_REGEXP_ENABLED */
+PyObject *
+libxml_xmlByteConsumed(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ long c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlByteConsumed", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlByteConsumed(ctxt);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsSuperscriptsandSubscripts(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSuperscriptsandSubscripts", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsSuperscriptsandSubscripts(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlHasProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlAttrPtr c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlHasProp", &pyobj_node, &name))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlHasProp(node, name);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlGetDtdElementDesc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlElementPtr c_retval;
+ xmlDtdPtr dtd;
+ PyObject *pyobj_dtd;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetDtdElementDesc", &pyobj_dtd, &name))
+ return(NULL);
+ dtd = (xmlDtdPtr) PyxmlNode_Get(pyobj_dtd);
+
+ c_retval = xmlGetDtdElementDesc(dtd, name);
+ py_retval = libxml_xmlElementPtrWrap((xmlElementPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsPhoneticExtensions(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsPhoneticExtensions", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsPhoneticExtensions(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathCastNodeToString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathCastNodeToString", &pyobj_node))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlXPathCastNodeToString(node);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlURISetPort(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+ int port;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlURISetPort", &pyobj_URI, &port))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ URI->port = port;
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlGetDtdQAttrDesc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlAttributePtr c_retval;
+ xmlDtdPtr dtd;
+ PyObject *pyobj_dtd;
+ xmlChar * elem;
+ xmlChar * name;
+ xmlChar * prefix;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozzz:xmlGetDtdQAttrDesc", &pyobj_dtd, &elem, &name, &prefix))
+ return(NULL);
+ dtd = (xmlDtdPtr) PyxmlNode_Get(pyobj_dtd);
+
+ c_retval = xmlGetDtdQAttrDesc(dtd, elem, name, prefix);
+ py_retval = libxml_xmlAttributePtrWrap((xmlAttributePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlSetNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlNsPtr ns;
+ PyObject *pyobj_ns;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlSetNs", &pyobj_node, &pyobj_ns))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+ ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns);
+
+ xmlSetNs(node, ns);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlNamespaceParseNCName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlNamespaceParseNCName", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlNamespaceParseNCName(ctxt);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlAddChildList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlNodePtr parent;
+ PyObject *pyobj_parent;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlAddChildList", &pyobj_parent, &pyobj_cur))
+ return(NULL);
+ parent = (xmlNodePtr) PyxmlNode_Get(pyobj_parent);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlAddChildList(parent, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlGetDtdEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlEntityPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetDtdEntity", &pyobj_doc, &name))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlGetDtdEntity(doc, name);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlIsXHTML(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * systemID;
+ xmlChar * publicID;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:xmlIsXHTML", &systemID, &publicID))
+ return(NULL);
+
+ c_retval = xmlIsXHTML(systemID, publicID);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlURIUnescapeString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ char * c_retval;
+ char * str;
+ int len;
+ char * target;
+
+ if (!PyArg_ParseTuple(args, (char *)"ziz:xmlURIUnescapeString", &str, &len, &target))
+ return(NULL);
+
+ c_retval = xmlURIUnescapeString(str, len, target);
+ py_retval = libxml_charPtrWrap((char *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsRunic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsRunic", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsRunic(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlGetParameterEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlEntityPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetParameterEntity", &pyobj_doc, &name))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlGetParameterEntity(doc, name);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlInitGlobals(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlInitGlobals();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlNewDocTextLen(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * content;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlNewDocTextLen", &pyobj_doc, &content, &len))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlNewDocTextLen(doc, content, len);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathParseName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathParseName", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ c_retval = xmlXPathParseName(ctxt);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlURISetPath(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+ char * path;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetPath", &pyobj_URI, &path))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ if (URI->path != NULL) xmlFree(URI->path);
+ URI->path = (char *)xmlStrdup((const xmlChar *)path);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsEthiopic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsEthiopic", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsEthiopic(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderClose", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderClose(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlErrorGetFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const char * c_retval;
+ xmlErrorPtr Error;
+ PyObject *pyobj_Error;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlErrorGetFile", &pyobj_Error))
+ return(NULL);
+ Error = (xmlErrorPtr) PyError_Get(pyobj_Error);
+
+ c_retval = Error->file;
+ py_retval = libxml_charPtrConstWrap((const char *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlGetProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetProp", &pyobj_node, &name))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlGetProp(node, name);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlParseFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ htmlDocPtr c_retval;
+ char * filename;
+ char * encoding;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:htmlParseFile", &filename, &encoding))
+ return(NULL);
+
+ c_retval = htmlParseFile(filename, encoding);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlACatalogResolveURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlCatalogPtr catal;
+ PyObject *pyobj_catal;
+ xmlChar * URI;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlACatalogResolveURI", &pyobj_catal, &URI))
+ return(NULL);
+ catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal);
+
+ c_retval = xmlACatalogResolveURI(catal, URI);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsVariationSelectors(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsVariationSelectors", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsVariationSelectors(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPatherror(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ char * file;
+ int line;
+ int no;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozii:xmlXPatherror", &pyobj_ctxt, &file, &line, &no))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPatherror(ctxt, file, line, no);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlLoadCatalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ char * filename;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlLoadCatalog", &filename))
+ return(NULL);
+
+ c_retval = xmlLoadCatalog(filename);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParserSetLoadSubset(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int loadsubset;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlParserSetLoadSubset", &pyobj_ctxt, &loadsubset))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ ctxt->loadsubset = loadsubset;
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlURIGetScheme(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const char * c_retval;
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetScheme", &pyobj_URI))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ c_retval = URI->scheme;
+ py_retval = libxml_charPtrConstWrap((const char *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathEval(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ xmlChar * str;
+ xmlXPathContextPtr ctx;
+ PyObject *pyobj_ctx;
+
+ if (!PyArg_ParseTuple(args, (char *)"zO:xmlXPathEval", &str, &pyobj_ctx))
+ return(NULL);
+ ctx = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctx);
+
+ c_retval = xmlXPathEval(str, ctx);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlReadDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ htmlDocPtr c_retval;
+ xmlChar * cur;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"zzzi:htmlReadDoc", &cur, &URL, &encoding, &options))
+ return(NULL);
+
+ c_retval = htmlReadDoc(cur, URL, encoding, options);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlUCSIsTags(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsTags", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsTags(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewPI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlChar * name;
+ xmlChar * content;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:xmlNewPI", &name, &content))
+ return(NULL);
+
+ c_retval = xmlNewPI(name, content);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsLowSurrogates(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLowSurrogates", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsLowSurrogates(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsOsmanya(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsOsmanya", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsOsmanya(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlThrDefDoValidityCheckingDefaultValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int v;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefDoValidityCheckingDefaultValue", &v))
+ return(NULL);
+
+ c_retval = xmlThrDefDoValidityCheckingDefaultValue(v);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlXPathGetContextPosition(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathGetContextPosition", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ c_retval = ctxt->proximityPosition;
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlNodeDumpFileFormat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ FILE * out;
+ PyObject *pyobj_out;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+ char * encoding;
+ int format;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOOzi:htmlNodeDumpFileFormat", &pyobj_out, &pyobj_doc, &pyobj_cur, &encoding, &format))
+ return(NULL);
+ out = (FILE *) PyFile_Get(pyobj_out);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = htmlNodeDumpFileFormat(out, doc, cur, encoding, format);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlTextReaderIsValid(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderIsValid", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderIsValid(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsByzantineMusicalSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsByzantineMusicalSymbols", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsByzantineMusicalSymbols(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlResetError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlErrorPtr err;
+ PyObject *pyobj_err;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlResetError", &pyobj_err))
+ return(NULL);
+ err = (xmlErrorPtr) PyError_Get(pyobj_err);
+
+ xmlResetError(err);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_htmlDefaultSAXHandlerInit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ htmlDefaultSAXHandlerInit();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_DEBUG_ENABLED
+PyObject *
+libxml_xmlShellPrintXPathError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ int errorType;
+ char * arg;
+
+ if (!PyArg_ParseTuple(args, (char *)"iz:xmlShellPrintXPathError", &errorType, &arg))
+ return(NULL);
+
+ xmlShellPrintXPathError(errorType, arg);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_DEBUG_ENABLED */
+PyObject *
+libxml_xmlCleanupEncodingAliases(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlCleanupEncodingAliases();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathRegisteredNsCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathRegisteredNsCleanup", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ xmlXPathRegisteredNsCleanup(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlCatalogResolve(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * pubID;
+ xmlChar * sysID;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:xmlCatalogResolve", &pubID, &sysID))
+ return(NULL);
+
+ c_retval = xmlCatalogResolve(pubID, sysID);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderConstName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderConstName", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderConstName(reader);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderConstXmlLang(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderConstXmlLang", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderConstXmlLang(reader);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsKhmer(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsKhmer", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsKhmer(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNodeSetContent(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+ xmlChar * content;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNodeSetContent", &pyobj_cur, &content))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlNodeSetContent(cur, content);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlParseCharRef(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseCharRef", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseCharRef(ctxt);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUnlinkNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlUnlinkNode", &pyobj_cur))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlUnlinkNode(cur);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlCopyCharMultiByte(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * out;
+ int val;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlCopyCharMultiByte", &out, &val))
+ return(NULL);
+
+ c_retval = xmlCopyCharMultiByte(out, val);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseVersionNum(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseVersionNum", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseVersionNum(ctxt);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_DEBUG_ENABLED
+PyObject *
+libxml_xmlBoolToText(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const char * c_retval;
+ int boolval;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlBoolToText", &boolval))
+ return(NULL);
+
+ c_retval = xmlBoolToText(boolval);
+ py_retval = libxml_charPtrConstWrap((const char *) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_DEBUG_ENABLED */
+PyObject *
+libxml_xmlSetCompressMode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ int mode;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlSetCompressMode", &mode))
+ return(NULL);
+
+ xmlSetCompressMode(mode);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlParseDocument(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ htmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:htmlParseDocument", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = htmlParseDocument(ctxt);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlTextReaderNodeType(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderNodeType", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderNodeType(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathSubstringFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathSubstringFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathSubstringFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlIsBlankNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlIsBlankNode", &pyobj_node))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlIsBlankNode(node);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_DEBUG_ENABLED
+PyObject *
+libxml_xmlDebugDumpNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * output;
+ PyObject *pyobj_output;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ int depth;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOi:xmlDebugDumpNode", &pyobj_output, &pyobj_node, &depth))
+ return(NULL);
+ output = (FILE *) PyFile_Get(pyobj_output);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ xmlDebugDumpNode(output, node, depth);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_DEBUG_ENABLED */
+PyObject *
+libxml_xmlCopyDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ int recursive;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlCopyDoc", &pyobj_doc, &recursive))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlCopyDoc(doc, recursive);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxNGNewMemParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlRelaxNGParserCtxtPtr c_retval;
+ char * buffer;
+ int size;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlRelaxNGNewMemParserCtxt", &buffer, &size))
+ return(NULL);
+
+ c_retval = xmlRelaxNGNewMemParserCtxt(buffer, size);
+ py_retval = libxml_xmlRelaxNGParserCtxtPtrWrap((xmlRelaxNGParserCtxtPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+PyObject *
+libxml_xmlFreeProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlAttrPtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeProp", &pyobj_cur))
+ return(NULL);
+ cur = (xmlAttrPtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlFreeProp(cur);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlCtxtReadMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ char * buffer;
+ int size;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozizzi:xmlCtxtReadMemory", &pyobj_ctxt, &buffer, &size, &URL, &encoding, &options))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCreateFileParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlParserCtxtPtr c_retval;
+ char * filename;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlCreateFileParserCtxt", &filename))
+ return(NULL);
+
+ c_retval = xmlCreateFileParserCtxt(filename);
+ py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseSystemLiteral(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseSystemLiteral", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseSystemLiteral(ctxt);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlDocSetRootElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr root;
+ PyObject *pyobj_root;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlDocSetRootElement", &pyobj_doc, &pyobj_root))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ root = (xmlNodePtr) PyxmlNode_Get(pyobj_root);
+
+ c_retval = xmlDocSetRootElement(doc, root);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseAttributeListDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseAttributeListDecl", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseAttributeListDecl(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlCheckVersion(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ int version;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlCheckVersion", &version))
+ return(NULL);
+
+ xmlCheckVersion(version);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_REGEXP_ENABLED
+PyObject *
+libxml_xmlRegFreeRegexp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlRegexpPtr regexp;
+ PyObject *pyobj_regexp;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlRegFreeRegexp", &pyobj_regexp))
+ return(NULL);
+ regexp = (xmlRegexpPtr) PyxmlReg_Get(pyobj_regexp);
+
+ xmlRegFreeRegexp(regexp);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_REGEXP_ENABLED */
+PyObject *
+libxml_nodePush(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlNodePtr value;
+ PyObject *pyobj_value;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:nodePush", &pyobj_ctxt, &pyobj_value))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+ value = (xmlNodePtr) PyxmlNode_Get(pyobj_value);
+
+ c_retval = nodePush(ctxt, value);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlGetLineNo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ long c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlGetLineNo", &pyobj_node))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlGetLineNo(node);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_REGEXP_ENABLED
+PyObject *
+libxml_xmlRegexpIsDeterminist(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlRegexpPtr comp;
+ PyObject *pyobj_comp;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlRegexpIsDeterminist", &pyobj_comp))
+ return(NULL);
+ comp = (xmlRegexpPtr) PyxmlReg_Get(pyobj_comp);
+
+ c_retval = xmlRegexpIsDeterminist(comp);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_REGEXP_ENABLED */
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlNewDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ htmlDocPtr c_retval;
+ xmlChar * URI;
+ xmlChar * ExternalID;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:htmlNewDoc", &URI, &ExternalID))
+ return(NULL);
+
+ c_retval = htmlNewDoc(URI, ExternalID);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlUCSIsCat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+ char * cat;
+
+ if (!PyArg_ParseTuple(args, (char *)"iz:xmlUCSIsCat", &code, &cat))
+ return(NULL);
+
+ c_retval = xmlUCSIsCat(code, cat);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlURISetUser(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+ char * user;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetUser", &pyobj_URI, &user))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ if (URI->user != NULL) xmlFree(URI->user);
+ URI->user = (char *)xmlStrdup((const xmlChar *)user);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlIsScriptAttribute(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:htmlIsScriptAttribute", &name))
+ return(NULL);
+
+ c_retval = htmlIsScriptAttribute(name);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlInitializePredefinedEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlInitializePredefinedEntities();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNextAttribute(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextAttribute", &pyobj_ctxt, &pyobj_cur))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlXPathNextAttribute(ctxt, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsMiscellaneousTechnical(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMiscellaneousTechnical", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsMiscellaneousTechnical(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlXPathParserGetContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathContextPtr c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathParserGetContext", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ c_retval = ctxt->context;
+ py_retval = libxml_xmlXPathContextPtrWrap((xmlXPathContextPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxNGValidatePopElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlRelaxNGValidCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr elem;
+ PyObject *pyobj_elem;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOO:xmlRelaxNGValidatePopElement", &pyobj_ctxt, &pyobj_doc, &pyobj_elem))
+ return(NULL);
+ ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem);
+
+ c_retval = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+#ifdef LIBXML_DEBUG_ENABLED
+PyObject *
+libxml_xmlShellPrintNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlShellPrintNode", &pyobj_node))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ xmlShellPrintNode(node);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_DEBUG_ENABLED */
+PyObject *
+libxml_xmlValidateNMToken(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * value;
+ int space;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlValidateNMToken", &value, &space))
+ return(NULL);
+
+ c_retval = xmlValidateNMToken(value, space);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderReadAttributeValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderReadAttributeValue", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderReadAttributeValue(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsGeorgian(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGeorgian", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsGeorgian(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParserSetValidate(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int validate;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlParserSetValidate", &pyobj_ctxt, &validate))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ ctxt->validate = validate;
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlErrorGetCode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlErrorPtr Error;
+ PyObject *pyobj_Error;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlErrorGetCode", &pyobj_Error))
+ return(NULL);
+ Error = (xmlErrorPtr) PyError_Get(pyobj_Error);
+
+ c_retval = Error->code;
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlValidNormalizeAttributeValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr elem;
+ PyObject *pyobj_elem;
+ xmlChar * name;
+ xmlChar * value;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlValidNormalizeAttributeValue", &pyobj_doc, &pyobj_elem, &name, &value))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem);
+
+ c_retval = xmlValidNormalizeAttributeValue(doc, elem, name, value);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNewContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathContextPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathNewContext", &pyobj_doc))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlXPathNewContext(doc);
+ py_retval = libxml_xmlXPathContextPtrWrap((xmlXPathContextPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlParsePubidLiteral(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParsePubidLiteral", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParsePubidLiteral(ctxt);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewCharRef(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNewCharRef", &pyobj_doc, &name))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlNewCharRef(doc, name);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsArabic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsArabic", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsArabic(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNanoHTTPCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlNanoHTTPCleanup();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlParseQuotedString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseQuotedString", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseQuotedString(ctxt);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathCastStringToNumber(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ double c_retval;
+ xmlChar * val;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlXPathCastStringToNumber", &val))
+ return(NULL);
+
+ c_retval = xmlXPathCastStringToNumber(val);
+ py_retval = libxml_doubleWrap((double) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNewCString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ char * val;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlXPathNewCString", &val))
+ return(NULL);
+
+ c_retval = xmlXPathNewCString(val);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlThrDefDefaultBufferSize(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int v;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefDefaultBufferSize", &v))
+ return(NULL);
+
+ c_retval = xmlThrDefDefaultBufferSize(v);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNsPtr c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlChar * href;
+ xmlChar * prefix;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlNewNs", &pyobj_node, &href, &prefix))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlNewNs(node, href, prefix);
+ py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlACatalogResolvePublic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlCatalogPtr catal;
+ PyObject *pyobj_catal;
+ xmlChar * pubID;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlACatalogResolvePublic", &pyobj_catal, &pubID))
+ return(NULL);
+ catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal);
+
+ c_retval = xmlACatalogResolvePublic(catal, pubID);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlStopParser(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlStopParser", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlStopParser(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlReadFd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ int fd;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"izzi:xmlReadFd", &fd, &URL, &encoding, &options))
+ return(NULL);
+
+ c_retval = xmlReadFd(fd, URL, encoding, options);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlACatalogResolveSystem(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlCatalogPtr catal;
+ PyObject *pyobj_catal;
+ xmlChar * sysID;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlACatalogResolveSystem", &pyobj_catal, &sysID))
+ return(NULL);
+ catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal);
+
+ c_retval = xmlACatalogResolveSystem(catal, sysID);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlThrDefParserDebugEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int v;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefParserDebugEntities", &v))
+ return(NULL);
+
+ c_retval = xmlThrDefParserDebugEntities(v);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCatalogConvert(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+ PyObject *py_retval;
+ int c_retval;
+
+ c_retval = xmlCatalogConvert();
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCJKSymbolsandPunctuation(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKSymbolsandPunctuation", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCJKSymbolsandPunctuation(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsTaiXuanJingSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsTaiXuanJingSymbols", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsTaiXuanJingSymbols(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlDocDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ FILE * f;
+ PyObject *pyobj_f;
+ xmlDocPtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:htmlDocDump", &pyobj_f, &pyobj_cur))
+ return(NULL);
+ f = (FILE *) PyFile_Get(pyobj_f);
+ cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = htmlDocDump(f, cur);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlNanoFTPInit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlNanoFTPInit();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlFreeNodeList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeNodeList", &pyobj_cur))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlFreeNodeList(cur);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlCreateEntityParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlParserCtxtPtr c_retval;
+ xmlChar * URL;
+ xmlChar * ID;
+ xmlChar * base;
+
+ if (!PyArg_ParseTuple(args, (char *)"zzz:xmlCreateEntityParserCtxt", &URL, &ID, &base))
+ return(NULL);
+
+ c_retval = xmlCreateEntityParserCtxt(URL, ID, base);
+ py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathDivValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathDivValues", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathDivValues(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlRemoveRef(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlAttrPtr attr;
+ PyObject *pyobj_attr;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlRemoveRef", &pyobj_doc, &pyobj_attr))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr);
+
+ c_retval = xmlRemoveRef(doc, attr);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsTelugu(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsTelugu", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsTelugu(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_DEBUG_ENABLED
+PyObject *
+libxml_xmlLsCountNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlLsCountNode", &pyobj_node))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlLsCountNode(node);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_DEBUG_ENABLED */
+PyObject *
+libxml_xmlParseCatalogFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ char * filename;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlParseCatalogFile", &filename))
+ return(NULL);
+
+ c_retval = xmlParseCatalogFile(filename);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlXPathGetFunctionURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathGetFunctionURI", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ c_retval = ctxt->functionURI;
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlOutputBufferWrite(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlOutputBufferPtr out;
+ PyObject *pyobj_out;
+ int len;
+ char * buf;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oiz:xmlOutputBufferWrite", &pyobj_out, &len, &buf))
+ return(NULL);
+ out = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_out);
+
+ c_retval = xmlOutputBufferWrite(out, len, buf);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatMn(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatMn", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatMn(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxNGCleanupTypes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlRelaxNGCleanupTypes();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+PyObject *
+libxml_xmlUCSIsCatMe(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatMe", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatMe(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlGetLastChild(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlNodePtr parent;
+ PyObject *pyobj_parent;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlGetLastChild", &pyobj_parent))
+ return(NULL);
+ parent = (xmlNodePtr) PyxmlNode_Get(pyobj_parent);
+
+ c_retval = xmlGetLastChild(parent);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlGetEncodingAlias(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const char * c_retval;
+ char * alias;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlGetEncodingAlias", &alias))
+ return(NULL);
+
+ c_retval = xmlGetEncodingAlias(alias);
+ py_retval = libxml_charPtrConstWrap((const char *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlACatalogAdd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlCatalogPtr catal;
+ PyObject *pyobj_catal;
+ xmlChar * type;
+ xmlChar * orig;
+ xmlChar * replace;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozzz:xmlACatalogAdd", &pyobj_catal, &type, &orig, &replace))
+ return(NULL);
+ catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal);
+
+ c_retval = xmlACatalogAdd(catal, type, orig, replace);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlAddDtdEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlEntityPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * name;
+ int type;
+ xmlChar * ExternalID;
+ xmlChar * SystemID;
+ xmlChar * content;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozizzz:xmlAddDtdEntity", &pyobj_doc, &name, &type, &ExternalID, &SystemID, &content))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlAddDtdEntity(doc, name, type, ExternalID, SystemID, content);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewNsPropEatName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlAttrPtr c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlNsPtr ns;
+ PyObject *pyobj_ns;
+ xmlChar * name;
+ xmlChar * value;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlNewNsPropEatName", &pyobj_node, &pyobj_ns, &name, &value))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+ ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns);
+
+ c_retval = xmlNewNsPropEatName(node, ns, name, value);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseNotationDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseNotationDecl", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseNotationDecl(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlNewDocRawNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNsPtr ns;
+ PyObject *pyobj_ns;
+ xmlChar * name;
+ xmlChar * content;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlNewDocRawNode", &pyobj_doc, &pyobj_ns, &name, &content))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns);
+
+ c_retval = xmlNewDocRawNode(doc, ns, name, content);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathConcatFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathConcatFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathConcatFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlTextReaderConstNamespaceUri(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderConstNamespaceUri", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderConstNamespaceUri(reader);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsBasicLatin(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsBasicLatin", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsBasicLatin(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseMisc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseMisc", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseMisc(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlParserInputBufferGrow(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserInputBufferPtr in;
+ PyObject *pyobj_in;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlParserInputBufferGrow", &pyobj_in, &len))
+ return(NULL);
+ in = (xmlParserInputBufferPtr) PyinputBuffer_Get(pyobj_in);
+
+ c_retval = xmlParserInputBufferGrow(in, len);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlStrdup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlStrdup", &cur))
+ return(NULL);
+
+ c_retval = xmlStrdup(cur);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNamespaceURIFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathNamespaceURIFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathNamespaceURIFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlCtxtReadDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlChar * cur;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozzzi:xmlCtxtReadDoc", &pyobj_ctxt, &cur, &URL, &encoding, &options))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlCtxtReadDoc(ctxt, cur, URL, encoding, options);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderGetParserProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ int prop;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlTextReaderGetParserProp", &pyobj_reader, &prop))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderGetParserProp(reader, prop);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlStrncat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * cur;
+ xmlChar * add;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"zzi:xmlStrncat", &cur, &add, &len))
+ return(NULL);
+
+ c_retval = xmlStrncat(cur, add, len);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderQuoteChar(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderQuoteChar", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderQuoteChar(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlInitCharEncodingHandlers(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlInitCharEncodingHandlers();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlACatalogResolve(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlCatalogPtr catal;
+ PyObject *pyobj_catal;
+ xmlChar * pubID;
+ xmlChar * sysID;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlACatalogResolve", &pyobj_catal, &pubID, &sysID))
+ return(NULL);
+ catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal);
+
+ c_retval = xmlACatalogResolve(catal, pubID, sysID);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_REGEXP_ENABLED
+PyObject *
+libxml_xmlRegexpCompile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlRegexpPtr c_retval;
+ xmlChar * regexp;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlRegexpCompile", &regexp))
+ return(NULL);
+
+ c_retval = xmlRegexpCompile(regexp);
+ py_retval = libxml_xmlRegexpPtrWrap((xmlRegexpPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_REGEXP_ENABLED */
+PyObject *
+libxml_xmlParseMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ char * buffer;
+ int size;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlParseMemory", &buffer, &size))
+ return(NULL);
+
+ c_retval = xmlParseMemory(buffer, size);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNewNodeSet(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ xmlNodePtr val;
+ PyObject *pyobj_val;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathNewNodeSet", &pyobj_val))
+ return(NULL);
+ val = (xmlNodePtr) PyxmlNode_Get(pyobj_val);
+
+ c_retval = xmlXPathNewNodeSet(val);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsKannada(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsKannada", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsKannada(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderConstValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderConstValue", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderConstValue(reader);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathCeilingFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathCeilingFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathCeilingFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsSmallFormVariants(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSmallFormVariants", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsSmallFormVariants(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_docbDefaultSAXHandlerInit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ docbDefaultSAXHandlerInit();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlInitParser(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlInitParser();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlSaveFileTo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlOutputBufferPtr buf;
+ PyObject *pyobj_buf;
+ xmlDocPtr cur;
+ PyObject *pyobj_cur;
+ char * encoding;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOz:xmlSaveFileTo", &pyobj_buf, &pyobj_cur, &encoding))
+ return(NULL);
+ buf = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_buf);
+ cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlSaveFileTo(buf, cur, encoding);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathStartsWithFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathStartsWithFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathStartsWithFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlSearchNsByHref(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNsPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlChar * href;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOz:xmlSearchNsByHref", &pyobj_doc, &pyobj_node, &href))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlSearchNsByHref(doc, node, href);
+ py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseTextDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseTextDecl", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseTextDecl(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNextPreceding(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextPreceding", &pyobj_ctxt, &pyobj_cur))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlXPathNextPreceding(ctxt, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlURISetScheme(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+ char * scheme;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetScheme", &pyobj_URI, &scheme))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ if (URI->scheme != NULL) xmlFree(URI->scheme);
+ URI->scheme = (char *)xmlStrdup((const xmlChar *)scheme);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathRegisterAllFunctions(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathRegisterAllFunctions", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ xmlXPathRegisterAllFunctions(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlErrorGetDomain(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlErrorPtr Error;
+ PyObject *pyobj_Error;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlErrorGetDomain", &pyobj_Error))
+ return(NULL);
+ Error = (xmlErrorPtr) PyError_Get(pyobj_Error);
+
+ c_retval = Error->domain;
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCheckFilename(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ char * path;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlCheckFilename", &path))
+ return(NULL);
+
+ c_retval = xmlCheckFilename(path);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseDTD(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDtdPtr c_retval;
+ xmlChar * ExternalID;
+ xmlChar * SystemID;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:xmlParseDTD", &ExternalID, &SystemID))
+ return(NULL);
+
+ c_retval = xmlParseDTD(ExternalID, SystemID);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsTibetan(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsTibetan", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsTibetan(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlHandleEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlEntityPtr entity;
+ PyObject *pyobj_entity;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlHandleEntity", &pyobj_ctxt, &pyobj_entity))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+ entity = (xmlEntityPtr) PyxmlNode_Get(pyobj_entity);
+
+ xmlHandleEntity(ctxt, entity);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathFloorFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathFloorFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathFloorFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlNewGlobalNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNsPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * href;
+ xmlChar * prefix;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlNewGlobalNs", &pyobj_doc, &href, &prefix))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlNewGlobalNs(doc, href, prefix);
+ py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlIsLetter(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int c;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlIsLetter", &c))
+ return(NULL);
+
+ c_retval = xmlIsLetter(c);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextMerge(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlNodePtr first;
+ PyObject *pyobj_first;
+ xmlNodePtr second;
+ PyObject *pyobj_second;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlTextMerge", &pyobj_first, &pyobj_second))
+ return(NULL);
+ first = (xmlNodePtr) PyxmlNode_Get(pyobj_first);
+ second = (xmlNodePtr) PyxmlNode_Get(pyobj_second);
+
+ c_retval = xmlTextMerge(first, second);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathStringLengthFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathStringLengthFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathStringLengthFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlPrintURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * stream;
+ PyObject *pyobj_stream;
+ xmlURIPtr uri;
+ PyObject *pyobj_uri;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlPrintURI", &pyobj_stream, &pyobj_uri))
+ return(NULL);
+ stream = (FILE *) PyFile_Get(pyobj_stream);
+ uri = (xmlURIPtr) PyURI_Get(pyobj_uri);
+
+ xmlPrintURI(stream, uri);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsCyrillicSupplement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCyrillicSupplement", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCyrillicSupplement(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathValueFlipSign(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathValueFlipSign", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathValueFlipSign(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxParserSetFlag(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlRelaxNGParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int flags;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlRelaxParserSetFlag", &pyobj_ctxt, &flags))
+ return(NULL);
+ ctxt = (xmlRelaxNGParserCtxtPtr) PyrelaxNgParserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlRelaxParserSetFlag(ctxt, flags);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+PyObject *
+libxml_xmlParseURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlURIPtr c_retval;
+ char * str;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlParseURI", &str))
+ return(NULL);
+
+ c_retval = xmlParseURI(str);
+ py_retval = libxml_xmlURIPtrWrap((xmlURIPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCopyProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlAttrPtr c_retval;
+ xmlNodePtr target;
+ PyObject *pyobj_target;
+ xmlAttrPtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlCopyProp", &pyobj_target, &pyobj_cur))
+ return(NULL);
+ target = (xmlNodePtr) PyxmlNode_Get(pyobj_target);
+ cur = (xmlAttrPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlCopyProp(target, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlReplaceNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlNodePtr old;
+ PyObject *pyobj_old;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlReplaceNode", &pyobj_old, &pyobj_cur))
+ return(NULL);
+ old = (xmlNodePtr) PyxmlNode_Get(pyobj_old);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlReplaceNode(old, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlSetDocCompressMode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ int mode;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlSetDocCompressMode", &pyobj_doc, &mode))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ xmlSetDocCompressMode(doc, mode);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#ifdef LIBXML_XPTR_ENABLED
+PyObject *
+libxml_xmlXPtrNewRange(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ xmlNodePtr start;
+ PyObject *pyobj_start;
+ int startindex;
+ xmlNodePtr end;
+ PyObject *pyobj_end;
+ int endindex;
+
+ if (!PyArg_ParseTuple(args, (char *)"OiOi:xmlXPtrNewRange", &pyobj_start, &startindex, &pyobj_end, &endindex))
+ return(NULL);
+ start = (xmlNodePtr) PyxmlNode_Get(pyobj_start);
+ end = (xmlNodePtr) PyxmlNode_Get(pyobj_end);
+
+ c_retval = xmlXPtrNewRange(start, startindex, end, endindex);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPTR_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathMultValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathMultValues", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathMultValues(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlParseFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ char * filename;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlParseFile", &filename))
+ return(NULL);
+
+ c_retval = xmlParseFile(filename);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlSaveFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ char * filename;
+ xmlDocPtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"zO:htmlSaveFile", &filename, &pyobj_cur))
+ return(NULL);
+ cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = htmlSaveFile(filename, cur);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlParseEndTag(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseEndTag", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseEndTag(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlDocDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ FILE * f;
+ PyObject *pyobj_f;
+ xmlDocPtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlDocDump", &pyobj_f, &pyobj_cur))
+ return(NULL);
+ f = (FILE *) PyFile_Get(pyobj_f);
+ cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlDocDump(f, cur);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlURIGetFragment(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const char * c_retval;
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetFragment", &pyobj_URI))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ c_retval = URI->fragment;
+ py_retval = libxml_charPtrConstWrap((const char *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderCurrentDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderCurrentDoc", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderCurrentDoc(reader);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNextSelf(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextSelf", &pyobj_ctxt, &pyobj_cur))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlXPathNextSelf(ctxt, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsHanunoo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHanunoo", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsHanunoo(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParsePITarget(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParsePITarget", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParsePITarget(ctxt);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlURISetOpaque(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+ char * opaque;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetOpaque", &pyobj_URI, &opaque))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ if (URI->opaque != NULL) xmlFree(URI->opaque);
+ URI->opaque = (char *)xmlStrdup((const xmlChar *)opaque);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlParserSetLineNumbers(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int linenumbers;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlParserSetLineNumbers", &pyobj_ctxt, &linenumbers))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ ctxt->linenumbers = linenumbers;
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlParsePEReference(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParsePEReference", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParsePEReference(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlDelEncodingAlias(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ char * alias;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlDelEncodingAlias", &alias))
+ return(NULL);
+
+ c_retval = xmlDelEncodingAlias(alias);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNodeSetContentLen(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+ xmlChar * content;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlNodeSetContentLen", &pyobj_cur, &content, &len))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlNodeSetContentLen(cur, content, len);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlNewNodeEatName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlNsPtr ns;
+ PyObject *pyobj_ns;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNewNodeEatName", &pyobj_ns, &name))
+ return(NULL);
+ ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns);
+
+ c_retval = xmlNewNodeEatName(ns, name);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlIsCombining(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ unsigned int ch;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlIsCombining", &ch))
+ return(NULL);
+
+ c_retval = xmlIsCombining(ch);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlThrDefPedanticParserDefaultValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int v;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefPedanticParserDefaultValue", &v))
+ return(NULL);
+
+ c_retval = xmlThrDefPedanticParserDefaultValue(v);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlReadFd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ htmlDocPtr c_retval;
+ int fd;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"izzi:htmlReadFd", &fd, &URL, &encoding, &options))
+ return(NULL);
+
+ c_retval = htmlReadFd(fd, URL, encoding, options);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlTextReaderNormalization(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderNormalization", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderNormalization(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlStrncatNew(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * str1;
+ xmlChar * str2;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"zzi:xmlStrncatNew", &str1, &str2, &len))
+ return(NULL);
+
+ c_retval = xmlStrncatNew(str1, str2, len);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUTF8Strpos(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * utf;
+ int pos;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlUTF8Strpos", &utf, &pos))
+ return(NULL);
+
+ c_retval = xmlUTF8Strpos(utf, pos);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCatalogResolvePublic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * pubID;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlCatalogResolvePublic", &pubID))
+ return(NULL);
+
+ c_retval = xmlCatalogResolvePublic(pubID);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewCDataBlock(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * content;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlNewCDataBlock", &pyobj_doc, &content, &len))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlNewCDataBlock(doc, content, len);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUnsetNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlNsPtr ns;
+ PyObject *pyobj_ns;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOz:xmlUnsetNsProp", &pyobj_node, &pyobj_ns, &name))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+ ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns);
+
+ c_retval = xmlUnsetNsProp(node, ns, name);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNamespaceParseNSDef(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlNamespaceParseNSDef", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlNamespaceParseNSDef(ctxt);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlSaveFileFormat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ char * filename;
+ xmlDocPtr cur;
+ PyObject *pyobj_cur;
+ char * encoding;
+ int format;
+
+ if (!PyArg_ParseTuple(args, (char *)"zOzi:htmlSaveFileFormat", &filename, &pyobj_cur, &encoding, &format))
+ return(NULL);
+ cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = htmlSaveFileFormat(filename, cur, encoding, format);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlParserGetWellFormed(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParserGetWellFormed", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = ctxt->wellFormed;
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNodeIsText(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlNodeIsText", &pyobj_node))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlNodeIsText(node);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParserSetReplaceEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int replaceEntities;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlParserSetReplaceEntities", &pyobj_ctxt, &replaceEntities))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ ctxt->replaceEntities = replaceEntities;
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsCurrencySymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCurrencySymbols", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCurrencySymbols(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathVariableLookup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlXPathVariableLookup", &pyobj_ctxt, &name))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ c_retval = xmlXPathVariableLookup(ctxt, name);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathStringEvalNumber(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ double c_retval;
+ xmlChar * str;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlXPathStringEvalNumber", &str))
+ return(NULL);
+
+ c_retval = xmlXPathStringEvalNumber(str);
+ py_retval = libxml_doubleWrap((double) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlReaderNewFd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ int fd;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oizzi:xmlReaderNewFd", &pyobj_reader, &fd, &URL, &encoding, &options))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlReaderNewFd(reader, fd, URL, encoding, options);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathCmpNodes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlNodePtr node1;
+ PyObject *pyobj_node1;
+ xmlNodePtr node2;
+ PyObject *pyobj_node2;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathCmpNodes", &pyobj_node1, &pyobj_node2))
+ return(NULL);
+ node1 = (xmlNodePtr) PyxmlNode_Get(pyobj_node1);
+ node2 = (xmlNodePtr) PyxmlNode_Get(pyobj_node2);
+
+ c_retval = xmlXPathCmpNodes(node1, node2);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUTF8Strsize(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * utf;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlUTF8Strsize", &utf, &len))
+ return(NULL);
+
+ c_retval = xmlUTF8Strsize(utf, len);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathVariableLookupNS(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ xmlXPathContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlChar * name;
+ xmlChar * ns_uri;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlXPathVariableLookupNS", &pyobj_ctxt, &name, &ns_uri))
+ return(NULL);
+ ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt);
+
+ c_retval = xmlXPathVariableLookupNS(ctxt, name, ns_uri);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlStrcmp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * str1;
+ xmlChar * str2;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:xmlStrcmp", &str1, &str2))
+ return(NULL);
+
+ c_retval = xmlStrcmp(str1, str2);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XINCLUDE_ENABLED
+PyObject *
+libxml_xmlXIncludeProcessFlags(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ int flags;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXIncludeProcessFlags", &pyobj_doc, &flags))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlXIncludeProcessFlags(doc, flags);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XINCLUDE_ENABLED */
+PyObject *
+libxml_xmlUTF8Strsub(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * utf;
+ int start;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"zii:xmlUTF8Strsub", &utf, &start, &len))
+ return(NULL);
+
+ c_retval = xmlUTF8Strsub(utf, start, len);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlIsMixedElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlIsMixedElement", &pyobj_doc, &name))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlIsMixedElement(doc, name);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsMiscellaneousSymbolsandArrows(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMiscellaneousSymbolsandArrows", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsMiscellaneousSymbolsandArrows(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseStartTag(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseStartTag", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseStartTag(ctxt);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlSetupParserForBuffer(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlChar * buffer;
+ char * filename;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlSetupParserForBuffer", &pyobj_ctxt, &buffer, &filename))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlSetupParserForBuffer(ctxt, buffer, filename);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlNewTextReaderFilename(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlTextReaderPtr c_retval;
+ char * URI;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlNewTextReaderFilename", &URI))
+ return(NULL);
+
+ c_retval = xmlNewTextReaderFilename(URI);
+ py_retval = libxml_xmlTextReaderPtrWrap((xmlTextReaderPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNumberFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathNumberFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathNumberFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsBoxDrawing(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsBoxDrawing", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsBoxDrawing(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlNodeDumpFormatOutput(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlOutputBufferPtr buf;
+ PyObject *pyobj_buf;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+ char * encoding;
+ int format;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOOzi:htmlNodeDumpFormatOutput", &pyobj_buf, &pyobj_doc, &pyobj_cur, &encoding, &format))
+ return(NULL);
+ buf = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_buf);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+#ifdef LIBXML_DEBUG_ENABLED
+PyObject *
+libxml_xmlLsOneNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * output;
+ PyObject *pyobj_output;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlLsOneNode", &pyobj_output, &pyobj_node))
+ return(NULL);
+ output = (FILE *) PyFile_Get(pyobj_output);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ xmlLsOneNode(output, node);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_DEBUG_ENABLED */
+PyObject *
+libxml_xmlUCSIsGreekExtended(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGreekExtended", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsGreekExtended(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseExternalSubset(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlChar * ExternalID;
+ xmlChar * SystemID;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlParseExternalSubset", &pyobj_ctxt, &ExternalID, &SystemID))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseExternalSubset(ctxt, ExternalID, SystemID);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlNewDocNodeEatName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlNsPtr ns;
+ PyObject *pyobj_ns;
+ xmlChar * name;
+ xmlChar * content;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlNewDocNodeEatName", &pyobj_doc, &pyobj_ns, &name, &content))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+ ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns);
+
+ c_retval = xmlNewDocNodeEatName(doc, ns, name, content);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlURIGetOpaque(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const char * c_retval;
+ xmlURIPtr URI;
+ PyObject *pyobj_URI;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetOpaque", &pyobj_URI))
+ return(NULL);
+ URI = (xmlURIPtr) PyURI_Get(pyobj_URI);
+
+ c_retval = URI->opaque;
+ py_retval = libxml_charPtrConstWrap((const char *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlStrndup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * cur;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"zi:xmlStrndup", &cur, &len))
+ return(NULL);
+
+ c_retval = xmlStrndup(cur, len);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlReaderForDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlTextReaderPtr c_retval;
+ xmlChar * cur;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"zzzi:xmlReaderForDoc", &cur, &URL, &encoding, &options))
+ return(NULL);
+
+ c_retval = xmlReaderForDoc(cur, URL, encoding, options);
+ py_retval = libxml_xmlTextReaderPtrWrap((xmlTextReaderPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderReadInnerXml(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderReadInnerXml", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderReadInnerXml(reader);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlThrDefKeepBlanksDefaultValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int v;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefKeepBlanksDefaultValue", &v))
+ return(NULL);
+
+ c_retval = xmlThrDefKeepBlanksDefaultValue(v);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathBooleanFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathBooleanFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathBooleanFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsThaana(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsThaana", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsThaana(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsMyanmar(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMyanmar", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsMyanmar(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlStrsub(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * str;
+ int start;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"zii:xmlStrsub", &str, &start, &len))
+ return(NULL);
+
+ c_retval = xmlStrsub(str, start, len);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathIsNodeType(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlXPathIsNodeType", &name))
+ return(NULL);
+
+ c_retval = xmlXPathIsNodeType(name);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlNodeSetName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNodeSetName", &pyobj_cur, &name))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlNodeSetName(cur, name);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlSaveFormatFileTo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlOutputBufferPtr buf;
+ PyObject *pyobj_buf;
+ xmlDocPtr cur;
+ PyObject *pyobj_cur;
+ char * encoding;
+ int format;
+
+ if (!PyArg_ParseTuple(args, (char *)"OOzi:xmlSaveFormatFileTo", &pyobj_buf, &pyobj_cur, &encoding, &format))
+ return(NULL);
+ buf = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_buf);
+ cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlSaveFormatFileTo(buf, cur, encoding, format);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsYiRadicals(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsYiRadicals", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsYiRadicals(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathRoot(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathRoot", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathRoot(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNextFollowing(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextFollowing", &pyobj_ctxt, &pyobj_cur))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlXPathNextFollowing(ctxt, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlValidateNameValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * value;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlValidateNameValue", &value))
+ return(NULL);
+
+ c_retval = xmlValidateNameValue(value);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathSubstringBeforeFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathSubstringBeforeFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathSubstringBeforeFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlCleanupPredefinedEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlCleanupPredefinedEntities();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsHangulCompatibilityJamo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHangulCompatibilityJamo", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsHangulCompatibilityJamo(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlSchemaInitTypes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlSchemaInitTypes();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNodeSetFreeNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNsPtr ns;
+ PyObject *pyobj_ns;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathNodeSetFreeNs", &pyobj_ns))
+ return(NULL);
+ ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns);
+
+ xmlXPathNodeSetFreeNs(ns);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlParseElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseElement", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseElement(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlAddChild(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlNodePtr parent;
+ PyObject *pyobj_parent;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlAddChild", &pyobj_parent, &pyobj_cur))
+ return(NULL);
+ parent = (xmlNodePtr) PyxmlNode_Get(pyobj_parent);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlAddChild(parent, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathErr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int error;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathErr", &pyobj_ctxt, &error))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathErr(ctxt, error);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlTextReaderDepth(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderDepth", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderDepth(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNanoFTPProxy(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ char * host;
+ int port;
+ char * user;
+ char * passwd;
+ int type;
+
+ if (!PyArg_ParseTuple(args, (char *)"zizzi:xmlNanoFTPProxy", &host, &port, &user, &passwd, &type))
+ return(NULL);
+
+ xmlNanoFTPProxy(host, port, user, passwd, type);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlLineNumbersDefault(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int val;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlLineNumbersDefault", &val))
+ return(NULL);
+
+ c_retval = xmlLineNumbersDefault(val);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseVersionInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseVersionInfo", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlParseVersionInfo(ctxt);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsHiragana(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHiragana", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsHiragana(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxNGDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * output;
+ PyObject *pyobj_output;
+ xmlRelaxNGPtr schema;
+ PyObject *pyobj_schema;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlRelaxNGDump", &pyobj_output, &pyobj_schema))
+ return(NULL);
+ output = (FILE *) PyFile_Get(pyobj_output);
+ schema = (xmlRelaxNGPtr) PyrelaxNgSchema_Get(pyobj_schema);
+
+ xmlRelaxNGDump(output, schema);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+PyObject *
+libxml_xmlIOHTTPMatch(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ char * filename;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlIOHTTPMatch", &filename))
+ return(NULL);
+
+ c_retval = xmlIOHTTPMatch(filename);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlRegisterHTTPPostCallbacks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+
+ xmlRegisterHTTPPostCallbacks();
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlFreeURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlURIPtr uri;
+ PyObject *pyobj_uri;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeURI", &pyobj_uri))
+ return(NULL);
+ uri = (xmlURIPtr) PyURI_Get(pyobj_uri);
+
+ xmlFreeURI(uri);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlSetTreeDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNodePtr tree;
+ PyObject *pyobj_tree;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlSetTreeDoc", &pyobj_tree, &pyobj_doc))
+ return(NULL);
+ tree = (xmlNodePtr) PyxmlNode_Get(pyobj_tree);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ xmlSetTreeDoc(tree, doc);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlTextReaderConstPrefix(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ const xmlChar * c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderConstPrefix", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderConstPrefix(reader);
+ py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCopyNodeList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlCopyNodeList", &pyobj_node))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlCopyNodeList(node);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNextParent(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextParent", &pyobj_ctxt, &pyobj_cur))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlXPathNextParent(ctxt, cur);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsAegeanNumbers(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsAegeanNumbers", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsAegeanNumbers(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsDevanagari(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsDevanagari", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsDevanagari(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNodeGetContent(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlNodeGetContent", &pyobj_cur))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlNodeGetContent(cur);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNormalizeWindowsPath(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlChar * path;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlNormalizeWindowsPath", &path))
+ return(NULL);
+
+ c_retval = xmlNormalizeWindowsPath(path);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderIsEmptyElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderIsEmptyElement", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderIsEmptyElement(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCherokee(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCherokee", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCherokee(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlErrorGetLevel(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlErrorPtr Error;
+ PyObject *pyobj_Error;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlErrorGetLevel", &pyobj_Error))
+ return(NULL);
+ Error = (xmlErrorPtr) PyError_Get(pyobj_Error);
+
+ c_retval = Error->level;
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlCheckUTF8(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ unsigned char * utf;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlCheckUTF8", &utf))
+ return(NULL);
+
+ c_retval = xmlCheckUTF8(utf);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathNotFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+ int nargs;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathNotFunction", &pyobj_ctxt, &nargs))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathNotFunction(ctxt, nargs);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsIPAExtensions(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsIPAExtensions", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsIPAExtensions(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsOldItalic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsOldItalic", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsOldItalic(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathPopNumber(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ double c_retval;
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathPopNumber", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ c_retval = xmlXPathPopNumber(ctxt);
+ py_retval = libxml_doubleWrap((double) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsEnclosedAlphanumerics(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsEnclosedAlphanumerics", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsEnclosedAlphanumerics(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathCastBooleanToNumber(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ double c_retval;
+ int val;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlXPathCastBooleanToNumber", &val))
+ return(NULL);
+
+ c_retval = xmlXPathCastBooleanToNumber(val);
+ py_retval = libxml_doubleWrap((double) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsIdeographicDescriptionCharacters(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsIdeographicDescriptionCharacters", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsIdeographicDescriptionCharacters(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlFreeDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlDocPtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeDoc", &pyobj_cur))
+ return(NULL);
+ cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlFreeDoc(cur);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUCSIsYiSyllables(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsYiSyllables", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsYiSyllables(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderLookupNamespace(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ xmlChar * prefix;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlTextReaderLookupNamespace", &pyobj_reader, &prefix))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderLookupNamespace(reader, prefix);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNodeGetLang(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlNodeGetLang", &pyobj_cur))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ c_retval = xmlNodeGetLang(cur);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
+ PyObject *py_retval;
+ xmlParserCtxtPtr c_retval;
+
+ c_retval = xmlNewParserCtxt();
+ py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNanoFTPScanProxy(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ char * URL;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlNanoFTPScanProxy", &URL))
+ return(NULL);
+
+ xmlNanoFTPScanProxy(URL);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlValidateNmtokensValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * value;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlValidateNmtokensValue", &value))
+ return(NULL);
+
+ c_retval = xmlValidateNmtokensValue(value);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderNextSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderNextSibling", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderNextSibling(reader);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlClearParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlClearParserCtxt", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlClearParserCtxt(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlTextReaderReadString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderReadString", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderReadString(reader);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlStrlen(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * str;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlStrlen", &str))
+ return(NULL);
+
+ c_retval = xmlStrlen(str);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_DEBUG_ENABLED
+PyObject *
+libxml_xmlDebugDumpDocument(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * output;
+ PyObject *pyobj_output;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"OO:xmlDebugDumpDocument", &pyobj_output, &pyobj_doc))
+ return(NULL);
+ output = (FILE *) PyFile_Get(pyobj_output);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ xmlDebugDumpDocument(output, doc);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_DEBUG_ENABLED */
+PyObject *
+libxml_xmlThrDefSaveNoEmptyTags(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int v;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefSaveNoEmptyTags", &v))
+ return(NULL);
+
+ c_retval = xmlThrDefSaveNoEmptyTags(v);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderGetAttribute(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar * c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlTextReaderGetAttribute", &pyobj_reader, &name))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderGetAttribute(reader, name);
+ py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPTR_ENABLED
+PyObject *
+libxml_xmlXPtrEval(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ xmlChar * str;
+ xmlXPathContextPtr ctx;
+ PyObject *pyobj_ctx;
+
+ if (!PyArg_ParseTuple(args, (char *)"zO:xmlXPtrEval", &str, &pyobj_ctx))
+ return(NULL);
+ ctx = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctx);
+
+ c_retval = xmlXPtrEval(str, ctx);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XPTR_ENABLED */
+PyObject *
+libxml_xmlKeepBlanksDefault(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int val;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlKeepBlanksDefault", &val))
+ return(NULL);
+
+ c_retval = xmlKeepBlanksDefault(val);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlPopInput(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlChar c_retval;
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlPopInput", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ c_retval = xmlPopInput(ctxt);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsSupplementaryPrivateUseAreaB(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSupplementaryPrivateUseAreaB", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsSupplementaryPrivateUseAreaB(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsSupplementaryPrivateUseAreaA(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSupplementaryPrivateUseAreaA", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsSupplementaryPrivateUseAreaA(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderCurrentNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlNodePtr c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderCurrentNode", &pyobj_reader))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderCurrentNode(reader);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlTextReaderSetParserProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ int prop;
+ int value;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oii:xmlTextReaderSetParserProp", &pyobj_reader, &prop, &value))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlTextReaderSetParserProp(reader, prop, value);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDocPtr c_retval;
+ xmlChar * version;
+
+ if (!PyArg_ParseTuple(args, (char *)"z:xmlNewDoc", &version))
+ return(NULL);
+
+ c_retval = xmlNewDoc(version);
+ py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsLetterlikeSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLetterlikeSymbols", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsLetterlikeSymbols(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatZp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatZp", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatZp(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatZs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatZs", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatZs(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsCatZl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatZl", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsCatZl(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlUCSIsGujarati(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGujarati", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsGujarati(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlACatalogRemove(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlCatalogPtr catal;
+ PyObject *pyobj_catal;
+ xmlChar * value;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlACatalogRemove", &pyobj_catal, &value))
+ return(NULL);
+ catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal);
+
+ c_retval = xmlACatalogRemove(catal, value);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlSetMetaEncoding(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ htmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * encoding;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:htmlSetMetaEncoding", &pyobj_doc, &encoding))
+ return(NULL);
+ doc = (htmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = htmlSetMetaEncoding(doc, encoding);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlReaderNewDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlTextReaderPtr reader;
+ PyObject *pyobj_reader;
+ xmlChar * cur;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozzzi:xmlReaderNewDoc", &pyobj_reader, &cur, &URL, &encoding, &options))
+ return(NULL);
+ reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+
+ c_retval = xmlReaderNewDoc(reader, cur, URL, encoding, options);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParsePI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParsePI", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParsePI(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUnsetProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlChar * name;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlUnsetProp", &pyobj_node, &name))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlUnsetProp(node, name);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_HTML_ENABLED
+PyObject *
+libxml_htmlFreeParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ htmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:htmlFreeParserCtxt", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ htmlFreeParserCtxt(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_HTML_ENABLED */
+PyObject *
+libxml_xmlUCSIsVariationSelectorsSupplement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsVariationSelectorsSupplement", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsVariationSelectorsSupplement(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlSetProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlAttrPtr c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlChar * name;
+ xmlChar * value;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlSetProp", &pyobj_node, &name, &value))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+
+ c_retval = xmlSetProp(node, name, value);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlReaderWalker(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlTextReaderPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlReaderWalker", &pyobj_doc))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlReaderWalker(doc);
+ py_retval = libxml_xmlTextReaderPtrWrap((xmlTextReaderPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XINCLUDE_ENABLED
+PyObject *
+libxml_xmlXIncludeProcessTree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlNodePtr tree;
+ PyObject *pyobj_tree;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXIncludeProcessTree", &pyobj_tree))
+ return(NULL);
+ tree = (xmlNodePtr) PyxmlNode_Get(pyobj_tree);
+
+ c_retval = xmlXIncludeProcessTree(tree);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+#endif /* LIBXML_XINCLUDE_ENABLED */
+PyObject *
+libxml_xmlCatalogDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ FILE * out;
+ PyObject *pyobj_out;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlCatalogDump", &pyobj_out))
+ return(NULL);
+ out = (FILE *) PyFile_Get(pyobj_out);
+
+ xmlCatalogDump(out);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlNodeSetLang(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlNodePtr cur;
+ PyObject *pyobj_cur;
+ xmlChar * lang;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNodeSetLang", &pyobj_cur, &lang))
+ return(NULL);
+ cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
+
+ xmlNodeSetLang(cur, lang);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlStrcasecmp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ xmlChar * str1;
+ xmlChar * str2;
+
+ if (!PyArg_ParseTuple(args, (char *)"zz:xmlStrcasecmp", &str1, &str2))
+ return(NULL);
+
+ c_retval = xmlStrcasecmp(str1, str2);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlReaderForMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlTextReaderPtr c_retval;
+ char * buffer;
+ int size;
+ char * URL;
+ char * encoding;
+ int options;
+
+ if (!PyArg_ParseTuple(args, (char *)"zizzi:xmlReaderForMemory", &buffer, &size, &URL, &encoding, &options))
+ return(NULL);
+
+ c_retval = xmlReaderForMemory(buffer, size, URL, encoding, options);
+ py_retval = libxml_xmlTextReaderPtrWrap((xmlTextReaderPtr) c_retval);
+ return(py_retval);
+}
+
+#ifdef LIBXML_XPATH_ENABLED
+PyObject *
+libxml_xmlXPathEvalExpr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlXPathParserContextPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathEvalExpr", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt);
+
+ xmlXPathEvalExpr(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+#endif /* LIBXML_XPATH_ENABLED */
+PyObject *
+libxml_xmlUCSIsLinearBSyllabary(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ int code;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLinearBSyllabary", &code))
+ return(NULL);
+
+ c_retval = xmlUCSIsLinearBSyllabary(code);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlIsBaseChar(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ unsigned int ch;
+
+ if (!PyArg_ParseTuple(args, (char *)"i:xmlIsBaseChar", &ch))
+ return(NULL);
+
+ c_retval = xmlIsBaseChar(ch);
+ py_retval = libxml_intWrap((int) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlNewDtd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlDtdPtr c_retval;
+ xmlDocPtr doc;
+ PyObject *pyobj_doc;
+ xmlChar * name;
+ xmlChar * ExternalID;
+ xmlChar * SystemID;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozzz:xmlNewDtd", &pyobj_doc, &name, &ExternalID, &SystemID))
+ return(NULL);
+ doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
+
+ c_retval = xmlNewDtd(doc, name, ExternalID, SystemID);
+ py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
+ return(py_retval);
+}
+
+PyObject *
+libxml_xmlParseDocTypeDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ xmlParserCtxtPtr ctxt;
+ PyObject *pyobj_ctxt;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:xmlParseDocTypeDecl", &pyobj_ctxt))
+ return(NULL);
+ ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
+
+ xmlParseDocTypeDecl(ctxt);
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
diff --git a/python/libxml2-python-api.xml b/python/libxml2-python-api.xml
new file mode 100644
index 0000000..d5a4cbe
--- /dev/null
+++ b/python/libxml2-python-api.xml
@@ -0,0 +1,310 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<api name='libxml2-python'>
+ <symbols>
+ <function name='xmlRegisterXPathFunction' file='python'>
+ <info>Register a Python written function to the XPath interpreter</info>
+ <return type='int' info="1 in case of success, 0 or -1 in case of error"/>
+ <arg name='ctx' type='xmlXPathContextPtr' info='the xpathContext'/>
+ <arg name='name' type='xmlChar *' info='the function name'/>
+ <arg name='ns_uri' type='xmlChar *' info='the namespace or NULL'/>
+ <arg name='f' type='pythonObject' info='the python function'/>
+ </function>
+ <function name='xmlNewNode' file='python'>
+ <info>Create a new Node</info>
+ <return type='xmlNodePtr' info="A new element node"/>
+ <arg name='name' type='xmlChar *' info='the node name'/>
+ </function>
+ <function name='xmlCreatePushParser' file='python'>
+ <info>Create a progressive XML parser context to build either an event flow if the SAX object is not None, or a DOM tree otherwise.</info>
+ <return type='xmlParserCtxtPtr' info="the parser context or None in case of error"/>
+ <arg name='SAX' type='pythonObject' info='the SAX callback object or None'/>
+ <arg name='chunk' type='xmlChar *' info='the initial data'/>
+ <arg name='size' type='int' info='the size of the initial data'/>
+ <arg name='URI' type='xmlChar *' info='The URI used for base computations'/>
+ </function>
+ <function name='htmlCreatePushParser' file='python'>
+ <info>Create a progressive HTML parser context to build either an event flow if the SAX object is not None, or a DOM tree otherwise.</info>
+ <return type='xmlParserCtxtPtr' info="the parser context or None in case of error"/>
+ <arg name='SAX' type='pythonObject' info='the SAX callback object or None'/>
+ <arg name='chunk' type='xmlChar *' info='the initial data'/>
+ <arg name='size' type='int' info='the size of the initial data'/>
+ <arg name='URI' type='xmlChar *' info='The URI used for base computations'/>
+ </function>
+ <function name='xmlSAXParseFile' file='python'>
+ <info>Interface to parse an XML file or resource pointed by an URI to build an event flow to the SAX object</info>
+ <return type='void'/>
+ <arg name='SAX' type='pythonObject' info='the SAX callback object or None'/>
+ <arg name='URI' type='xmlChar *' info='The URI of the resource'/>
+ <arg name='recover' type='int' info='allow recovery in case of error'/>
+ </function>
+ <function name='htmlSAXParseFile' file='python'>
+ <info>Interface to parse an HTML file or resource pointed by an URI to build an event flow to the SAX object</info>
+ <return type='void'/>
+ <arg name='SAX' type='pythonObject' info='the SAX callback object or None'/>
+ <arg name='URI' type='xmlChar *' info='The URI of the resource'/>
+ <arg name='encoding' type='const char *' info='encoding or None'/>
+ </function>
+ <function name='xmlCreateOutputBuffer' file='python'>
+ <info>Create a libxml2 output buffer from a Python file</info>
+ <return type='xmlOutputBufferPtr' info="the output buffer"/>
+ <arg name='file' type='pythonObject' info='the Python file'/>
+ <arg name='encoding' type='xmlChar *' info='an optionnal encoding'/>
+ </function>
+ <function name='xmlCreateInputBuffer' file='python'>
+ <info>Create a libxml2 input buffer from a Python file</info>
+ <return type='xmlParserInputBufferPtr' info="the input buffer"/>
+ <arg name='file' type='pythonObject' info='the Python file'/>
+ <arg name='encoding' type='xmlChar *' info='an optionnal encoding'/>
+ </function>
+ <function name='xmlSetEntityLoader' file='python'>
+ <info>Set the entity resolver as a python function</info>
+ <return type='int' info="0 in case of success, -1 for error"/>
+ <arg name='resolver' type='pythonObject' info='the Python function'/>
+ </function>
+ <!-- xmlParserCtxtPtr accessors -->
+ <function name='xmlParserGetDoc' file='python_accessor'>
+ <info>Get the document tree from a parser context.</info>
+ <return type='xmlDocPtr' info="the document tree" field="myDoc"/>
+ <arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
+ </function>
+ <function name='xmlParserGetWellFormed' file='python_accessor'>
+ <info>Get the well formed information from a parser context.</info>
+ <return type='int' info="the wellFormed field" field="wellFormed"/>
+ <arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
+ </function>
+ <function name='xmlParserGetIsValid' file='python_accessor'>
+ <info>Get the validity information from a parser context.</info>
+ <return type='int' info="the valid field" field="valid"/>
+ <arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
+ </function>
+ <function name='xmlParserSetValidate' file='python_accessor'>
+ <info>Switch the parser to validation mode.</info>
+ <return type='void'/>
+ <arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
+ <arg name='validate' type='int' info='1 to activate validation'/>
+ </function>
+ <function name='xmlParserSetReplaceEntities' file='python_accessor'>
+ <info>Switch the parser to replace entities.</info>
+ <return type='void'/>
+ <arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
+ <arg name='replaceEntities' type='int' info='1 to replace entities'/>
+ </function>
+ <function name='xmlParserSetPedantic' file='python_accessor'>
+ <info>Switch the parser to be pedantic.</info>
+ <return type='void'/>
+ <arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
+ <arg name='pedantic' type='int' info='1 to run in pedantic mode'/>
+ </function>
+ <function name='xmlParserSetLoadSubset' file='python_accessor'>
+ <info>Switch the parser to load the DTD without validating.</info>
+ <return type='void'/>
+ <arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
+ <arg name='loadsubset' type='int' info='1 to load the DTD'/>
+ </function>
+ <function name='xmlParserSetLineNumbers' file='python_accessor'>
+ <info>Switch on the generation of line number for elements nodes.</info>
+ <return type='void'/>
+ <arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
+ <arg name='linenumbers' type='int' info='1 to save line numbers'/>
+ </function>
+ <function name='xmlDebugMemory' file='python'>
+ <info>Switch on the generation of line number for elements nodes. Also returns the number of bytes allocated and not freed by libxml2 since memory debugging was switched on.</info>
+ <return type='int' info="returns the number of bytes allocated and not freed"/>
+ <arg name='activate' type='int' info='1 switch on memory debugging 0 switch it off'/>
+ </function>
+ <function name='xmlDumpMemory' file='python'>
+ <info>dump the memory allocated in the file .memdump</info>
+ <return type='void'/>
+ </function>
+ <!-- xmlNsPtr accessors -->
+ <function name='xmlNodeGetNs' file='python_accessor'>
+ <info>Get the namespace of a node</info>
+ <return type='xmlNsPtr' info="The namespace or None"/>
+ <arg name='node' type='xmlNodePtr' info='the node'/>
+ </function>
+ <function name='xmlNodeGetNsDefs' file='python_accessor'>
+ <info>Get the namespace of a node</info>
+ <return type='xmlNsPtr' info="The namespace or None"/>
+ <arg name='node' type='xmlNodePtr' info='the node'/>
+ </function>
+ <!-- xmlXPathContextPtr accessors -->
+ <function name='xmlXPathParserGetContext' file='python_accessor'>
+ <info>Get the xpathContext from an xpathParserContext</info>
+ <return type='xmlXPathContextPtr' info="The XPath context" field="context"/>
+ <arg name='ctxt' type='xmlXPathParserContextPtr' info='the XPath parser context'/>
+ </function>
+ <function name='xmlXPathGetContextDoc' file='python_accessor'>
+ <info>Get the doc from an xpathContext</info>
+ <return type='xmlDocPtr' info="The doc context" field="doc"/>
+ <arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
+ </function>
+ <function name='xmlXPathGetContextNode' file='python_accessor'>
+ <info>Get the current node from an xpathContext</info>
+ <return type='xmlNodePtr' info="The node context" field="node"/>
+ <arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
+ </function>
+ <function name='xmlXPathSetContextDoc' file='python_accessor'>
+ <info>Set the doc of an xpathContext</info>
+ <return type='void'/>
+ <arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
+ <arg name="doc" type='xmlDocPtr' info="The doc context"/>
+ </function>
+ <function name='xmlXPathSetContextNode' file='python_accessor'>
+ <info>Set the current node of an xpathContext</info>
+ <return type='void'/>
+ <arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
+ <arg name="node" type='xmlNodePtr' info="The node context"/>
+ </function>
+ <function name='xmlXPathGetContextPosition' file='python_accessor'>
+ <info>Get the current node from an xpathContext</info>
+ <return type='int' info="The node context" field="proximityPosition"/>
+ <arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
+ </function>
+ <function name='xmlXPathGetContextSize' file='python_accessor'>
+ <info>Get the current node from an xpathContext</info>
+ <return type='int' info="The node context" field="contextSize"/>
+ <arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
+ </function>
+ <function name='xmlXPathGetFunction' file='python_accessor'>
+ <info>Get the current function name xpathContext</info>
+ <return type='const xmlChar *' info="The function name" field="function"/>
+ <arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
+ </function>
+ <function name='xmlXPathGetFunctionURI' file='python_accessor'>
+ <info>Get the current function name URI xpathContext</info>
+ <return type='const xmlChar *' info="The function name URI" field="functionURI"/>
+ <arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
+ </function>
+ <!-- xmlURIPtr accessors -->
+ <function name='xmlURIGetScheme' file='python_accessor'>
+ <info>Get the scheme part from an URI</info>
+ <return type='const char *' info="The URI scheme" field="scheme"/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ </function>
+ <function name='xmlURISetScheme' file='python_accessor'>
+ <info>Set the scheme part of an URI.</info>
+ <return type='void'/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ <arg name='scheme' type='char *' info='The URI scheme part'/>
+ </function>
+ <function name='xmlURIGetOpaque' file='python_accessor'>
+ <info>Get the opaque part from an URI</info>
+ <return type='const char *' info="The URI opaque" field="opaque"/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ </function>
+ <function name='xmlURISetOpaque' file='python_accessor'>
+ <info>Set the opaque part of an URI.</info>
+ <return type='void'/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ <arg name='opaque' type='char *' info='The URI opaque part'/>
+ </function>
+ <function name='xmlURIGetAuthority' file='python_accessor'>
+ <info>Get the authority part from an URI</info>
+ <return type='const char *' info="The URI authority" field="authority"/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ </function>
+ <function name='xmlURISetAuthority' file='python_accessor'>
+ <info>Set the authority part of an URI.</info>
+ <return type='void'/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ <arg name='authority' type='char *' info='The URI authority part'/>
+ </function>
+ <function name='xmlURIGetServer' file='python_accessor'>
+ <info>Get the server part from an URI</info>
+ <return type='const char *' info="The URI server" field="server"/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ </function>
+ <function name='xmlURISetServer' file='python_accessor'>
+ <info>Set the server part of an URI.</info>
+ <return type='void'/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ <arg name='server' type='char *' info='The URI server part'/>
+ </function>
+ <function name='xmlURIGetUser' file='python_accessor'>
+ <info>Get the user part from an URI</info>
+ <return type='const char *' info="The URI user" field="user"/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ </function>
+ <function name='xmlURISetUser' file='python_accessor'>
+ <info>Set the user part of an URI.</info>
+ <return type='void'/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ <arg name='user' type='char *' info='The URI user part'/>
+ </function>
+ <function name='xmlURIGetPath' file='python_accessor'>
+ <info>Get the path part from an URI</info>
+ <return type='const char *' info="The URI path" field="path"/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ </function>
+ <function name='xmlURISetPath' file='python_accessor'>
+ <info>Set the path part of an URI.</info>
+ <return type='void'/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ <arg name='path' type='char *' info='The URI path part'/>
+ </function>
+ <function name='xmlURIGetQuery' file='python_accessor'>
+ <info>Get the query part from an URI</info>
+ <return type='const char *' info="The URI query" field="query"/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ </function>
+ <function name='xmlURISetQuery' file='python_accessor'>
+ <info>Set the query part of an URI.</info>
+ <return type='void'/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ <arg name='query' type='char *' info='The URI query part'/>
+ </function>
+ <function name='xmlURIGetFragment' file='python_accessor'>
+ <info>Get the fragment part from an URI</info>
+ <return type='const char *' info="The URI fragment" field="fragment"/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ </function>
+ <function name='xmlURISetFragment' file='python_accessor'>
+ <info>Set the fragment part of an URI.</info>
+ <return type='void'/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ <arg name='fragment' type='char *' info='The URI fragment part'/>
+ </function>
+ <function name='xmlURIGetPort' file='python_accessor'>
+ <info>Get the port part from an URI</info>
+ <return type='int' info="The URI port" field="port"/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ </function>
+ <function name='xmlURISetPort' file='python_accessor'>
+ <info>Set the port part of an URI.</info>
+ <return type='void'/>
+ <arg name='URI' type='xmlURIPtr' info='the URI'/>
+ <arg name='port' type='int' info='The URI port part'/>
+ </function>
+ <!-- xmlErrorPtr accessors -->
+ <function name='xmlErrorGetDomain' file='python_accessor'>
+ <info>What part of the library raised this error</info>
+ <return type='int' info="The error domain" field="domain"/>
+ <arg name='Error' type='xmlErrorPtr' info='the Error'/>
+ </function>
+ <function name='xmlErrorGetCode' file='python_accessor'>
+ <info>The error code, e.g. an xmlParserError</info>
+ <return type='int' info="The error code" field="code"/>
+ <arg name='Error' type='xmlErrorPtr' info='the Error'/>
+ </function>
+ <function name='xmlErrorGetMessage' file='python_accessor'>
+ <info>human-readable informative error message</info>
+ <return type='const char *' info="The error message" field="message"/>
+ <arg name='Error' type='xmlErrorPtr' info='the Error'/>
+ </function>
+ <function name='xmlErrorGetLevel' file='python_accessor'>
+ <info>how consequent is the error</info>
+ <return type='int' info="The error level" field="level"/>
+ <arg name='Error' type='xmlErrorPtr' info='the Error'/>
+ </function>
+ <function name='xmlErrorGetFile' file='python_accessor'>
+ <info>the filename</info>
+ <return type='const char *' info="The error file" field="file"/>
+ <arg name='Error' type='xmlErrorPtr' info='the Error'/>
+ </function>
+ <function name='xmlErrorGetLine' file='python_accessor'>
+ <info>the line number if available</info>
+ <return type='int' info="The error line" field="line"/>
+ <arg name='Error' type='xmlErrorPtr' info='the Error'/>
+ </function>
+ </symbols>
+</api>
diff --git a/python/libxml_wrap.h b/python/libxml_wrap.h
new file mode 100644
index 0000000..09fc77f
--- /dev/null
+++ b/python/libxml_wrap.h
@@ -0,0 +1,205 @@
+#include <Python.h>
+#include <libxml/tree.h>
+#include <libxml/parser.h>
+#include <libxml/parserInternals.h>
+#include <libxml/catalog.h>
+#include <libxml/threads.h>
+#include <libxml/nanoftp.h>
+#include <libxml/nanohttp.h>
+#include <libxml/uri.h>
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
+#include <libxml/debugXML.h>
+#include <libxml/HTMLparser.h>
+#include <libxml/HTMLtree.h>
+#include <libxml/xinclude.h>
+#include <libxml/xpointer.h>
+#include <libxml/xmlunicode.h>
+#include <libxml/xmlregexp.h>
+#include <libxml/xmlautomata.h>
+#include <libxml/xmlreader.h>
+#include <libxml/relaxng.h>
+
+/**
+ * ATTRIBUTE_UNUSED:
+ *
+ * Macro used to signal to GCC unused function parameters
+ * Repeated here since the definition is not available when
+ * compiled outside the libxml2 build tree.
+ */
+#ifdef __GNUC__
+#ifdef ATTRIBUTE_UNUSED
+#undef ATTRIBUTE_UNUSED
+#endif
+#ifndef ATTRIBUTE_UNUSED
+#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif /* ATTRIBUTE_UNUSED */
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
+#define PyxmlNode_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyxmlNode_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ xmlNodePtr obj;
+} PyxmlNode_Object;
+
+#define PyxmlXPathContext_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyxmlXPathContext_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ xmlXPathContextPtr obj;
+} PyxmlXPathContext_Object;
+
+#define PyxmlXPathParserContext_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyxmlXPathParserContext_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ xmlXPathParserContextPtr obj;
+} PyxmlXPathParserContext_Object;
+
+#define PyparserCtxt_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyparserCtxt_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ xmlParserCtxtPtr obj;
+} PyparserCtxt_Object;
+
+#define Pycatalog_Get(v) (((v) == Py_None) ? NULL : \
+ (((Pycatalog_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ xmlCatalogPtr obj;
+} Pycatalog_Object;
+
+#ifdef LIBXML_REGEXP_ENABLED
+#define PyxmlReg_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyxmlReg_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ xmlRegexpPtr obj;
+} PyxmlReg_Object;
+#endif /* LIBXML_REGEXP_ENABLED */
+
+#define PyxmlTextReader_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyxmlTextReader_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ xmlTextReaderPtr obj;
+} PyxmlTextReader_Object;
+
+#define PyxmlTextReaderLocator_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyxmlTextReaderLocator_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ xmlTextReaderLocatorPtr obj;
+} PyxmlTextReaderLocator_Object;
+
+#define PyURI_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyURI_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ xmlErrorPtr obj;
+} PyError_Object;
+
+#define PyError_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyError_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ xmlOutputBufferPtr obj;
+} PyoutputBuffer_Object;
+
+#define PyoutputBuffer_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyoutputBuffer_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ xmlParserInputBufferPtr obj;
+} PyinputBuffer_Object;
+
+#define PyinputBuffer_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyinputBuffer_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ xmlURIPtr obj;
+} PyURI_Object;
+
+/* FILE * have their own internal representation */
+#define PyFile_Get(v) (((v) == Py_None) ? NULL : \
+ (PyFile_Check(v) ? (PyFile_AsFile(v)) : stdout))
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+typedef struct {
+ PyObject_HEAD
+ xmlRelaxNGPtr obj;
+} PyrelaxNgSchema_Object;
+
+#define PyrelaxNgSchema_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyrelaxNgSchema_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ xmlRelaxNGParserCtxtPtr obj;
+} PyrelaxNgParserCtxt_Object;
+
+#define PyrelaxNgParserCtxt_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyrelaxNgParserCtxt_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ xmlRelaxNGValidCtxtPtr obj;
+} PyrelaxNgValidCtxt_Object;
+
+#define PyrelaxNgValidCtxt_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyrelaxNgValidCtxt_Object *)(v))->obj))
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+
+PyObject * libxml_intWrap(int val);
+PyObject * libxml_longWrap(long val);
+PyObject * libxml_xmlCharPtrWrap(xmlChar *str);
+PyObject * libxml_constxmlCharPtrWrap(const xmlChar *str);
+PyObject * libxml_charPtrWrap(char *str);
+PyObject * libxml_constcharPtrWrap(const char *str);
+PyObject * libxml_charPtrConstWrap(const char *str);
+PyObject * libxml_xmlCharPtrConstWrap(const xmlChar *str);
+PyObject * libxml_xmlDocPtrWrap(xmlDocPtr doc);
+PyObject * libxml_xmlNodePtrWrap(xmlNodePtr node);
+PyObject * libxml_xmlAttrPtrWrap(xmlAttrPtr attr);
+PyObject * libxml_xmlNsPtrWrap(xmlNsPtr ns);
+PyObject * libxml_xmlAttributePtrWrap(xmlAttributePtr ns);
+PyObject * libxml_xmlElementPtrWrap(xmlElementPtr ns);
+PyObject * libxml_doubleWrap(double val);
+PyObject * libxml_xmlXPathContextPtrWrap(xmlXPathContextPtr ctxt);
+PyObject * libxml_xmlParserCtxtPtrWrap(xmlParserCtxtPtr ctxt);
+PyObject * libxml_xmlXPathParserContextPtrWrap(xmlXPathParserContextPtr ctxt);
+PyObject * libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj);
+PyObject * libxml_xmlCatalogPtrWrap(xmlCatalogPtr obj);
+PyObject * libxml_xmlURIPtrWrap(xmlURIPtr uri);
+PyObject * libxml_xmlOutputBufferPtrWrap(xmlOutputBufferPtr buffer);
+PyObject * libxml_xmlParserInputBufferPtrWrap(xmlParserInputBufferPtr buffer);
+#ifdef LIBXML_REGEXP_ENABLED
+PyObject * libxml_xmlRegexpPtrWrap(xmlRegexpPtr regexp);
+#endif /* LIBXML_REGEXP_ENABLED */
+PyObject * libxml_xmlTextReaderPtrWrap(xmlTextReaderPtr reader);
+PyObject * libxml_xmlTextReaderLocatorPtrWrap(xmlTextReaderLocatorPtr locator);
+
+xmlXPathObjectPtr libxml_xmlXPathObjectPtrConvert(PyObject * obj);
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject * libxml_xmlRelaxNGPtrWrap(xmlRelaxNGPtr ctxt);
+PyObject * libxml_xmlRelaxNGParserCtxtPtrWrap(xmlRelaxNGParserCtxtPtr ctxt);
+PyObject * libxml_xmlRelaxNGValidCtxtPtrWrap(xmlRelaxNGValidCtxtPtr valid);
+#endif /* LIBXML_SCHEMAS_ENABLED */
+PyObject * libxml_xmlErrorPtrWrap(xmlErrorPtr error);
diff --git a/python/setup.py b/python/setup.py
new file mode 100755
index 0000000..170c7c9
--- /dev/null
+++ b/python/setup.py
@@ -0,0 +1,242 @@
+#!/usr/bin/python -u
+#
+# Setup script for libxml2 and libxslt if found
+#
+import sys, os
+from distutils.core import setup, Extension
+
+# Below ROOT, we expect to find include, include/libxml2, lib and bin.
+# On *nix, it is not needed (but should not harm),
+# on Windows, it is set by configure.js.
+ROOT = r'/usr'
+
+# Thread-enabled libxml2
+with_threads = 1
+
+# If this flag is set (windows only),
+# a private copy of the dlls are included in the package.
+# If this flag is not set, the libxml2 and libxslt
+# dlls must be found somewhere in the PATH at runtime.
+WITHDLLS = 1 and sys.platform.startswith('win')
+
+def missing(file):
+ if os.access(file, os.R_OK) == 0:
+ return 1
+ return 0
+
+try:
+ HOME = os.environ['HOME']
+except:
+ HOME="C:"
+
+if WITHDLLS:
+ # libxml dlls (expected in ROOT/bin)
+ dlls = [ 'iconv.dll','libxml2.dll','libxslt.dll','libexslt.dll' ]
+ dlls = map(lambda dll: os.path.join(ROOT,'bin',dll),dlls)
+
+ # create __init__.py for the libxmlmods package
+ if not os.path.exists("libxmlmods"):
+ os.mkdir("libxmlmods")
+ open("libxmlmods/__init__.py","w").close()
+
+ def altImport(s):
+ s = s.replace("import libxml2mod","from libxmlmods import libxml2mod")
+ s = s.replace("import libxsltmod","from libxmlmods import libxsltmod")
+ return s
+
+if sys.platform.startswith('win'):
+ libraryPrefix = 'lib'
+ platformLibs = []
+else:
+ libraryPrefix = ''
+ platformLibs = ["m","z"]
+
+# those are examined to find
+# - libxml2/libxml/tree.h
+# - iconv.h
+# - libxslt/xsltconfig.h
+includes_dir = [
+"/usr/include",
+"/usr/local/include",
+"/opt/include",
+os.path.join(ROOT,'include'),
+HOME
+];
+
+xml_includes=""
+for dir in includes_dir:
+ if not missing(dir + "/libxml2/libxml/tree.h"):
+ xml_includes=dir + "/libxml2"
+ break;
+
+if xml_includes == "":
+ print "failed to find headers for libxml2: update includes_dir"
+ sys.exit(1)
+
+iconv_includes=""
+for dir in includes_dir:
+ if not missing(dir + "/iconv.h"):
+ iconv_includes=dir
+ break;
+
+if iconv_includes == "":
+ print "failed to find headers for libiconv: update includes_dir"
+ sys.exit(1)
+
+# those are added in the linker search path for libraries
+libdirs = [
+os.path.join(ROOT,'lib'),
+]
+
+xml_files = ["libxml2-api.xml", "libxml2-python-api.xml",
+ "libxml.c", "libxml.py", "libxml_wrap.h", "types.c",
+ "xmlgenerator.py", "README", "TODO", "drv_libxml2.py"]
+
+xslt_files = ["libxslt-api.xml", "libxslt-python-api.xml",
+ "libxslt.c", "libxsl.py", "libxslt_wrap.h",
+ "xsltgenerator.py"]
+
+if missing("libxml2-py.c") or missing("libxml2.py"):
+ try:
+ try:
+ import xmlgenerator
+ except:
+ import generator
+ except:
+ print "failed to find and generate stubs for libxml2, aborting ..."
+ print sys.exc_type, sys.exc_value
+ sys.exit(1)
+
+ head = open("libxml.py", "r")
+ generated = open("libxml2class.py", "r")
+ result = open("libxml2.py", "w")
+ for line in head.readlines():
+ if WITHDLLS:
+ result.write(altImport(line))
+ else:
+ result.write(line)
+ for line in generated.readlines():
+ result.write(line)
+ head.close()
+ generated.close()
+ result.close()
+
+with_xslt=0
+if missing("libxslt-py.c") or missing("libxslt.py"):
+ if missing("xsltgenerator.py") or missing("libxslt-api.xml"):
+ print "libxslt stub generator not found, libxslt not built"
+ else:
+ try:
+ import xsltgenerator
+ except:
+ print "failed to generate stubs for libxslt, aborting ..."
+ print sys.exc_type, sys.exc_value
+ else:
+ head = open("libxsl.py", "r")
+ generated = open("libxsltclass.py", "r")
+ result = open("libxslt.py", "w")
+ for line in head.readlines():
+ if WITHDLLS:
+ result.write(altImport(line))
+ else:
+ result.write(line)
+ for line in generated.readlines():
+ result.write(line)
+ head.close()
+ generated.close()
+ result.close()
+ with_xslt=1
+else:
+ with_xslt=1
+
+if with_xslt == 1:
+ xslt_includes=""
+ for dir in includes_dir:
+ if not missing(dir + "/libxslt/xsltconfig.h"):
+ xslt_includes=dir + "/libxslt"
+ break;
+
+ if xslt_includes == "":
+ print "failed to find headers for libxslt: update includes_dir"
+ with_xslt = 0
+
+
+descr = "libxml2 package"
+modules = [ 'libxml2', 'drv_libxml2' ]
+if WITHDLLS:
+ modules.append('libxmlmods.__init__')
+c_files = ['libxml2-py.c', 'libxml.c', 'types.c' ]
+includes= [xml_includes, iconv_includes]
+libs = [libraryPrefix + "xml2"] + platformLibs
+macros = []
+if with_threads:
+ macros.append(('_REENTRANT','1'))
+if with_xslt == 1:
+ descr = "libxml2 and libxslt package"
+ if not sys.platform.startswith('win'):
+ #
+ # We are gonna build 2 identical shared libs with merge initializing
+ # both libxml2mod and libxsltmod
+ #
+ c_files = c_files + ['libxslt-py.c', 'libxslt.c']
+ xslt_c_files = c_files
+ macros.append(('MERGED_MODULES', '1'))
+ else:
+ #
+ # On windows the MERGED_MODULE option is not needed
+ # (and does not work)
+ #
+ xslt_c_files = ['libxslt-py.c', 'libxslt.c', 'types.c']
+ libs.insert(0, libraryPrefix + 'exslt')
+ libs.insert(0, libraryPrefix + 'xslt')
+ includes.append(xslt_includes)
+ modules.append('libxslt')
+
+
+extens=[Extension('libxml2mod', c_files, include_dirs=includes,
+ library_dirs=libdirs,
+ libraries=libs, define_macros=macros)]
+if with_xslt == 1:
+ extens.append(Extension('libxsltmod', xslt_c_files, include_dirs=includes,
+ library_dirs=libdirs,
+ libraries=libs, define_macros=macros))
+
+if missing("MANIFEST"):
+
+ manifest = open("MANIFEST", "w")
+ manifest.write("setup.py\n")
+ for file in xml_files:
+ manifest.write(file + "\n")
+ if with_xslt == 1:
+ for file in xslt_files:
+ manifest.write(file + "\n")
+ manifest.close()
+
+if WITHDLLS:
+ ext_package = "libxmlmods"
+ if sys.version >= "2.2":
+ base = "lib/site-packages/"
+ else:
+ base = ""
+ data_files = [(base+"libxmlmods",dlls)]
+else:
+ ext_package = None
+ data_files = []
+
+setup (name = "libxml2-python",
+ # On *nix, the version number is created from setup.py.in
+ # On windows, it is set by configure.js
+ version = "2.6.8",
+ description = descr,
+ author = "Daniel Veillard",
+ author_email = "veillard@redhat.com",
+ url = "http://xmlsoft.org/python.html",
+ licence="MIT Licence",
+ py_modules=modules,
+ ext_modules=extens,
+ ext_package=ext_package,
+ data_files=data_files,
+ )
+
+sys.exit(0)
+
diff --git a/python/setup.py.in b/python/setup.py.in
new file mode 100755
index 0000000..7eaf530
--- /dev/null
+++ b/python/setup.py.in
@@ -0,0 +1,242 @@
+#!/usr/bin/python -u
+#
+# Setup script for libxml2 and libxslt if found
+#
+import sys, os
+from distutils.core import setup, Extension
+
+# Below ROOT, we expect to find include, include/libxml2, lib and bin.
+# On *nix, it is not needed (but should not harm),
+# on Windows, it is set by configure.js.
+ROOT = r'@prefix@'
+
+# Thread-enabled libxml2
+with_threads = @WITH_THREADS@
+
+# If this flag is set (windows only),
+# a private copy of the dlls are included in the package.
+# If this flag is not set, the libxml2 and libxslt
+# dlls must be found somewhere in the PATH at runtime.
+WITHDLLS = 1 and sys.platform.startswith('win')
+
+def missing(file):
+ if os.access(file, os.R_OK) == 0:
+ return 1
+ return 0
+
+try:
+ HOME = os.environ['HOME']
+except:
+ HOME="C:"
+
+if WITHDLLS:
+ # libxml dlls (expected in ROOT/bin)
+ dlls = [ 'iconv.dll','libxml2.dll','libxslt.dll','libexslt.dll' ]
+ dlls = map(lambda dll: os.path.join(ROOT,'bin',dll),dlls)
+
+ # create __init__.py for the libxmlmods package
+ if not os.path.exists("libxmlmods"):
+ os.mkdir("libxmlmods")
+ open("libxmlmods/__init__.py","w").close()
+
+ def altImport(s):
+ s = s.replace("import libxml2mod","from libxmlmods import libxml2mod")
+ s = s.replace("import libxsltmod","from libxmlmods import libxsltmod")
+ return s
+
+if sys.platform.startswith('win'):
+ libraryPrefix = 'lib'
+ platformLibs = []
+else:
+ libraryPrefix = ''
+ platformLibs = ["m","z"]
+
+# those are examined to find
+# - libxml2/libxml/tree.h
+# - iconv.h
+# - libxslt/xsltconfig.h
+includes_dir = [
+"/usr/include",
+"/usr/local/include",
+"/opt/include",
+os.path.join(ROOT,'include'),
+HOME
+];
+
+xml_includes=""
+for dir in includes_dir:
+ if not missing(dir + "/libxml2/libxml/tree.h"):
+ xml_includes=dir + "/libxml2"
+ break;
+
+if xml_includes == "":
+ print "failed to find headers for libxml2: update includes_dir"
+ sys.exit(1)
+
+iconv_includes=""
+for dir in includes_dir:
+ if not missing(dir + "/iconv.h"):
+ iconv_includes=dir
+ break;
+
+if iconv_includes == "":
+ print "failed to find headers for libiconv: update includes_dir"
+ sys.exit(1)
+
+# those are added in the linker search path for libraries
+libdirs = [
+os.path.join(ROOT,'lib'),
+]
+
+xml_files = ["libxml2-api.xml", "libxml2-python-api.xml",
+ "libxml.c", "libxml.py", "libxml_wrap.h", "types.c",
+ "xmlgenerator.py", "README", "TODO", "drv_libxml2.py"]
+
+xslt_files = ["libxslt-api.xml", "libxslt-python-api.xml",
+ "libxslt.c", "libxsl.py", "libxslt_wrap.h",
+ "xsltgenerator.py"]
+
+if missing("libxml2-py.c") or missing("libxml2.py"):
+ try:
+ try:
+ import xmlgenerator
+ except:
+ import generator
+ except:
+ print "failed to find and generate stubs for libxml2, aborting ..."
+ print sys.exc_type, sys.exc_value
+ sys.exit(1)
+
+ head = open("libxml.py", "r")
+ generated = open("libxml2class.py", "r")
+ result = open("libxml2.py", "w")
+ for line in head.readlines():
+ if WITHDLLS:
+ result.write(altImport(line))
+ else:
+ result.write(line)
+ for line in generated.readlines():
+ result.write(line)
+ head.close()
+ generated.close()
+ result.close()
+
+with_xslt=0
+if missing("libxslt-py.c") or missing("libxslt.py"):
+ if missing("xsltgenerator.py") or missing("libxslt-api.xml"):
+ print "libxslt stub generator not found, libxslt not built"
+ else:
+ try:
+ import xsltgenerator
+ except:
+ print "failed to generate stubs for libxslt, aborting ..."
+ print sys.exc_type, sys.exc_value
+ else:
+ head = open("libxsl.py", "r")
+ generated = open("libxsltclass.py", "r")
+ result = open("libxslt.py", "w")
+ for line in head.readlines():
+ if WITHDLLS:
+ result.write(altImport(line))
+ else:
+ result.write(line)
+ for line in generated.readlines():
+ result.write(line)
+ head.close()
+ generated.close()
+ result.close()
+ with_xslt=1
+else:
+ with_xslt=1
+
+if with_xslt == 1:
+ xslt_includes=""
+ for dir in includes_dir:
+ if not missing(dir + "/libxslt/xsltconfig.h"):
+ xslt_includes=dir + "/libxslt"
+ break;
+
+ if xslt_includes == "":
+ print "failed to find headers for libxslt: update includes_dir"
+ with_xslt = 0
+
+
+descr = "libxml2 package"
+modules = [ 'libxml2', 'drv_libxml2' ]
+if WITHDLLS:
+ modules.append('libxmlmods.__init__')
+c_files = ['libxml2-py.c', 'libxml.c', 'types.c' ]
+includes= [xml_includes, iconv_includes]
+libs = [libraryPrefix + "xml2"] + platformLibs
+macros = []
+if with_threads:
+ macros.append(('_REENTRANT','1'))
+if with_xslt == 1:
+ descr = "libxml2 and libxslt package"
+ if not sys.platform.startswith('win'):
+ #
+ # We are gonna build 2 identical shared libs with merge initializing
+ # both libxml2mod and libxsltmod
+ #
+ c_files = c_files + ['libxslt-py.c', 'libxslt.c']
+ xslt_c_files = c_files
+ macros.append(('MERGED_MODULES', '1'))
+ else:
+ #
+ # On windows the MERGED_MODULE option is not needed
+ # (and does not work)
+ #
+ xslt_c_files = ['libxslt-py.c', 'libxslt.c', 'types.c']
+ libs.insert(0, libraryPrefix + 'exslt')
+ libs.insert(0, libraryPrefix + 'xslt')
+ includes.append(xslt_includes)
+ modules.append('libxslt')
+
+
+extens=[Extension('libxml2mod', c_files, include_dirs=includes,
+ library_dirs=libdirs,
+ libraries=libs, define_macros=macros)]
+if with_xslt == 1:
+ extens.append(Extension('libxsltmod', xslt_c_files, include_dirs=includes,
+ library_dirs=libdirs,
+ libraries=libs, define_macros=macros))
+
+if missing("MANIFEST"):
+
+ manifest = open("MANIFEST", "w")
+ manifest.write("setup.py\n")
+ for file in xml_files:
+ manifest.write(file + "\n")
+ if with_xslt == 1:
+ for file in xslt_files:
+ manifest.write(file + "\n")
+ manifest.close()
+
+if WITHDLLS:
+ ext_package = "libxmlmods"
+ if sys.version >= "2.2":
+ base = "lib/site-packages/"
+ else:
+ base = ""
+ data_files = [(base+"libxmlmods",dlls)]
+else:
+ ext_package = None
+ data_files = []
+
+setup (name = "libxml2-python",
+ # On *nix, the version number is created from setup.py.in
+ # On windows, it is set by configure.js
+ version = "@LIBXML_VERSION@",
+ description = descr,
+ author = "Daniel Veillard",
+ author_email = "veillard@redhat.com",
+ url = "http://xmlsoft.org/python.html",
+ licence="MIT Licence",
+ py_modules=modules,
+ ext_modules=extens,
+ ext_package=ext_package,
+ data_files=data_files,
+ )
+
+sys.exit(0)
+
diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am
new file mode 100644
index 0000000..a07497e
--- /dev/null
+++ b/python/tests/Makefile.am
@@ -0,0 +1,60 @@
+EXAMPLE_DIR = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)/examples
+
+PYTESTS= \
+ build.py \
+ attribs.py \
+ tst.py \
+ tstxpath.py \
+ xpathext.py \
+ push.py \
+ pushSAX.py \
+ pushSAXhtml.py \
+ error.py \
+ serialize.py\
+ validate.py \
+ tstURI.py \
+ cutnpaste.py\
+ xpathret.py \
+ xpath.py \
+ outbuf.py \
+ inbuf.py \
+ resolver.py \
+ regexp.py \
+ reader.py \
+ reader2.py \
+ reader3.py \
+ reader4.py \
+ reader5.py \
+ reader6.py \
+ reader7.py \
+ walker.py \
+ ctxterror.py\
+ readererr.py\
+ relaxng.py \
+ thread2.py \
+ tstLastError.py \
+ indexes.py
+
+XMLS= \
+ tst.xml \
+ valid.xml \
+ invalid.xml
+
+EXTRA_DIST = $(PYTESTS) $(XMLS)
+
+if WITH_PYTHON
+tests: $(PYTESTS)
+ -@(PYTHONPATH="..:../.libs:$(srcdir)/.." ; export PYTHONPATH; \
+ for test in $(PYTESTS) ; do echo "-- $$test" ; $(PYTHON) $(srcdir)/$$test ; done)
+else
+tests:
+endif
+
+clean:
+ rm -f *.pyc core
+
+install-data-local:
+ $(mkinstalldirs) $(DESTDIR)$(EXAMPLE_DIR)
+ -(for test in $(PYTESTS) $(XMLS); \
+ do @INSTALL@ -m 0644 $(srcdir)/$$test $(DESTDIR)$(EXAMPLE_DIR) ; done)
+
diff --git a/python/tests/Makefile.in b/python/tests/Makefile.in
new file mode 100644
index 0000000..eebc526
--- /dev/null
+++ b/python/tests/Makefile.in
@@ -0,0 +1,459 @@
+# Makefile.in generated by automake 1.8.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = @host@
+subdir = python/tests
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+C14N_OBJ = @C14N_OBJ@
+CATALOG_OBJ = @CATALOG_OBJ@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG_OBJ = @DEBUG_OBJ@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOCB_OBJ = @DOCB_OBJ@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FTP_OBJ = @FTP_OBJ@
+HAVE_ISINF = @HAVE_ISINF@
+HAVE_ISNAN = @HAVE_ISNAN@
+HTML_DIR = @HTML_DIR@
+HTML_OBJ = @HTML_OBJ@
+HTTP_OBJ = @HTTP_OBJ@
+ICONV_LIBS = @ICONV_LIBS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBXML_MAJOR_VERSION = @LIBXML_MAJOR_VERSION@
+LIBXML_MICRO_VERSION = @LIBXML_MICRO_VERSION@
+LIBXML_MINOR_VERSION = @LIBXML_MINOR_VERSION@
+LIBXML_VERSION = @LIBXML_VERSION@
+LIBXML_VERSION_INFO = @LIBXML_VERSION_INFO@
+LIBXML_VERSION_NUMBER = @LIBXML_VERSION_NUMBER@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MV = @MV@
+M_LIBS = @M_LIBS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATTERN_TEST = @PATTERN_TEST@
+PYTHON = @PYTHON@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_SITE_PACKAGES = @PYTHON_SITE_PACKAGES@
+PYTHON_SUBDIR = @PYTHON_SUBDIR@
+PYTHON_TESTS = @PYTHON_TESTS@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RDL_LIBS = @RDL_LIBS@
+READER_TEST = @READER_TEST@
+RELDATE = @RELDATE@
+RM = @RM@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STATIC_BINARIES = @STATIC_BINARIES@
+STRIP = @STRIP@
+TAR = @TAR@
+TEST_C14N = @TEST_C14N@
+TEST_CATALOG = @TEST_CATALOG@
+TEST_DEBUG = @TEST_DEBUG@
+TEST_HTML = @TEST_HTML@
+TEST_PHTML = @TEST_PHTML@
+TEST_PUSH = @TEST_PUSH@
+TEST_REGEXPS = @TEST_REGEXPS@
+TEST_SAX = @TEST_SAX@
+TEST_SCHEMAS = @TEST_SCHEMAS@
+TEST_THREADS = @TEST_THREADS@
+TEST_VALID = @TEST_VALID@
+TEST_VTIME = @TEST_VTIME@
+TEST_XINCLUDE = @TEST_XINCLUDE@
+TEST_XPATH = @TEST_XPATH@
+TEST_XPTR = @TEST_XPTR@
+THREADS_W32 = @THREADS_W32@
+THREAD_CFLAGS = @THREAD_CFLAGS@
+THREAD_LIBS = @THREAD_LIBS@
+U = @U@
+VERSION = @VERSION@
+WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@
+WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@
+WITH_C14N = @WITH_C14N@
+WITH_CATALOG = @WITH_CATALOG@
+WITH_DEBUG = @WITH_DEBUG@
+WITH_DOCB = @WITH_DOCB@
+WITH_FTP = @WITH_FTP@
+WITH_HTML = @WITH_HTML@
+WITH_HTTP = @WITH_HTTP@
+WITH_ICONV = @WITH_ICONV@
+WITH_ISO8859X = @WITH_ISO8859X@
+WITH_LEGACY = @WITH_LEGACY@
+WITH_MEM_DEBUG = @WITH_MEM_DEBUG@
+WITH_OUTPUT = @WITH_OUTPUT@
+WITH_PATTERN = @WITH_PATTERN@
+WITH_PUSH = @WITH_PUSH@
+WITH_PYTHON_FALSE = @WITH_PYTHON_FALSE@
+WITH_PYTHON_TRUE = @WITH_PYTHON_TRUE@
+WITH_READER = @WITH_READER@
+WITH_REGEXPS = @WITH_REGEXPS@
+WITH_SAX1 = @WITH_SAX1@
+WITH_SCHEMAS = @WITH_SCHEMAS@
+WITH_THREADS = @WITH_THREADS@
+WITH_TREE = @WITH_TREE@
+WITH_TRIO = @WITH_TRIO@
+WITH_TRIO_SOURCES_FALSE = @WITH_TRIO_SOURCES_FALSE@
+WITH_TRIO_SOURCES_TRUE = @WITH_TRIO_SOURCES_TRUE@
+WITH_VALID = @WITH_VALID@
+WITH_WRITER = @WITH_WRITER@
+WITH_XINCLUDE = @WITH_XINCLUDE@
+WITH_XPATH = @WITH_XPATH@
+WITH_XPTR = @WITH_XPTR@
+XINCLUDE_OBJ = @XINCLUDE_OBJ@
+XML_CFLAGS = @XML_CFLAGS@
+XML_INCLUDEDIR = @XML_INCLUDEDIR@
+XML_LIBDIR = @XML_LIBDIR@
+XML_LIBS = @XML_LIBS@
+XML_LIBTOOLLIBS = @XML_LIBTOOLLIBS@
+XPATH_OBJ = @XPATH_OBJ@
+XPTR_OBJ = @XPTR_OBJ@
+Z_CFLAGS = @Z_CFLAGS@
+Z_LIBS = @Z_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+EXAMPLE_DIR = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)/examples
+PYTESTS = \
+ build.py \
+ attribs.py \
+ tst.py \
+ tstxpath.py \
+ xpathext.py \
+ push.py \
+ pushSAX.py \
+ pushSAXhtml.py \
+ error.py \
+ serialize.py\
+ validate.py \
+ tstURI.py \
+ cutnpaste.py\
+ xpathret.py \
+ xpath.py \
+ outbuf.py \
+ inbuf.py \
+ resolver.py \
+ regexp.py \
+ reader.py \
+ reader2.py \
+ reader3.py \
+ reader4.py \
+ reader5.py \
+ reader6.py \
+ reader7.py \
+ walker.py \
+ ctxterror.py\
+ readererr.py\
+ relaxng.py \
+ thread2.py \
+ tstLastError.py \
+ indexes.py
+
+XMLS = \
+ tst.xml \
+ valid.xml \
+ invalid.xml
+
+EXTRA_DIST = $(PYTESTS) $(XMLS)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu python/tests/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu python/tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-data-local install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-info-am
+
+
+@WITH_PYTHON_TRUE@tests: $(PYTESTS)
+@WITH_PYTHON_TRUE@ -@(PYTHONPATH="..:../.libs:$(srcdir)/.." ; export PYTHONPATH; \
+@WITH_PYTHON_TRUE@ for test in $(PYTESTS) ; do echo "-- $$test" ; $(PYTHON) $(srcdir)/$$test ; done)
+@WITH_PYTHON_FALSE@tests:
+
+clean:
+ rm -f *.pyc core
+
+install-data-local:
+ $(mkinstalldirs) $(DESTDIR)$(EXAMPLE_DIR)
+ -(for test in $(PYTESTS) $(XMLS); \
+ do @INSTALL@ -m 0644 $(srcdir)/$$test $(DESTDIR)$(EXAMPLE_DIR) ; done)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/python/tests/attribs.py b/python/tests/attribs.py
new file mode 100755
index 0000000..9331a27
--- /dev/null
+++ b/python/tests/attribs.py
@@ -0,0 +1,34 @@
+#!/usr/bin/python -u
+import sys
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+#
+# Testing XML document serialization
+#
+doc = libxml2.parseDoc(
+"""<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE test [
+<!ELEMENT test (#PCDATA) >
+<!ATTLIST test xmlns:abc CDATA #FIXED "http://abc.org" >
+<!ATTLIST test abc:attr CDATA #FIXED "def" >
+]>
+<test />
+""")
+elem = doc.getRootElement()
+attr = elem.hasNsProp('attr', 'http://abc.org')
+if attr == None or attr.serialize()[:-1] != """<!ATTLIST test abc:attr CDATA #FIXED "def">""":
+ print "Failed to find defaulted attribute abc:attr"
+ sys.exit(1)
+
+doc.freeDoc()
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/build.py b/python/tests/build.py
new file mode 100755
index 0000000..bfc776c
--- /dev/null
+++ b/python/tests/build.py
@@ -0,0 +1,59 @@
+#!/usr/bin/python -u
+import libxml2
+import sys
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+doc = libxml2.newDoc("1.0")
+comment = doc.newDocComment("This is a generated document")
+doc.addChild(comment)
+pi = libxml2.newPI("test", "PI content")
+doc.addChild(pi)
+root = doc.newChild(None, "doc", None)
+ns = root.newNs("http://example.com/doc", "my")
+root.setNs(ns)
+elem = root.newChild(None, "foo", "bar")
+elem.setBase("http://example.com/imgs")
+elem.setProp("img", "image.gif")
+doc.saveFile("tmp.xml")
+doc.freeDoc()
+
+doc = libxml2.parseFile("tmp.xml")
+comment = doc.children
+if comment.type != "comment" or \
+ comment.content != "This is a generated document":
+ print "error rereading comment"
+ sys.exit(1)
+pi = comment.next
+if pi.type != "pi" or pi.name != "test" or pi.content != "PI content":
+ print "error rereading PI"
+ sys.exit(1)
+root = pi.next
+if root.name != "doc":
+ print "error rereading root"
+ sys.exit(1)
+ns = root.ns()
+if ns.name != "my" or ns.content != "http://example.com/doc":
+ print "error rereading namespace"
+ sys.exit(1)
+elem = root.children
+if elem.name != "foo":
+ print "error rereading elem"
+ sys.exit(1)
+if elem.getBase(None) != "http://example.com/imgs":
+ print "error rereading base"
+ sys.exit(1)
+if elem.prop("img") != "image.gif":
+ print "error rereading property"
+ sys.exit(1)
+
+doc.freeDoc()
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/ctxterror.py b/python/tests/ctxterror.py
new file mode 100755
index 0000000..f2a897a
--- /dev/null
+++ b/python/tests/ctxterror.py
@@ -0,0 +1,56 @@
+#!/usr/bin/python -u
+#
+# This test exercise the redirection of error messages with a
+# functions defined in Python.
+#
+import sys
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+expect="""--> (3) xmlns: URI foo is not absolute
+--> (4) Opening and ending tag mismatch: x line 0 and y
+"""
+
+err=""
+def callback(arg,msg,severity,reserved):
+ global err
+ err = err + "%s (%d) %s" % (arg,severity,msg)
+
+s = """<x xmlns="foo"></y>"""
+
+parserCtxt = libxml2.createPushParser(None,"",0,"test.xml")
+parserCtxt.setErrorHandler(callback, "-->")
+if parserCtxt.getErrorHandler() != (callback,"-->"):
+ print "getErrorHandler failed"
+ sys.exit(1)
+parserCtxt.parseChunk(s,len(s),1)
+doc = parserCtxt.doc()
+doc.freeDoc()
+parserCtxt = None
+
+if err != expect:
+ print "error"
+ print "received %s" %(err)
+ print "expected %s" %(expect)
+ sys.exit(1)
+
+i = 10000
+while i > 0:
+ parserCtxt = libxml2.createPushParser(None,"",0,"test.xml")
+ parserCtxt.setErrorHandler(callback, "-->")
+ parserCtxt.parseChunk(s,len(s),1)
+ doc = parserCtxt.doc()
+ doc.freeDoc()
+ parserCtxt = None
+ err = ""
+ i = i - 1
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/cutnpaste.py b/python/tests/cutnpaste.py
new file mode 100755
index 0000000..0f9665a
--- /dev/null
+++ b/python/tests/cutnpaste.py
@@ -0,0 +1,48 @@
+#!/usr/bin/python -u
+import sys
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+#
+# Testing XML document serialization
+#
+source = libxml2.parseDoc("""<?xml version="1.0"?>
+<root xmlns:foo="http://example.org/foo"
+ xmlns:bar="http://example.org/bar">
+<include xmlns="http://example.org/include">
+<fragment><foo:elem bar="tricky"/></fragment>
+</include>
+</root>
+""")
+
+target = libxml2.parseDoc("""<?xml version="1.0"?>
+<root xmlns:foobar="http://example.org/bar"/>""")
+
+fragment = source.xpathEval("//*[name()='fragment']")[0]
+dest = target.getRootElement()
+
+# do a cut and paste operation
+fragment.unlinkNode()
+dest.addChild(fragment)
+# do the namespace fixup
+dest.reconciliateNs(target)
+
+# The source tree can be freed at that point
+source.freeDoc()
+
+# check the resulting tree
+str = dest.serialize()
+if str != """<root xmlns:foobar="http://example.org/bar" xmlns:default="http://example.org/include" xmlns:foo="http://example.org/foo"><default:fragment><foo:elem bar="tricky"/></default:fragment></root>""":
+ print "reconciliateNs() failed"
+ sys.exit(1)
+target.freeDoc()
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/error.py b/python/tests/error.py
new file mode 100755
index 0000000..da6d0c1
--- /dev/null
+++ b/python/tests/error.py
@@ -0,0 +1,51 @@
+#!/usr/bin/python -u
+#
+# This test exercise the redirection of error messages with a
+# functions defined in Python.
+#
+import sys
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+expect='--> I/O --> warning : --> failed to load external entity "missing.xml"\n'
+err=""
+def callback(ctx, str):
+ global err
+
+ err = err + "%s %s" % (ctx, str)
+
+got_exc = 0
+libxml2.registerErrorHandler(callback, "-->")
+try:
+ doc = libxml2.parseFile("missing.xml")
+except libxml2.parserError:
+ got_exc = 1
+
+if got_exc == 0:
+ print "Failed to get a parser exception"
+ sys.exit(1)
+
+if err != expect:
+ print "error"
+ print "received %s" %(err)
+ print "expected %s" %(expect)
+ sys.exit(1)
+
+i = 10000
+while i > 0:
+ try:
+ doc = libxml2.parseFile("missing.xml")
+ except libxml2.parserError:
+ got_exc = 1
+ err = ""
+ i = i - 1
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/inbuf.py b/python/tests/inbuf.py
new file mode 100755
index 0000000..a7cc7a6
--- /dev/null
+++ b/python/tests/inbuf.py
@@ -0,0 +1,25 @@
+#!/usr/bin/python -u
+import sys
+import libxml2
+import StringIO
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+i = 0
+while i < 5000:
+ f = StringIO.StringIO("foobar")
+ buf = libxml2.inputBuffer(f)
+ i = i + 1
+
+del f
+del buf
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
+
diff --git a/python/tests/indexes.py b/python/tests/indexes.py
new file mode 100755
index 0000000..8d7a7fc
--- /dev/null
+++ b/python/tests/indexes.py
@@ -0,0 +1,113 @@
+#!/usr/bin/python -u
+# -*- coding: ISO-8859-1 -*-
+import sys
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+ctxt = None
+
+class callback:
+ def __init__(self, startd, starte, ende, delta, endd):
+ self.startd = startd
+ self.starte = starte
+ self.ende = ende
+ self.endd = endd
+ self.delta = delta
+ self.count = 0
+
+ def startDocument(self):
+ global ctxt
+ if ctxt.byteConsumed() != self.startd:
+ print "document start at wrong index: %d expecting %d\n" % (
+ ctxt.byteConsumed(), self.startd)
+ sys.exit(1)
+
+ def endDocument(self):
+ global ctxt
+ expect = self.ende + self.delta * (self.count - 1) + self.endd
+ if ctxt.byteConsumed() != expect:
+ print "document end at wrong index: %d expecting %d\n" % (
+ ctxt.byteConsumed(), expect)
+ sys.exit(1)
+
+ def startElement(self, tag, attrs):
+ global ctxt
+ if tag == "bar1":
+ expect = self.starte + self.delta * self.count
+ if ctxt.byteConsumed() != expect:
+ print "element start at wrong index: %d expecting %d\n" % (
+ ctxt.byteConsumed(), expect)
+ sys.exit(1)
+
+
+ def endElement(self, tag):
+ global ctxt
+ if tag == "bar1":
+ expect = self.ende + self.delta * self.count
+ if ctxt.byteConsumed() != expect:
+ print "element end at wrong index: %d expecting %d\n" % (
+ ctxt.byteConsumed(), expect)
+ sys.exit(1)
+ self.count = self.count + 1
+
+ def characters(self, data):
+ pass
+
+#
+# First run a pure UTF-8 test
+#
+handler = callback(0, 13, 27, 198, 183)
+ctxt = libxml2.createPushParser(handler, "<foo>\n", 6, "test.xml")
+chunk = """ <bar1>chars1</bar1>
+ <bar2>chars2</bar2>
+ <bar3>chars3</bar3>
+ <bar4>chars4</bar4>
+ <bar5>chars5</bar5>
+ <bar6>&lt;s6</bar6>
+ <bar7>chars7</bar7>
+ <bar8>&#38;8</bar8>
+ <bar9>chars9</bar9>
+"""
+i = 0
+while i < 10000:
+ ctxt.parseChunk(chunk, len(chunk), 0)
+ i = i + 1
+chunk = "</foo>"
+ctxt.parseChunk(chunk, len(chunk), 1)
+ctxt=None
+
+#
+# Then run a test relying on ISO-Latin-1
+#
+handler = callback(43, 57, 71, 198, 183)
+chunk="""<?xml version="1.0" encoding="ISO-8859-1"?>
+<foo>
+"""
+ctxt = libxml2.createPushParser(handler, chunk, len(chunk), "test.xml")
+chunk = """ <bar1>chars1</bar1>
+ <bar2>chars2</bar2>
+ <bar3>chars3</bar3>
+ <bar4>chàrs4</bar4>
+ <bar5>chars5</bar5>
+ <bar6>&lt;s6</bar6>
+ <bar7>chars7</bar7>
+ <bar8>&#38;8</bar8>
+ <bar9>très 9</bar9>
+"""
+i = 0
+while i < 10000:
+ ctxt.parseChunk(chunk, len(chunk), 0)
+ i = i + 1
+chunk = "</foo>"
+ctxt.parseChunk(chunk, len(chunk), 1)
+ctxt=None
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/invalid.xml b/python/tests/invalid.xml
new file mode 100644
index 0000000..7c9b27e
--- /dev/null
+++ b/python/tests/invalid.xml
@@ -0,0 +1,6 @@
+<!DOCTYPE doc [
+<!ELEMENT doc (a, b, a)>
+<!ELEMENT a EMPTY>
+<!ELEMENT b EMPTY>
+]>
+<doc><b/><a/><b/></doc>
diff --git a/python/tests/outbuf.py b/python/tests/outbuf.py
new file mode 100755
index 0000000..4213159
--- /dev/null
+++ b/python/tests/outbuf.py
@@ -0,0 +1,33 @@
+#!/usr/bin/python -u
+import sys
+import libxml2
+import StringIO
+
+#print "Skipped"
+#sys.exit(1)
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+#f = open('res', 'w')
+f = StringIO.StringIO()
+buf = libxml2.createOutputBuffer(f, "ISO-8859-1")
+buf.write(3, "foo")
+buf.writeString("bar")
+buf.close()
+
+if f.getvalue() != "foobar":
+ print "Failed to save to StringIO"
+ sys.exit(1)
+
+del buf
+del f
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
+
diff --git a/python/tests/push.py b/python/tests/push.py
new file mode 100755
index 0000000..5b60a16
--- /dev/null
+++ b/python/tests/push.py
@@ -0,0 +1,35 @@
+#!/usr/bin/python -u
+import sys
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+ctxt = libxml2.createPushParser(None, "<foo", 4, "test.xml")
+ctxt.parseChunk("/>", 2, 1)
+doc = ctxt.doc()
+ctxt=None
+if doc.name != "test.xml":
+ print "document name error"
+ sys.exit(1)
+root = doc.children
+if root.name != "foo":
+ print "root element name error"
+ sys.exit(1)
+doc.freeDoc()
+i = 10000
+while i > 0:
+ ctxt = libxml2.createPushParser(None, "<foo", 4, "test.xml")
+ ctxt.parseChunk("/>", 2, 1)
+ doc = ctxt.doc()
+ doc.freeDoc()
+ i = i -1
+ctxt=None
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/pushSAX.py b/python/tests/pushSAX.py
new file mode 100755
index 0000000..1c1e786
--- /dev/null
+++ b/python/tests/pushSAX.py
@@ -0,0 +1,64 @@
+#!/usr/bin/python -u
+import sys
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+log = ""
+
+class callback:
+ def startDocument(self):
+ global log
+ log = log + "startDocument:"
+
+ def endDocument(self):
+ global log
+ log = log + "endDocument:"
+
+ def startElement(self, tag, attrs):
+ global log
+ log = log + "startElement %s %s:" % (tag, attrs)
+
+ def endElement(self, tag):
+ global log
+ log = log + "endElement %s:" % (tag)
+
+ def characters(self, data):
+ global log
+ log = log + "characters: %s:" % (data)
+
+ def warning(self, msg):
+ global log
+ log = log + "warning: %s:" % (msg)
+
+ def error(self, msg):
+ global log
+ log = log + "error: %s:" % (msg)
+
+ def fatalError(self, msg):
+ global log
+ log = log + "fatalError: %s:" % (msg)
+
+handler = callback()
+
+ctxt = libxml2.createPushParser(handler, "<foo", 4, "test.xml")
+chunk = " url='tst'>b"
+ctxt.parseChunk(chunk, len(chunk), 0)
+chunk = "ar</foo>"
+ctxt.parseChunk(chunk, len(chunk), 1)
+ctxt=None
+
+reference = "startDocument:startElement foo {'url': 'tst'}:characters: bar:endElement foo:endDocument:"
+if log != reference:
+ print "Error got: %s" % log
+ print "Exprected: %s" % reference
+ sys.exit(1)
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/pushSAXhtml.py b/python/tests/pushSAXhtml.py
new file mode 100755
index 0000000..e6e89d9
--- /dev/null
+++ b/python/tests/pushSAXhtml.py
@@ -0,0 +1,65 @@
+#!/usr/bin/python -u
+import sys
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+log = ""
+
+class callback:
+ def startDocument(self):
+ global log
+ log = log + "startDocument:"
+
+ def endDocument(self):
+ global log
+ log = log + "endDocument:"
+
+ def startElement(self, tag, attrs):
+ global log
+ log = log + "startElement %s %s:" % (tag, attrs)
+
+ def endElement(self, tag):
+ global log
+ log = log + "endElement %s:" % (tag)
+
+ def characters(self, data):
+ global log
+ log = log + "characters: %s:" % (data)
+
+ def warning(self, msg):
+ global log
+ log = log + "warning: %s:" % (msg)
+
+ def error(self, msg):
+ global log
+ log = log + "error: %s:" % (msg)
+
+ def fatalError(self, msg):
+ global log
+ log = log + "fatalError: %s:" % (msg)
+
+handler = callback()
+
+ctxt = libxml2.htmlCreatePushParser(handler, "<foo", 4, "test.xml")
+chunk = " url='tst'>b"
+ctxt.htmlParseChunk(chunk, len(chunk), 0)
+chunk = "ar</foo>"
+ctxt.htmlParseChunk(chunk, len(chunk), 1)
+ctxt=None
+
+reference = """startDocument:startElement html None:startElement body None:startElement foo {'url': 'tst'}:error: Tag foo invalid
+:characters: bar:endElement foo:endElement body:endElement html:endDocument:"""
+if log != reference:
+ print "Error got: %s" % log
+ print "Exprected: %s" % reference
+ sys.exit(1)
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/reader.py b/python/tests/reader.py
new file mode 100755
index 0000000..6c37762
--- /dev/null
+++ b/python/tests/reader.py
@@ -0,0 +1,441 @@
+#!/usr/bin/python -u
+# -*- coding: ISO-8859-1 -*-
+#
+# this tests the basic APIs of the XmlTextReader interface
+#
+import libxml2
+import StringIO
+import sys
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+f = StringIO.StringIO("""<a><b b1="b1"/><c>content of c</c></a>""")
+input = libxml2.inputBuffer(f)
+reader = input.newTextReader("test1")
+ret = reader.Read()
+if ret != 1:
+ print "test1: Error reading to first element"
+ sys.exit(1)
+if reader.Name() != "a" or reader.IsEmptyElement() != 0 or \
+ reader.NodeType() != 1 or reader.HasAttributes() != 0:
+ print "test1: Error reading the first element"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 1:
+ print "test1: Error reading to second element"
+ sys.exit(1)
+if reader.Name() != "b" or reader.IsEmptyElement() != 1 or \
+ reader.NodeType() != 1 or reader.HasAttributes() != 1:
+ print "test1: Error reading the second element"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 1:
+ print "test1: Error reading to third element"
+ sys.exit(1)
+if reader.Name() != "c" or reader.IsEmptyElement() != 0 or \
+ reader.NodeType() != 1 or reader.HasAttributes() != 0:
+ print "test1: Error reading the third element"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 1:
+ print "test1: Error reading to text node"
+ sys.exit(1)
+if reader.Name() != "#text" or reader.IsEmptyElement() != 0 or \
+ reader.NodeType() != 3 or reader.HasAttributes() != 0 or \
+ reader.Value() != "content of c":
+ print "test1: Error reading the text node"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 1:
+ print "test1: Error reading to end of third element"
+ sys.exit(1)
+if reader.Name() != "c" or reader.IsEmptyElement() != 0 or \
+ reader.NodeType() != 15 or reader.HasAttributes() != 0:
+ print "test1: Error reading the end of third element"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 1:
+ print "test1: Error reading to end of first element"
+ sys.exit(1)
+if reader.Name() != "a" or reader.IsEmptyElement() != 0 or \
+ reader.NodeType() != 15 or reader.HasAttributes() != 0:
+ print "test1: Error reading the end of first element"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 0:
+ print "test1: Error reading to end of document"
+ sys.exit(1)
+
+#
+# example from the XmlTextReader docs
+#
+f = StringIO.StringIO("""<test xmlns:dt="urn:datatypes" dt:type="int"/>""")
+input = libxml2.inputBuffer(f)
+reader = input.newTextReader("test2")
+
+ret = reader.Read()
+if ret != 1:
+ print "Error reading test element"
+ sys.exit(1)
+if reader.GetAttributeNo(0) != "urn:datatypes" or \
+ reader.GetAttributeNo(1) != "int" or \
+ reader.GetAttributeNs("type", "urn:datatypes") != "int" or \
+ reader.GetAttribute("dt:type") != "int":
+ print "error reading test attributes"
+ sys.exit(1)
+
+#
+# example from the XmlTextReader docs
+#
+f = StringIO.StringIO("""<root xmlns:a="urn:456">
+<item>
+<ref href="a:b"/>
+</item>
+</root>""")
+input = libxml2.inputBuffer(f)
+reader = input.newTextReader("test3")
+
+ret = reader.Read()
+while ret == 1:
+ if reader.Name() == "ref":
+ if reader.LookupNamespace("a") != "urn:456":
+ print "error resolving namespace prefix"
+ sys.exit(1)
+ break
+ ret = reader.Read()
+if ret != 1:
+ print "Error finding the ref element"
+ sys.exit(1)
+
+#
+# Home made example for the various attribute access functions
+#
+f = StringIO.StringIO("""<testattr xmlns="urn:1" xmlns:a="urn:2" b="b" a:b="a:b"/>""")
+input = libxml2.inputBuffer(f)
+reader = input.newTextReader("test4")
+ret = reader.Read()
+if ret != 1:
+ print "Error reading the testattr element"
+ sys.exit(1)
+#
+# Attribute exploration by index
+#
+if reader.MoveToAttributeNo(0) != 1:
+ print "Failed moveToAttribute(0)"
+ sys.exit(1)
+if reader.Value() != "urn:1":
+ print "Failed to read attribute(0)"
+ sys.exit(1)
+if reader.Name() != "xmlns":
+ print "Failed to read attribute(0) name"
+ sys.exit(1)
+if reader.MoveToAttributeNo(1) != 1:
+ print "Failed moveToAttribute(1)"
+ sys.exit(1)
+if reader.Value() != "urn:2":
+ print "Failed to read attribute(1)"
+ sys.exit(1)
+if reader.Name() != "xmlns:a":
+ print "Failed to read attribute(1) name"
+ sys.exit(1)
+if reader.MoveToAttributeNo(2) != 1:
+ print "Failed moveToAttribute(2)"
+ sys.exit(1)
+if reader.Value() != "b":
+ print "Failed to read attribute(2)"
+ sys.exit(1)
+if reader.Name() != "b":
+ print "Failed to read attribute(2) name"
+ sys.exit(1)
+if reader.MoveToAttributeNo(3) != 1:
+ print "Failed moveToAttribute(3)"
+ sys.exit(1)
+if reader.Value() != "a:b":
+ print "Failed to read attribute(3)"
+ sys.exit(1)
+if reader.Name() != "a:b":
+ print "Failed to read attribute(3) name"
+ sys.exit(1)
+#
+# Attribute exploration by name
+#
+if reader.MoveToAttribute("xmlns") != 1:
+ print "Failed moveToAttribute('xmlns')"
+ sys.exit(1)
+if reader.Value() != "urn:1":
+ print "Failed to read attribute('xmlns')"
+ sys.exit(1)
+if reader.MoveToAttribute("xmlns:a") != 1:
+ print "Failed moveToAttribute('xmlns')"
+ sys.exit(1)
+if reader.Value() != "urn:2":
+ print "Failed to read attribute('xmlns:a')"
+ sys.exit(1)
+if reader.MoveToAttribute("b") != 1:
+ print "Failed moveToAttribute('b')"
+ sys.exit(1)
+if reader.Value() != "b":
+ print "Failed to read attribute('b')"
+ sys.exit(1)
+if reader.MoveToAttribute("a:b") != 1:
+ print "Failed moveToAttribute('a:b')"
+ sys.exit(1)
+if reader.Value() != "a:b":
+ print "Failed to read attribute('a:b')"
+ sys.exit(1)
+if reader.MoveToAttributeNs("b", "urn:2") != 1:
+ print "Failed moveToAttribute('b', 'urn:2')"
+ sys.exit(1)
+if reader.Value() != "a:b":
+ print "Failed to read attribute('b', 'urn:2')"
+ sys.exit(1)
+#
+# Go back and read in sequence
+#
+if reader.MoveToElement() != 1:
+ print "Failed to move back to element"
+ sys.exit(1)
+if reader.MoveToFirstAttribute() != 1:
+ print "Failed to move to first attribute"
+ sys.exit(1)
+if reader.Value() != "urn:1":
+ print "Failed to read attribute(0)"
+ sys.exit(1)
+if reader.Name() != "xmlns":
+ print "Failed to read attribute(0) name"
+ sys.exit(1)
+if reader.MoveToNextAttribute() != 1:
+ print "Failed to move to next attribute"
+ sys.exit(1)
+if reader.Value() != "urn:2":
+ print "Failed to read attribute(1)"
+ sys.exit(1)
+if reader.Name() != "xmlns:a":
+ print "Failed to read attribute(1) name"
+ sys.exit(1)
+if reader.MoveToNextAttribute() != 1:
+ print "Failed to move to next attribute"
+ sys.exit(1)
+if reader.Value() != "b":
+ print "Failed to read attribute(2)"
+ sys.exit(1)
+if reader.Name() != "b":
+ print "Failed to read attribute(2) name"
+ sys.exit(1)
+if reader.MoveToNextAttribute() != 1:
+ print "Failed to move to next attribute"
+ sys.exit(1)
+if reader.Value() != "a:b":
+ print "Failed to read attribute(3)"
+ sys.exit(1)
+if reader.Name() != "a:b":
+ print "Failed to read attribute(3) name"
+ sys.exit(1)
+if reader.MoveToNextAttribute() != 0:
+ print "Failed to detect last attribute"
+ sys.exit(1)
+
+
+#
+# a couple of tests for namespace nodes
+#
+f = StringIO.StringIO("""<a xmlns="http://example.com/foo"/>""")
+input = libxml2.inputBuffer(f)
+reader = input.newTextReader("test6")
+ret = reader.Read()
+if ret != 1:
+ print "test6: failed to Read()"
+ sys.exit(1)
+ret = reader.MoveToFirstAttribute()
+if ret != 1:
+ print "test6: failed to MoveToFirstAttribute()"
+ sys.exit(1)
+if reader.NamespaceUri() != "http://www.w3.org/2000/xmlns/" or \
+ reader.LocalName() != "xmlns" or reader.Name() != "xmlns" or \
+ reader.Value() != "http://example.com/foo" or reader.NodeType() != 2:
+ print "test6: failed to read the namespace node"
+ sys.exit(1)
+
+f = StringIO.StringIO("""<a xmlns:prefix="http://example.com/foo"/>""")
+input = libxml2.inputBuffer(f)
+reader = input.newTextReader("test7")
+ret = reader.Read()
+if ret != 1:
+ print "test7: failed to Read()"
+ sys.exit(1)
+ret = reader.MoveToFirstAttribute()
+if ret != 1:
+ print "test7: failed to MoveToFirstAttribute()"
+ sys.exit(1)
+if reader.NamespaceUri() != "http://www.w3.org/2000/xmlns/" or \
+ reader.LocalName() != "prefix" or reader.Name() != "xmlns:prefix" or \
+ reader.Value() != "http://example.com/foo" or reader.NodeType() != 2:
+ print "test7: failed to read the namespace node"
+ sys.exit(1)
+
+#
+# Test for a limit case:
+#
+f = StringIO.StringIO("""<a/>""")
+input = libxml2.inputBuffer(f)
+reader = input.newTextReader("test8")
+ret = reader.Read()
+if ret != 1:
+ print "test8: failed to read the node"
+ sys.exit(1)
+if reader.Name() != "a" or reader.IsEmptyElement() != 1:
+ print "test8: failed to analyze the node"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 0:
+ print "test8: failed to detect the EOF"
+ sys.exit(1)
+
+#
+# Another test provided by Stéphane Bidoul and checked with C#
+#
+def tst_reader(s):
+ f = StringIO.StringIO(s)
+ input = libxml2.inputBuffer(f)
+ reader = input.newTextReader("tst")
+ res = ""
+ while reader.Read():
+ res=res + "%s (%s) [%s] %d %d\n" % (reader.NodeType(),reader.Name(),
+ reader.Value(), reader.IsEmptyElement(),
+ reader.Depth())
+ if reader.NodeType() == 1: # Element
+ while reader.MoveToNextAttribute():
+ res = res + "-- %s (%s) [%s] %d %d\n" % (reader.NodeType(),
+ reader.Name(),reader.Value(),
+ reader.IsEmptyElement(), reader.Depth())
+ return res
+
+doc="""<a><b b1="b1"/><c>content of c</c></a>"""
+expect="""1 (a) [None] 0 0
+1 (b) [None] 1 1
+-- 2 (b1) [b1] 0 2
+1 (c) [None] 0 1
+3 (#text) [content of c] 0 2
+15 (c) [None] 0 1
+15 (a) [None] 0 0
+"""
+res = tst_reader(doc)
+if res != expect:
+ print "test5 failed"
+ print res
+ sys.exit(1)
+
+doc="""<test><b/><c/></test>"""
+expect="""1 (test) [None] 0 0
+1 (b) [None] 1 1
+1 (c) [None] 1 1
+15 (test) [None] 0 0
+"""
+res = tst_reader(doc)
+if res != expect:
+ print "test9 failed"
+ print res
+ sys.exit(1)
+
+doc="""<a><b>bbb</b><c>ccc</c></a>"""
+expect="""1 (a) [None] 0 0
+1 (b) [None] 0 1
+3 (#text) [bbb] 0 2
+15 (b) [None] 0 1
+1 (c) [None] 0 1
+3 (#text) [ccc] 0 2
+15 (c) [None] 0 1
+15 (a) [None] 0 0
+"""
+res = tst_reader(doc)
+if res != expect:
+ print "test10 failed"
+ print res
+ sys.exit(1)
+
+doc="""<test a="a"/>"""
+expect="""1 (test) [None] 1 0
+-- 2 (a) [a] 0 1
+"""
+res = tst_reader(doc)
+if res != expect:
+ print "test11 failed"
+ print res
+ sys.exit(1)
+
+doc="""<test><a>aaa</a><b/></test>"""
+expect="""1 (test) [None] 0 0
+1 (a) [None] 0 1
+3 (#text) [aaa] 0 2
+15 (a) [None] 0 1
+1 (b) [None] 1 1
+15 (test) [None] 0 0
+"""
+res = tst_reader(doc)
+if res != expect:
+ print "test12 failed"
+ print res
+ sys.exit(1)
+
+doc="""<test><p></p></test>"""
+expect="""1 (test) [None] 0 0
+1 (p) [None] 0 1
+15 (p) [None] 0 1
+15 (test) [None] 0 0
+"""
+res = tst_reader(doc)
+if res != expect:
+ print "test13 failed"
+ print res
+ sys.exit(1)
+
+doc="""<p></p>"""
+expect="""1 (p) [None] 0 0
+15 (p) [None] 0 0
+"""
+res = tst_reader(doc)
+if res != expect:
+ print "test14 failed"
+ print res
+ sys.exit(1)
+
+#
+# test from bug #108801
+#
+doc="""<?xml version="1.0" standalone="no"?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
+]>
+
+<article>
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+</article>
+"""
+expect="""10 (article) [None] 0 0
+1 (article) [None] 0 0
+3 (#text) [
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+] 0 1
+15 (article) [None] 0 0
+"""
+res = tst_reader(doc)
+if res != expect:
+ print "test15 failed"
+ print res
+ sys.exit(1)
+
+#
+# cleanup for memory allocation counting
+#
+del f
+del input
+del reader
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/reader2.py b/python/tests/reader2.py
new file mode 100755
index 0000000..ea890ec
--- /dev/null
+++ b/python/tests/reader2.py
@@ -0,0 +1,256 @@
+#!/usr/bin/python -u
+#
+# this tests the DTD validation with the XmlTextReader interface
+#
+import sys
+import glob
+import string
+import StringIO
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+err=""
+expect="""../../test/valid/rss.xml:177: element rss: validity error : Element rss does not carry attribute version
+</rss>
+ ^
+../../test/valid/xlink.xml:450: element termdef: validity error : ID dt-arc already defined
+ <p><termdef id="dt-arc" term="Arc">An <ter
+ ^
+../../test/valid/xlink.xml:530: validity error : attribute def line 199 references an unknown ID "dt-xlg"
+
+^
+"""
+def callback(ctx, str):
+ global err
+ err = err + "%s" % (str)
+libxml2.registerErrorHandler(callback, "")
+
+valid_files = glob.glob("../../test/valid/*.x*")
+valid_files.sort()
+for file in valid_files:
+ if string.find(file, "t8") != -1:
+ continue
+ reader = libxml2.newTextReaderFilename(file)
+ #print "%s:" % (file)
+ reader.SetParserProp(libxml2.PARSER_VALIDATE, 1)
+ ret = reader.Read()
+ while ret == 1:
+ ret = reader.Read()
+ if ret != 0:
+ print "Error parsing and validating %s" % (file)
+ #sys.exit(1)
+
+if err != expect:
+ print err
+
+#
+# another separate test based on Stephane Bidoul one
+#
+s = """
+<!DOCTYPE test [
+<!ELEMENT test (x,b)>
+<!ELEMENT x (c)>
+<!ELEMENT b (#PCDATA)>
+<!ELEMENT c (#PCDATA)>
+<!ENTITY x "<x><c>xxx</c></x>">
+]>
+<test>
+ &x;
+ <b>bbb</b>
+</test>
+"""
+expect="""10,test
+1,test
+14,#text
+1,x
+1,c
+3,#text
+15,c
+15,x
+14,#text
+1,b
+3,#text
+15,b
+14,#text
+15,test
+"""
+res=""
+err=""
+
+input = libxml2.inputBuffer(StringIO.StringIO(s))
+reader = input.newTextReader("test2")
+reader.SetParserProp(libxml2.PARSER_LOADDTD,1)
+reader.SetParserProp(libxml2.PARSER_DEFAULTATTRS,1)
+reader.SetParserProp(libxml2.PARSER_SUBST_ENTITIES,1)
+reader.SetParserProp(libxml2.PARSER_VALIDATE,1)
+while reader.Read() == 1:
+ res = res + "%s,%s\n" % (reader.NodeType(),reader.Name())
+
+if res != expect:
+ print "test2 failed: unexpected output"
+ print res
+ sys.exit(1)
+if err != "":
+ print "test2 failed: validation error found"
+ print err
+ sys.exit(1)
+
+#
+# Another test for external entity parsing and validation
+#
+
+s = """<!DOCTYPE test [
+<!ELEMENT test (x)>
+<!ELEMENT x (#PCDATA)>
+<!ENTITY e SYSTEM "tst.ent">
+]>
+<test>
+ &e;
+</test>
+"""
+tst_ent = """<x>hello</x>"""
+expect="""10 test
+1 test
+14 #text
+1 x
+3 #text
+15 x
+14 #text
+15 test
+"""
+res=""
+
+def myResolver(URL, ID, ctxt):
+ if URL == "tst.ent":
+ return(StringIO.StringIO(tst_ent))
+ return None
+
+libxml2.setEntityLoader(myResolver)
+
+input = libxml2.inputBuffer(StringIO.StringIO(s))
+reader = input.newTextReader("test3")
+reader.SetParserProp(libxml2.PARSER_LOADDTD,1)
+reader.SetParserProp(libxml2.PARSER_DEFAULTATTRS,1)
+reader.SetParserProp(libxml2.PARSER_SUBST_ENTITIES,1)
+reader.SetParserProp(libxml2.PARSER_VALIDATE,1)
+while reader.Read() == 1:
+ res = res + "%s %s\n" % (reader.NodeType(),reader.Name())
+
+if res != expect:
+ print "test3 failed: unexpected output"
+ print res
+ sys.exit(1)
+if err != "":
+ print "test3 failed: validation error found"
+ print err
+ sys.exit(1)
+
+#
+# Another test for recursive entity parsing, validation, and replacement of
+# entities, making sure the entity ref node doesn't show up in that case
+#
+
+s = """<!DOCTYPE test [
+<!ELEMENT test (x, x)>
+<!ELEMENT x (y)>
+<!ELEMENT y (#PCDATA)>
+<!ENTITY x "<x>&y;</x>">
+<!ENTITY y "<y>yyy</y>">
+]>
+<test>
+ &x;
+ &x;
+</test>"""
+expect="""10 test 0
+1 test 0
+14 #text 1
+1 x 1
+1 y 2
+3 #text 3
+15 y 2
+15 x 1
+14 #text 1
+1 x 1
+1 y 2
+3 #text 3
+15 y 2
+15 x 1
+14 #text 1
+15 test 0
+"""
+res=""
+err=""
+
+input = libxml2.inputBuffer(StringIO.StringIO(s))
+reader = input.newTextReader("test4")
+reader.SetParserProp(libxml2.PARSER_LOADDTD,1)
+reader.SetParserProp(libxml2.PARSER_DEFAULTATTRS,1)
+reader.SetParserProp(libxml2.PARSER_SUBST_ENTITIES,1)
+reader.SetParserProp(libxml2.PARSER_VALIDATE,1)
+while reader.Read() == 1:
+ res = res + "%s %s %d\n" % (reader.NodeType(),reader.Name(),reader.Depth())
+
+if res != expect:
+ print "test4 failed: unexpected output"
+ print res
+ sys.exit(1)
+if err != "":
+ print "test4 failed: validation error found"
+ print err
+ sys.exit(1)
+
+#
+# The same test but without entity substitution this time
+#
+
+s = """<!DOCTYPE test [
+<!ELEMENT test (x, x)>
+<!ELEMENT x (y)>
+<!ELEMENT y (#PCDATA)>
+<!ENTITY x "<x>&y;</x>">
+<!ENTITY y "<y>yyy</y>">
+]>
+<test>
+ &x;
+ &x;
+</test>"""
+expect="""10 test 0
+1 test 0
+14 #text 1
+5 x 1
+14 #text 1
+5 x 1
+14 #text 1
+15 test 0
+"""
+res=""
+err=""
+
+input = libxml2.inputBuffer(StringIO.StringIO(s))
+reader = input.newTextReader("test5")
+reader.SetParserProp(libxml2.PARSER_VALIDATE,1)
+while reader.Read() == 1:
+ res = res + "%s %s %d\n" % (reader.NodeType(),reader.Name(),reader.Depth())
+
+if res != expect:
+ print "test5 failed: unexpected output"
+ print res
+if err != "":
+ print "test5 failed: validation error found"
+ print err
+
+#
+# cleanup
+#
+del input
+del reader
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/reader3.py b/python/tests/reader3.py
new file mode 100755
index 0000000..2458c89
--- /dev/null
+++ b/python/tests/reader3.py
@@ -0,0 +1,155 @@
+#!/usr/bin/python -u
+#
+# this tests the entities substitutions with the XmlTextReader interface
+#
+import sys
+import StringIO
+import libxml2
+
+docstr="""<?xml version='1.0'?>
+<!DOCTYPE doc [
+<!ENTITY tst "<p>test</p>">
+]>
+<doc>&tst;</doc>"""
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+#
+# First test, normal don't substitute entities.
+#
+f = StringIO.StringIO(docstr)
+input = libxml2.inputBuffer(f)
+reader = input.newTextReader("test_noent")
+ret = reader.Read()
+if ret != 1:
+ print "Error reading to root"
+ sys.exit(1)
+if reader.Name() == "doc" or reader.NodeType() == 10:
+ ret = reader.Read()
+if ret != 1:
+ print "Error reading to root"
+ sys.exit(1)
+if reader.Name() != "doc" or reader.NodeType() != 1:
+ print "test_normal: Error reading the root element"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 1:
+ print "test_normal: Error reading to the entity"
+ sys.exit(1)
+if reader.Name() != "tst" or reader.NodeType() != 5:
+ print "test_normal: Error reading the entity"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 1:
+ print "test_normal: Error reading to the end of root"
+ sys.exit(1)
+if reader.Name() != "doc" or reader.NodeType() != 15:
+ print "test_normal: Error reading the end of the root element"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 0:
+ print "test_normal: Error detecting the end"
+ sys.exit(1)
+
+#
+# Second test, completely substitute the entities.
+#
+f = StringIO.StringIO(docstr)
+input = libxml2.inputBuffer(f)
+reader = input.newTextReader("test_noent")
+reader.SetParserProp(libxml2.PARSER_SUBST_ENTITIES, 1)
+ret = reader.Read()
+if ret != 1:
+ print "Error reading to root"
+ sys.exit(1)
+if reader.Name() == "doc" or reader.NodeType() == 10:
+ ret = reader.Read()
+if ret != 1:
+ print "Error reading to root"
+ sys.exit(1)
+if reader.Name() != "doc" or reader.NodeType() != 1:
+ print "test_noent: Error reading the root element"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 1:
+ print "test_noent: Error reading to the entity content"
+ sys.exit(1)
+if reader.Name() != "p" or reader.NodeType() != 1:
+ print "test_noent: Error reading the p element from entity"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 1:
+ print "test_noent: Error reading to the text node"
+ sys.exit(1)
+if reader.NodeType() != 3 or reader.Value() != "test":
+ print "test_noent: Error reading the text node"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 1:
+ print "test_noent: Error reading to the end of p element"
+ sys.exit(1)
+if reader.Name() != "p" or reader.NodeType() != 15:
+ print "test_noent: Error reading the end of the p element"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 1:
+ print "test_noent: Error reading to the end of root"
+ sys.exit(1)
+if reader.Name() != "doc" or reader.NodeType() != 15:
+ print "test_noent: Error reading the end of the root element"
+ sys.exit(1)
+ret = reader.Read()
+if ret != 0:
+ print "test_noent: Error detecting the end"
+ sys.exit(1)
+
+#
+# third test, crazy stuff about empty element in external parsed entities
+#
+s = """<!DOCTYPE struct [
+<!ENTITY simplestruct2.ent SYSTEM "simplestruct2.ent">
+]>
+<struct>&simplestruct2.ent;</struct>
+"""
+expect="""10 struct 0 0
+1 struct 0 0
+1 descr 1 1
+15 struct 0 0
+"""
+res=""
+simplestruct2_ent="""<descr/>"""
+
+def myResolver(URL, ID, ctxt):
+ if URL == "simplestruct2.ent":
+ return(StringIO.StringIO(simplestruct2_ent))
+ return None
+
+libxml2.setEntityLoader(myResolver)
+
+input = libxml2.inputBuffer(StringIO.StringIO(s))
+reader = input.newTextReader("test3")
+reader.SetParserProp(libxml2.PARSER_SUBST_ENTITIES,1)
+while reader.Read() == 1:
+ res = res + "%s %s %d %d\n" % (reader.NodeType(),reader.Name(),
+ reader.Depth(),reader.IsEmptyElement())
+
+if res != expect:
+ print "test3 failed: unexpected output"
+ print res
+ sys.exit(1)
+
+#
+# cleanup
+#
+del f
+del input
+del reader
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/reader4.py b/python/tests/reader4.py
new file mode 100755
index 0000000..0824929
--- /dev/null
+++ b/python/tests/reader4.py
@@ -0,0 +1,45 @@
+#!/usr/bin/python -u
+#
+# this tests the basic APIs of the XmlTextReader interface
+#
+import libxml2
+import StringIO
+import sys
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+def tst_reader(s):
+ f = StringIO.StringIO(s)
+ input = libxml2.inputBuffer(f)
+ reader = input.newTextReader("tst")
+ res = ""
+ while reader.Read():
+ res=res + "%s (%s) [%s] %d\n" % (reader.NodeType(),reader.Name(),
+ reader.Value(), reader.IsEmptyElement())
+ if reader.NodeType() == 1: # Element
+ while reader.MoveToNextAttribute():
+ res = res + "-- %s (%s) [%s]\n" % (reader.NodeType(),
+ reader.Name(),reader.Value())
+ return res
+
+expect="""1 (test) [None] 0
+1 (b) [None] 1
+1 (c) [None] 1
+15 (test) [None] 0
+"""
+
+res = tst_reader("""<test><b/><c/></test>""")
+
+if res != expect:
+ print "Did not get the expected error message:"
+ print res
+ sys.exit(1)
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/reader5.py b/python/tests/reader5.py
new file mode 100755
index 0000000..fcbad61
--- /dev/null
+++ b/python/tests/reader5.py
@@ -0,0 +1,48 @@
+#!/usr/bin/python -u
+#
+# this tests the Expand() API of the xmlTextReader interface
+# this extract the Dragon bibliography entries from the XML specification
+#
+import libxml2
+import StringIO
+import sys
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+expect="""<bibl id="Aho" key="Aho/Ullman">Aho, Alfred V.,
+Ravi Sethi, and Jeffrey D. Ullman.
+<emph>Compilers: Principles, Techniques, and Tools</emph>.
+Reading: Addison-Wesley, 1986, rpt. corr. 1988.</bibl>"""
+
+f = open('../../test/valid/REC-xml-19980210.xml')
+input = libxml2.inputBuffer(f)
+reader = input.newTextReader("REC")
+res=""
+while reader.Read():
+ while reader.Name() == 'bibl':
+ node = reader.Expand() # expand the subtree
+ if node.xpathEval("@id = 'Aho'"): # use XPath on it
+ res = res + node.serialize()
+ if reader.Next() != 1: # skip the subtree
+ break;
+
+if res != expect:
+ print "Error: didn't get the expected output"
+ print "got '%s'" % (res)
+ print "expected '%s'" % (expect)
+
+
+#
+# cleanup
+#
+del input
+del reader
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/reader6.py b/python/tests/reader6.py
new file mode 100755
index 0000000..7a34601
--- /dev/null
+++ b/python/tests/reader6.py
@@ -0,0 +1,123 @@
+#!/usr/bin/python -u
+#
+# this tests the entities substitutions with the XmlTextReader interface
+#
+import sys
+import StringIO
+import libxml2
+
+schema="""<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <oneOrMore>
+ <element name="label">
+ <text/>
+ </element>
+ <optional>
+ <element name="opt">
+ <empty/>
+ </element>
+ </optional>
+ <element name="item">
+ <data type="byte"/>
+ </element>
+ </oneOrMore>
+</element>
+"""
+# Memory debug specific
+libxml2.debugMemory(1)
+
+#
+# Parse the Relax NG Schemas
+#
+rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
+rngs = rngp.relaxNGParse()
+del rngp
+
+#
+# Parse and validate the correct document
+#
+docstr="""<foo>
+<label>some text</label>
+<item>100</item>
+</foo>"""
+
+f = StringIO.StringIO(docstr)
+input = libxml2.inputBuffer(f)
+reader = input.newTextReader("correct")
+reader.RelaxNGSetSchema(rngs)
+ret = reader.Read()
+while ret == 1:
+ ret = reader.Read()
+
+if ret != 0:
+ print "Error parsing the document"
+ sys.exit(1)
+
+if reader.IsValid() != 1:
+ print "Document failed to validate"
+ sys.exit(1)
+
+#
+# Parse and validate the incorrect document
+#
+docstr="""<foo>
+<label>some text</label>
+<item>1000</item>
+</foo>"""
+
+err=""
+# RNG errors are not as good as before , TODO
+#expect="""RNG validity error: file error line 3 element text
+#Type byte doesn't allow value '1000'
+#RNG validity error: file error line 3 element text
+#Error validating datatype byte
+#RNG validity error: file error line 3 element text
+#Element item failed to validate content
+#"""
+expect="""Type byte doesn't allow value '1000'
+Error validating datatype byte
+Element item failed to validate content
+"""
+
+def callback(ctx, str):
+ global err
+ err = err + "%s" % (str)
+libxml2.registerErrorHandler(callback, "")
+
+f = StringIO.StringIO(docstr)
+input = libxml2.inputBuffer(f)
+reader = input.newTextReader("error")
+reader.RelaxNGSetSchema(rngs)
+ret = reader.Read()
+while ret == 1:
+ ret = reader.Read()
+
+if ret != 0:
+ print "Error parsing the document"
+ sys.exit(1)
+
+if reader.IsValid() != 0:
+ print "Document failed to detect the validation error"
+ sys.exit(1)
+
+if err != expect:
+ print "Did not get the expected error message:"
+ print err
+ sys.exit(1)
+
+#
+# cleanup
+#
+del f
+del input
+del reader
+del rngs
+libxml2.relaxNGCleanupTypes()
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/reader7.py b/python/tests/reader7.py
new file mode 100755
index 0000000..35a426f
--- /dev/null
+++ b/python/tests/reader7.py
@@ -0,0 +1,102 @@
+#!/usr/bin/python -u
+#
+# this tests the entities substitutions with the XmlTextReader interface
+#
+import sys
+import StringIO
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+result = ""
+def processNode(reader):
+ global result
+
+ result = result + "%d %d %s %d\n" % (reader.Depth(), reader.NodeType(),
+ reader.Name(), reader.IsEmptyElement())
+
+#
+# Parse a document testing the readerForxxx API
+#
+docstr="""<foo>
+<label>some text</label>
+<item>100</item>
+</foo>"""
+expect="""0 1 foo 0
+1 14 #text 0
+1 1 label 0
+2 3 #text 0
+1 15 label 0
+1 14 #text 0
+1 1 item 0
+2 3 #text 0
+1 15 item 0
+1 14 #text 0
+0 15 foo 0
+"""
+result = ""
+
+reader = libxml2.readerForDoc(docstr, "test1", None, 0)
+ret = reader.Read()
+while ret == 1:
+ processNode(reader)
+ ret = reader.Read()
+
+if ret != 0:
+ print "Error parsing the document test1"
+ sys.exit(1)
+
+if result != expect:
+ print "Unexpected result for test1"
+ print result
+ sys.exit(1)
+
+#
+# Reuse the reader for another document testing the ReaderNewxxx API
+#
+docstr="""<foo>
+<label>some text</label>
+<item>1000</item>
+</foo>"""
+expect="""0 1 foo 0
+1 14 #text 0
+1 1 label 0
+2 3 #text 0
+1 15 label 0
+1 14 #text 0
+1 1 item 0
+2 3 #text 0
+1 15 item 0
+1 14 #text 0
+0 15 foo 0
+"""
+result = ""
+
+reader.NewDoc(docstr, "test2", None, 0)
+ret = reader.Read()
+while ret == 1:
+ processNode(reader)
+ ret = reader.Read()
+
+if ret != 0:
+ print "Error parsing the document test2"
+ sys.exit(1)
+
+if result != expect:
+ print "Unexpected result for test2"
+ print result
+ sys.exit(1)
+
+#
+# cleanup
+#
+del reader
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/readererr.py b/python/tests/readererr.py
new file mode 100644
index 0000000..ab8eb18
--- /dev/null
+++ b/python/tests/readererr.py
@@ -0,0 +1,51 @@
+#!/usr/bin/python -u
+#
+# this tests the basic APIs of the XmlTextReader interface
+#
+import libxml2
+import StringIO
+import sys
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+expect="""--> (3) test1:1:xmlns: URI foo is not absolute
+--> (4) test1:1:Opening and ending tag mismatch: c line 0 and a
+"""
+err=""
+def myErrorHandler(arg,msg,severity,locator):
+ global err
+ err = err + "%s (%d) %s:%d:%s" % (arg,severity,locator.BaseURI(),locator.LineNumber(),msg)
+
+f = StringIO.StringIO("""<a xmlns="foo"><b b1="b1"/><c>content of c</a>""")
+input = libxml2.inputBuffer(f)
+reader = input.newTextReader("test1")
+reader.SetErrorHandler(myErrorHandler,"-->")
+while reader.Read() == 1:
+ pass
+
+if err != expect:
+ print "error"
+ print "received %s" %(err)
+ print "expected %s" %(expect)
+ sys.exit(1)
+
+reader.SetErrorHandler(None,None)
+if reader.GetErrorHandler() != (None,None):
+ print "GetErrorHandler failed"
+ sys.exit(1)
+
+#
+# cleanup for memory allocation counting
+#
+del f
+del input
+del reader
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/regexp.py b/python/tests/regexp.py
new file mode 100644
index 0000000..4c05502
--- /dev/null
+++ b/python/tests/regexp.py
@@ -0,0 +1,32 @@
+#!/usr/bin/python -u
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+re = libxml2.regexpCompile("a|b")
+if re.regexpExec("a") != 1:
+ print "error checking 'a'"
+ sys.exit(1)
+if re.regexpExec("b") != 1:
+ print "error checking 'b'"
+ sys.exit(1)
+if re.regexpExec("ab") != 0:
+ print "error checking 'ab'"
+ sys.exit(1)
+if re.regexpExec("") != 0:
+ print "error checking 'ab'"
+ sys.exit(1)
+if re.regexpIsDeterminist() != 1:
+ print "error checking determinism"
+ sys.exit(1)
+del re
+
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/relaxng.py b/python/tests/relaxng.py
new file mode 100755
index 0000000..2c83635
--- /dev/null
+++ b/python/tests/relaxng.py
@@ -0,0 +1,48 @@
+#!/usr/bin/python -u
+import libxml2
+import sys
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+schema="""<?xml version="1.0"?>
+<element name="foo"
+ xmlns="http://relaxng.org/ns/structure/1.0"
+ xmlns:a="http://relaxng.org/ns/annotation/1.0"
+ xmlns:ex1="http://www.example.com/n1"
+ xmlns:ex2="http://www.example.com/n2">
+ <a:documentation>A foo element.</a:documentation>
+ <element name="ex1:bar1">
+ <empty/>
+ </element>
+ <element name="ex2:bar2">
+ <empty/>
+ </element>
+</element>
+"""
+instance="""<?xml version="1.0"?>
+<foo><pre1:bar1 xmlns:pre1="http://www.example.com/n1"/><pre2:bar2 xmlns:pre2="http://www.example.com/n2"/></foo>"""
+
+rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
+rngs = rngp.relaxNGParse()
+ctxt = rngs.relaxNGNewValidCtxt()
+doc = libxml2.parseDoc(instance)
+ret = doc.relaxNGValidateDoc(ctxt)
+if ret != 0:
+ print "error doing RelaxNG validation"
+ sys.exit(1)
+
+doc.freeDoc()
+del rngp
+del rngs
+del ctxt
+libxml2.relaxNGCleanupTypes()
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
+
diff --git a/python/tests/resolver.py b/python/tests/resolver.py
new file mode 100755
index 0000000..9f4a478
--- /dev/null
+++ b/python/tests/resolver.py
@@ -0,0 +1,39 @@
+#!/usr/bin/python -u
+import sys
+import libxml2
+import StringIO
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+def myResolver(URL, ID, ctxt):
+ return(StringIO.StringIO("<foo/>"))
+
+libxml2.setEntityLoader(myResolver)
+
+doc = libxml2.parseFile("doesnotexist.xml")
+root = doc.children
+if root.name != "foo":
+ print "root element name error"
+ sys.exit(1)
+doc.freeDoc()
+
+i = 0
+while i < 5000:
+ doc = libxml2.parseFile("doesnotexist.xml")
+ root = doc.children
+ if root.name != "foo":
+ print "root element name error"
+ sys.exit(1)
+ doc.freeDoc()
+ i = i + 1
+
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
+
diff --git a/python/tests/serialize.py b/python/tests/serialize.py
new file mode 100755
index 0000000..5b969a9
--- /dev/null
+++ b/python/tests/serialize.py
@@ -0,0 +1,150 @@
+#!/usr/bin/python -u
+import sys
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+#
+# Testing XML document serialization
+#
+doc = libxml2.parseDoc("""<root><foo>hello</foo></root>""")
+str = doc.serialize()
+if str != """<?xml version="1.0"?>
+<root><foo>hello</foo></root>
+""":
+ print "error serializing XML document 1"
+ sys.exit(1)
+str = doc.serialize("iso-8859-1")
+if str != """<?xml version="1.0" encoding="iso-8859-1"?>
+<root><foo>hello</foo></root>
+""":
+ print "error serializing XML document 2"
+ sys.exit(1)
+str = doc.serialize(format=1)
+if str != """<?xml version="1.0"?>
+<root>
+ <foo>hello</foo>
+</root>
+""":
+ print "error serializing XML document 3"
+ sys.exit(1)
+str = doc.serialize("iso-8859-1", 1)
+if str != """<?xml version="1.0" encoding="iso-8859-1"?>
+<root>
+ <foo>hello</foo>
+</root>
+""":
+ print "error serializing XML document 4"
+ sys.exit(1)
+
+#
+# Test serializing a subnode
+#
+root = doc.getRootElement()
+str = root.serialize()
+if str != """<root><foo>hello</foo></root>""":
+ print "error serializing XML root 1"
+ sys.exit(1)
+str = root.serialize("iso-8859-1")
+if str != """<root><foo>hello</foo></root>""":
+ print "error serializing XML root 2"
+ sys.exit(1)
+str = root.serialize(format=1)
+if str != """<root>
+ <foo>hello</foo>
+</root>""":
+ print "error serializing XML root 3"
+ sys.exit(1)
+str = root.serialize("iso-8859-1", 1)
+if str != """<root>
+ <foo>hello</foo>
+</root>""":
+ print "error serializing XML root 4"
+ sys.exit(1)
+doc.freeDoc()
+
+#
+# Testing HTML document serialization
+#
+doc = libxml2.htmlParseDoc("""<html><head><title>Hello</title><body><p>hello</body></html>""", None)
+str = doc.serialize()
+if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<html><head><title>Hello</title></head><body><p>hello</p></body></html>
+""":
+ print "error serializing HTML document 1"
+ sys.exit(1)
+str = doc.serialize("ISO-8859-1")
+if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Hello</title></head><body><p>hello</p></body></html>
+""":
+ print "error serializing HTML document 2"
+ sys.exit(1)
+str = doc.serialize(format=1)
+if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Hello</title>
+</head>
+<body><p>hello</p></body>
+</html>
+""":
+ print "error serializing HTML document 3"
+ sys.exit(1)
+str = doc.serialize("iso-8859-1", 1)
+if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<title>Hello</title>
+</head>
+<body><p>hello</p></body>
+</html>
+""":
+ print "error serializing HTML document 4"
+ sys.exit(1)
+
+#
+# Test serializing a subnode
+#
+doc.htmlSetMetaEncoding(None)
+root = doc.getRootElement()
+str = root.serialize()
+if str != """<html><head><title>Hello</title></head><body><p>hello</p></body></html>""":
+ print "error serializing HTML root 1"
+ sys.exit(1)
+str = root.serialize("ISO-8859-1")
+if str != """<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Hello</title></head><body><p>hello</p></body></html>""":
+ print "error serializing HTML root 2"
+ sys.exit(1)
+str = root.serialize(format=1)
+if str != """<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Hello</title>
+</head>
+<body><p>hello</p></body>
+</html>""":
+ print "error serializing HTML root 3"
+ sys.exit(1)
+str = root.serialize("iso-8859-1", 1)
+if str != """<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<title>Hello</title>
+</head>
+<body><p>hello</p></body>
+</html>""":
+ print "error serializing HTML root 4"
+ sys.exit(1)
+
+doc.freeDoc()
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/thread2.py b/python/tests/thread2.py
new file mode 100755
index 0000000..c8ac5ed
--- /dev/null
+++ b/python/tests/thread2.py
@@ -0,0 +1,96 @@
+#!/usr/bin/python -u
+import string, sys, time
+import thread
+from threading import Thread, Lock
+
+import libxml2
+
+THREADS_COUNT = 15
+
+failed = 0
+
+class ErrorHandler:
+
+ def __init__(self):
+ self.errors = []
+ self.lock = Lock()
+
+ def handler(self,ctx,str):
+ self.lock.acquire()
+ self.errors.append(str)
+ self.lock.release()
+
+def getLineNumbersDefault():
+ old = libxml2.lineNumbersDefault(0)
+ libxml2.lineNumbersDefault(old)
+ return old
+
+def test(expectedLineNumbersDefault):
+ time.sleep(1)
+ global failed
+ # check a per thread-global
+ if expectedLineNumbersDefault != getLineNumbersDefault():
+ failed = 1
+ print "FAILED to obtain correct value for " \
+ "lineNumbersDefault in thread %d" % thread.get_ident()
+ # check ther global error handler
+ # (which is NOT per-thread in the python bindings)
+ try:
+ doc = libxml2.parseFile("bad.xml")
+ except:
+ pass
+ else:
+ assert "failed"
+
+# global error handler
+eh = ErrorHandler()
+libxml2.registerErrorHandler(eh.handler,"")
+
+# set on the main thread only
+libxml2.lineNumbersDefault(1)
+test(1)
+ec = len(eh.errors)
+if ec == 0:
+ print "FAILED: should have obtained errors"
+ sys.exit(1)
+
+ts = []
+for i in range(THREADS_COUNT):
+ # expect 0 for lineNumbersDefault because
+ # the new value has been set on the main thread only
+ ts.append(Thread(target=test,args=(0,)))
+for t in ts:
+ t.start()
+for t in ts:
+ t.join()
+
+if len(eh.errors) != ec+THREADS_COUNT*ec:
+ print "FAILED: did not obtain the correct number of errors"
+ sys.exit(1)
+
+# set lineNumbersDefault for future new threads
+libxml2.thrDefLineNumbersDefaultValue(1)
+ts = []
+for i in range(THREADS_COUNT):
+ # expect 1 for lineNumbersDefault
+ ts.append(Thread(target=test,args=(1,)))
+for t in ts:
+ t.start()
+for t in ts:
+ t.join()
+
+if len(eh.errors) != ec+THREADS_COUNT*ec*2:
+ print "FAILED: did not obtain the correct number of errors"
+ sys.exit(1)
+
+if failed:
+ print "FAILED"
+ sys.exit(1)
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/tst.py b/python/tests/tst.py
new file mode 100755
index 0000000..9540cda
--- /dev/null
+++ b/python/tests/tst.py
@@ -0,0 +1,28 @@
+#!/usr/bin/python -u
+import sys
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+doc = libxml2.parseFile("tst.xml")
+if doc.name != "tst.xml":
+ print "doc.name failed"
+ sys.exit(1)
+root = doc.children
+if root.name != "doc":
+ print "root.name failed"
+ sys.exit(1)
+child = root.children
+if child.name != "foo":
+ print "child.name failed"
+ sys.exit(1)
+doc.freeDoc()
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/tst.xml b/python/tests/tst.xml
new file mode 100644
index 0000000..751d46d
--- /dev/null
+++ b/python/tests/tst.xml
@@ -0,0 +1 @@
+<doc><foo>bar</foo></doc>
diff --git a/python/tests/tstLastError.py b/python/tests/tstLastError.py
new file mode 100755
index 0000000..83e98b8
--- /dev/null
+++ b/python/tests/tstLastError.py
@@ -0,0 +1,72 @@
+#!/usr/bin/python -u
+import sys, unittest
+
+import libxml2
+
+class TestCase(unittest.TestCase):
+
+ def setUp(self):
+ libxml2.debugMemory(1)
+
+ def tearDown(self):
+ libxml2.cleanupParser()
+ if libxml2.debugMemory(1) != 0:
+ libxml2.dumpMemory()
+ self.fail("Memory leak %d bytes" % (libxml2.debugMemory(1),))
+
+ def failUnlessXmlError(self,f,args,exc,domain,code,message,level,file,line):
+ """Run function f, with arguments args and expect an exception exc;
+ when the exception is raised, check the libxml2.lastError for
+ expected values."""
+ # disable the default error handler
+ libxml2.registerErrorHandler(None,None)
+ try:
+ f(*args)
+ except exc:
+ e = libxml2.lastError()
+ if e is None:
+ self.fail("lastError not set")
+ if 0:
+ print "domain = ",e.domain()
+ print "code = ",e.code()
+ print "message =",repr(e.message())
+ print "level =",e.level()
+ print "file =",e.file()
+ print "line =",e.line()
+ print
+ self.failUnlessEqual(domain,e.domain())
+ self.failUnlessEqual(code,e.code())
+ self.failUnlessEqual(message,e.message())
+ self.failUnlessEqual(level,e.level())
+ self.failUnlessEqual(file,e.file())
+ self.failUnlessEqual(line,e.line())
+ else:
+ self.fail("exception %s should have been raised" % exc)
+
+ def test1(self):
+ """Test readFile with a file that does not exist"""
+ self.failUnlessXmlError(libxml2.readFile,
+ ("dummy.xml",None,0),
+ libxml2.treeError,
+ domain=libxml2.XML_FROM_IO,
+ code=libxml2.XML_IO_LOAD_ERROR,
+ message='failed to load external entity "dummy.xml"\n',
+ level=libxml2.XML_ERR_WARNING,
+ file=None,
+ line=0)
+
+ def test2(self):
+ """Test a well-formedness error: we get the last error only"""
+ s = "<x>\n<a>\n</x>"
+ self.failUnlessXmlError(libxml2.readMemory,
+ (s,len(s),"dummy.xml",None,0),
+ libxml2.treeError,
+ domain=libxml2.XML_FROM_PARSER,
+ code=libxml2.XML_ERR_TAG_NOT_FINISHED,
+ message='Premature end of data in tag x line 1\n',
+ level=libxml2.XML_ERR_FATAL,
+ file='dummy.xml',
+ line=3)
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/python/tests/tstURI.py b/python/tests/tstURI.py
new file mode 100755
index 0000000..58b7ad8
--- /dev/null
+++ b/python/tests/tstURI.py
@@ -0,0 +1,41 @@
+#!/usr/bin/python -u
+import sys
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+uri = libxml2.parseURI("http://example.org:8088/foo/bar?query=simple#fragid")
+if uri.scheme() != 'http':
+ print "Error parsing URI: wrong scheme"
+ sys.exit(1)
+if uri.server() != 'example.org':
+ print "Error parsing URI: wrong server"
+ sys.exit(1)
+if uri.port() != 8088:
+ print "Error parsing URI: wrong port"
+ sys.exit(1)
+if uri.path() != '/foo/bar':
+ print "Error parsing URI: wrong path"
+ sys.exit(1)
+if uri.query() != 'query=simple':
+ print "Error parsing URI: wrong query"
+ sys.exit(1)
+if uri.fragment() != 'fragid':
+ print "Error parsing URI: wrong query"
+ sys.exit(1)
+uri.setScheme("https")
+uri.setPort(223)
+uri.setFragment(None)
+result=uri.saveUri()
+if result != "https://example.org:223/foo/bar?query=simple":
+ print "Error modifying or saving the URI"
+uri = None
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/tstxpath.py b/python/tests/tstxpath.py
new file mode 100755
index 0000000..e47c34d
--- /dev/null
+++ b/python/tests/tstxpath.py
@@ -0,0 +1,63 @@
+#!/usr/bin/python -u
+import sys
+import libxml2
+
+#memory debug specific
+libxml2.debugMemory(1)
+
+called = ""
+
+def foo(ctx, x):
+ global called
+
+ #
+ # test that access to the XPath evaluation contexts
+ #
+ pctxt = libxml2.xpathParserContext(_obj=ctx)
+ ctxt = pctxt.context()
+ called = ctxt.function()
+ return x + 1
+
+def bar(ctxt, x):
+ return "%d" % (x + 2)
+
+doc = libxml2.parseFile("tst.xml")
+ctxt = doc.xpathNewContext()
+res = ctxt.xpathEval("//*")
+if len(res) != 2:
+ print "xpath query: wrong node set size"
+ sys.exit(1)
+if res[0].name != "doc" or res[1].name != "foo":
+ print "xpath query: wrong node set value"
+ sys.exit(1)
+libxml2.registerXPathFunction(ctxt._o, "foo", None, foo)
+libxml2.registerXPathFunction(ctxt._o, "bar", None, bar)
+i = 10000
+while i > 0:
+ res = ctxt.xpathEval("foo(1)")
+ if res != 2:
+ print "xpath extension failure"
+ sys.exit(1)
+ i = i - 1
+i = 10000
+while i > 0:
+ res = ctxt.xpathEval("bar(1)")
+ if res != "3":
+ print "xpath extension failure got %s expecting '3'"
+ sys.exit(1)
+ i = i - 1
+doc.freeDoc()
+ctxt.xpathFreeContext()
+
+if called != "foo":
+ print "xpath function: failed to access the context"
+ print "xpath function: %s" % (called)
+ sys.exit(1)
+
+#memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/valid.xml b/python/tests/valid.xml
new file mode 100644
index 0000000..8a7f679
--- /dev/null
+++ b/python/tests/valid.xml
@@ -0,0 +1,4 @@
+<!DOCTYPE doc [
+<!ELEMENT doc EMPTY>
+]>
+<doc/>
diff --git a/python/tests/validate.py b/python/tests/validate.py
new file mode 100755
index 0000000..0dc86f4
--- /dev/null
+++ b/python/tests/validate.py
@@ -0,0 +1,82 @@
+#!/usr/bin/python -u
+import sys
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+ctxt = libxml2.createFileParserCtxt("valid.xml")
+ctxt.validate(1)
+ctxt.parseDocument()
+doc = ctxt.doc()
+valid = ctxt.isValid()
+
+if doc.name != "valid.xml":
+ print "doc.name failed"
+ sys.exit(1)
+root = doc.children
+if root.name != "doc":
+ print "root.name failed"
+ sys.exit(1)
+if valid != 1:
+ print "validity chec failed"
+ sys.exit(1)
+doc.freeDoc()
+
+i = 1000
+while i > 0:
+ ctxt = libxml2.createFileParserCtxt("valid.xml")
+ ctxt.validate(1)
+ ctxt.parseDocument()
+ doc = ctxt.doc()
+ valid = ctxt.isValid()
+ doc.freeDoc()
+ if valid != 1:
+ print "validity check failed"
+ sys.exit(1)
+ i = i - 1
+
+#desactivate error messages from the validation
+def noerr(ctx, str):
+ pass
+
+libxml2.registerErrorHandler(noerr, None)
+
+ctxt = libxml2.createFileParserCtxt("invalid.xml")
+ctxt.validate(1)
+ctxt.parseDocument()
+doc = ctxt.doc()
+valid = ctxt.isValid()
+if doc.name != "invalid.xml":
+ print "doc.name failed"
+ sys.exit(1)
+root = doc.children
+if root.name != "doc":
+ print "root.name failed"
+ sys.exit(1)
+if valid != 0:
+ print "validity chec failed"
+ sys.exit(1)
+doc.freeDoc()
+
+i = 1000
+while i > 0:
+ ctxt = libxml2.createFileParserCtxt("invalid.xml")
+ ctxt.validate(1)
+ ctxt.parseDocument()
+ doc = ctxt.doc()
+ valid = ctxt.isValid()
+ doc.freeDoc()
+ if valid != 0:
+ print "validity check failed"
+ sys.exit(1)
+ i = i - 1
+del ctxt
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/walker.py b/python/tests/walker.py
new file mode 100755
index 0000000..3b5a62a
--- /dev/null
+++ b/python/tests/walker.py
@@ -0,0 +1,145 @@
+#!/usr/bin/python -u
+#
+# this tests the entities substitutions with the XmlTextReader interface
+#
+import sys
+import StringIO
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+result = ""
+def processNode(reader):
+ global result
+
+ result = result + "%d %d %s %d\n" % (reader.Depth(), reader.NodeType(),
+ reader.Name(), reader.IsEmptyElement())
+
+#
+# Parse a document testing the readerForxxx API
+#
+docstr="""<foo>
+<label>some text</label>
+<item>100</item>
+</foo>"""
+expect="""0 1 foo 0
+1 14 #text 0
+1 1 label 0
+2 3 #text 0
+1 15 label 0
+1 14 #text 0
+1 1 item 0
+2 3 #text 0
+1 15 item 0
+1 14 #text 0
+0 15 foo 0
+"""
+result = ""
+
+doc = libxml2.parseDoc(docstr)
+reader = doc.readerWalker();
+ret = reader.Read()
+while ret == 1:
+ processNode(reader)
+ ret = reader.Read()
+
+if ret != 0:
+ print "Error parsing the document test1"
+ sys.exit(1)
+
+if result != expect:
+ print "Unexpected result for test1"
+ print result
+ sys.exit(1)
+
+doc.freeDoc()
+
+#
+# Reuse the reader for another document testing the ReaderNewWalker API
+#
+docstr="""<foo>
+<label>some text</label>
+<item>1000</item>
+</foo>"""
+expect="""0 1 foo 0
+1 14 #text 0
+1 1 label 0
+2 3 #text 0
+1 15 label 0
+1 14 #text 0
+1 1 item 0
+2 3 #text 0
+1 15 item 0
+1 14 #text 0
+0 15 foo 0
+"""
+result = ""
+
+doc = libxml2.parseDoc(docstr)
+reader.NewWalker(doc)
+
+ret = reader.Read()
+while ret == 1:
+ processNode(reader)
+ ret = reader.Read()
+
+if ret != 0:
+ print "Error parsing the document test2"
+ sys.exit(1)
+
+if result != expect:
+ print "Unexpected result for test2"
+ print result
+ sys.exit(1)
+
+doc.freeDoc()
+
+#
+# Reuse the reader for another document testing the ReaderNewxxx API
+#
+docstr="""<foo>
+<label>some text</label>
+<item>1000</item>
+</foo>"""
+expect="""0 1 foo 0
+1 14 #text 0
+1 1 label 0
+2 3 #text 0
+1 15 label 0
+1 14 #text 0
+1 1 item 0
+2 3 #text 0
+1 15 item 0
+1 14 #text 0
+0 15 foo 0
+"""
+result = ""
+
+reader.NewDoc(docstr, "test3", None, 0)
+ret = reader.Read()
+while ret == 1:
+ processNode(reader)
+ ret = reader.Read()
+
+if ret != 0:
+ print "Error parsing the document test3"
+ sys.exit(1)
+
+if result != expect:
+ print "Unexpected result for test3"
+ print result
+ sys.exit(1)
+
+#
+# cleanup
+#
+del reader
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/xpath.py b/python/tests/xpath.py
new file mode 100755
index 0000000..2e036e1
--- /dev/null
+++ b/python/tests/xpath.py
@@ -0,0 +1,51 @@
+#!/usr/bin/python -u
+#
+# this test exercise the XPath basic engine, parser, etc, and
+# allows to detect memory leaks
+#
+import sys
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+doc = libxml2.parseFile("tst.xml")
+if doc.name != "tst.xml":
+ print "doc.name error"
+ sys.exit(1);
+
+ctxt = doc.xpathNewContext()
+res = ctxt.xpathEval("//*")
+if len(res) != 2:
+ print "xpath query: wrong node set size"
+ sys.exit(1)
+if res[0].name != "doc" or res[1].name != "foo":
+ print "xpath query: wrong node set value"
+ sys.exit(1)
+ctxt.setContextNode(res[0])
+res = ctxt.xpathEval("foo")
+if len(res) != 1:
+ print "xpath query: wrong node set size"
+ sys.exit(1)
+if res[0].name != "foo":
+ print "xpath query: wrong node set value"
+ sys.exit(1)
+doc.freeDoc()
+ctxt.xpathFreeContext()
+i = 1000
+while i > 0:
+ doc = libxml2.parseFile("tst.xml")
+ ctxt = doc.xpathNewContext()
+ res = ctxt.xpathEval("//*")
+ doc.freeDoc()
+ ctxt.xpathFreeContext()
+ i = i -1
+del ctxt
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/xpathext.py b/python/tests/xpathext.py
new file mode 100755
index 0000000..4769626
--- /dev/null
+++ b/python/tests/xpathext.py
@@ -0,0 +1,49 @@
+#!/usr/bin/python -u
+import sys
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+def foo(ctx, x):
+ return x + 1
+
+def bar(ctx, x):
+ return "%d" % (x + 2)
+
+doc = libxml2.parseFile("tst.xml")
+ctxt = doc.xpathNewContext()
+res = ctxt.xpathEval("//*")
+if len(res) != 2:
+ print "xpath query: wrong node set size"
+ sys.exit(1)
+if res[0].name != "doc" or res[1].name != "foo":
+ print "xpath query: wrong node set value"
+ sys.exit(1)
+
+libxml2.registerXPathFunction(ctxt._o, "foo", None, foo)
+libxml2.registerXPathFunction(ctxt._o, "bar", None, bar)
+i = 10000
+while i > 0:
+ res = ctxt.xpathEval("foo(1)")
+ if res != 2:
+ print "xpath extension failure"
+ sys.exit(1)
+ i = i - 1
+i = 10000
+while i > 0:
+ res = ctxt.xpathEval("bar(1)")
+ if res != "3":
+ print "xpath extension failure got %s expecting '3'"
+ sys.exit(1)
+ i = i - 1
+doc.freeDoc()
+ctxt.xpathFreeContext()
+
+# Memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/tests/xpathret.py b/python/tests/xpathret.py
new file mode 100755
index 0000000..2b5576a
--- /dev/null
+++ b/python/tests/xpathret.py
@@ -0,0 +1,57 @@
+#!/usr/bin/python -u
+import sys
+import libxml2
+
+#memory debug specific
+libxml2.debugMemory(1)
+
+#
+# A document hosting the nodes returned from the extension function
+#
+mydoc = libxml2.newDoc("1.0")
+
+def foo(ctx, str):
+ global mydoc
+
+ #
+ # test returning a node set works as expected
+ #
+ parent = mydoc.newDocNode(None, 'p', None)
+ mydoc.addChild(parent)
+ node = mydoc.newDocText(str)
+ parent.addChild(node)
+ return [parent]
+
+doc = libxml2.parseFile("tst.xml")
+ctxt = doc.xpathNewContext()
+libxml2.registerXPathFunction(ctxt._o, "foo", None, foo)
+res = ctxt.xpathEval("foo('hello')")
+if type(res) != type([]):
+ print "Failed to return a nodeset"
+ sys.exit(1)
+if len(res) != 1:
+ print "Unexpected nodeset size"
+ sys.exit(1)
+node = res[0]
+if node.name != 'p':
+ print "Unexpected nodeset element result"
+ sys.exit(1)
+node = node.children
+if node.type != 'text':
+ print "Unexpected nodeset element children type"
+ sys.exit(1)
+if node.content != 'hello':
+ print "Unexpected nodeset element children content"
+ sys.exit(1)
+
+doc.freeDoc()
+mydoc.freeDoc()
+ctxt.xpathFreeContext()
+
+#memory debug specific
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
diff --git a/python/types.c b/python/types.c
new file mode 100644
index 0000000..42279d0
--- /dev/null
+++ b/python/types.c
@@ -0,0 +1,661 @@
+/*
+ * types.c: converter functions between the internal representation
+ * and the Python objects
+ *
+ * See Copyright for the status of this software.
+ *
+ * daniel@veillard.com
+ */
+#include "libxml_wrap.h"
+
+PyObject *
+libxml_intWrap(int val)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_intWrap: val = %d\n", val);
+#endif
+ ret = PyInt_FromLong((long) val);
+ return (ret);
+}
+
+PyObject *
+libxml_longWrap(long val)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_longWrap: val = %ld\n", val);
+#endif
+ ret = PyInt_FromLong(val);
+ return (ret);
+}
+
+PyObject *
+libxml_doubleWrap(double val)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_doubleWrap: val = %f\n", val);
+#endif
+ ret = PyFloat_FromDouble((double) val);
+ return (ret);
+}
+
+PyObject *
+libxml_charPtrWrap(char *str)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlcharPtrWrap: str = %s\n", str);
+#endif
+ if (str == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ /* TODO: look at deallocation */
+ ret = PyString_FromString(str);
+ xmlFree(str);
+ return (ret);
+}
+
+PyObject *
+libxml_charPtrConstWrap(const char *str)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlcharPtrWrap: str = %s\n", str);
+#endif
+ if (str == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ /* TODO: look at deallocation */
+ ret = PyString_FromString(str);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlCharPtrWrap(xmlChar * str)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlCharPtrWrap: str = %s\n", str);
+#endif
+ if (str == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ /* TODO: look at deallocation */
+ ret = PyString_FromString((char *) str);
+ xmlFree(str);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlCharPtrConstWrap(const xmlChar * str)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlCharPtrWrap: str = %s\n", str);
+#endif
+ if (str == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ /* TODO: look at deallocation */
+ ret = PyString_FromString((char *) str);
+ return (ret);
+}
+
+PyObject *
+libxml_constcharPtrWrap(const char *str)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlcharPtrWrap: str = %s\n", str);
+#endif
+ if (str == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ /* TODO: look at deallocation */
+ ret = PyString_FromString(str);
+ return (ret);
+}
+
+PyObject *
+libxml_constxmlCharPtrWrap(const xmlChar * str)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlCharPtrWrap: str = %s\n", str);
+#endif
+ if (str == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ /* TODO: look at deallocation */
+ ret = PyString_FromString((char *) str);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlDocPtrWrap(xmlDocPtr doc)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlDocPtrWrap: doc = %p\n", doc);
+#endif
+ if (doc == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ /* TODO: look at deallocation */
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) doc, (char *) "xmlDocPtr",
+ NULL);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlNodePtrWrap(xmlNodePtr node)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlNodePtrWrap: node = %p\n", node);
+#endif
+ if (node == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "xmlNodePtr",
+ NULL);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlURIPtrWrap(xmlURIPtr uri)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlURIPtrWrap: uri = %p\n", uri);
+#endif
+ if (uri == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) uri, (char *) "xmlURIPtr",
+ NULL);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlNsPtrWrap(xmlNsPtr ns)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlNsPtrWrap: node = %p\n", ns);
+#endif
+ if (ns == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) ns, (char *) "xmlNsPtr",
+ NULL);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlAttrPtrWrap(xmlAttrPtr attr)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlAttrNodePtrWrap: attr = %p\n", attr);
+#endif
+ if (attr == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) attr, (char *) "xmlAttrPtr",
+ NULL);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlAttributePtrWrap(xmlAttributePtr attr)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlAttributePtrWrap: attr = %p\n", attr);
+#endif
+ if (attr == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) attr,
+ (char *) "xmlAttributePtr", NULL);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlElementPtrWrap(xmlElementPtr elem)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlElementNodePtrWrap: elem = %p\n", elem);
+#endif
+ if (elem == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) elem,
+ (char *) "xmlElementPtr", NULL);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlXPathContextPtrWrap(xmlXPathContextPtr ctxt)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlXPathContextPtrWrap: ctxt = %p\n", ctxt);
+#endif
+ if (ctxt == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) ctxt,
+ (char *) "xmlXPathContextPtr", NULL);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlXPathParserContextPtrWrap(xmlXPathParserContextPtr ctxt)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlXPathParserContextPtrWrap: ctxt = %p\n", ctxt);
+#endif
+ if (ctxt == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret = PyCObject_FromVoidPtrAndDesc((void *) ctxt,
+ (char *) "xmlXPathParserContextPtr",
+ NULL);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlParserCtxtPtrWrap(xmlParserCtxtPtr ctxt)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlParserCtxtPtrWrap: ctxt = %p\n", ctxt);
+#endif
+ if (ctxt == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) ctxt,
+ (char *) "xmlParserCtxtPtr", NULL);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlXPathObjectPtrWrap: ctxt = %p\n", obj);
+#endif
+ if (obj == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ switch (obj->type) {
+ case XPATH_XSLT_TREE: {
+ if ((obj->nodesetval == NULL) ||
+ (obj->nodesetval->nodeNr == 0) ||
+ (obj->nodesetval->nodeTab == NULL)) {
+ ret = PyList_New(0);
+ } else {
+ int i, len = 0;
+ xmlNodePtr node;
+
+ node = obj->nodesetval->nodeTab[0]->children;
+ while (node != NULL) {
+ len++;
+ node = node->next;
+ }
+ ret = PyList_New(len);
+ node = obj->nodesetval->nodeTab[0]->children;
+ for (i = 0;i < len;i++) {
+ PyList_SetItem(ret, i, libxml_xmlNodePtrWrap(node));
+ node = node->next;
+ }
+ }
+ /*
+ * Return now, do not free the object passed down
+ */
+ return (ret);
+ }
+ case XPATH_NODESET:
+ if ((obj->nodesetval == NULL)
+ || (obj->nodesetval->nodeNr == 0)) {
+ ret = PyList_New(0);
+ } else {
+ int i;
+ xmlNodePtr node;
+
+ ret = PyList_New(obj->nodesetval->nodeNr);
+ for (i = 0; i < obj->nodesetval->nodeNr; i++) {
+ node = obj->nodesetval->nodeTab[i];
+ /* TODO: try to cast directly to the proper node type */
+ PyList_SetItem(ret, i, libxml_xmlNodePtrWrap(node));
+ }
+ }
+ break;
+ case XPATH_BOOLEAN:
+ ret = PyInt_FromLong((long) obj->boolval);
+ break;
+ case XPATH_NUMBER:
+ ret = PyFloat_FromDouble(obj->floatval);
+ break;
+ case XPATH_STRING:
+ ret = PyString_FromString((char *) obj->stringval);
+ break;
+ case XPATH_POINT:
+ case XPATH_RANGE:
+ case XPATH_LOCATIONSET:
+ default:
+ printf("Unable to convert XPath object type %d\n", obj->type);
+ Py_INCREF(Py_None);
+ ret = Py_None;
+ }
+ xmlXPathFreeObject(obj);
+ return (ret);
+}
+
+xmlXPathObjectPtr
+libxml_xmlXPathObjectPtrConvert(PyObject * obj)
+{
+ xmlXPathObjectPtr ret = NULL;
+
+#ifdef DEBUG
+ printf("libxml_xmlXPathObjectPtrConvert: obj = %p\n", obj);
+#endif
+ if (obj == NULL) {
+ return (NULL);
+ }
+ if PyFloat_Check
+ (obj) {
+ ret = xmlXPathNewFloat((double) PyFloat_AS_DOUBLE(obj));
+ } else if PyString_Check
+ (obj) {
+ xmlChar *str;
+
+ str = xmlStrndup((const xmlChar *) PyString_AS_STRING(obj),
+ PyString_GET_SIZE(obj));
+ ret = xmlXPathWrapString(str);
+ } else if PyList_Check
+ (obj) {
+ int i;
+ PyObject *node;
+ xmlNodePtr cur;
+ xmlNodeSetPtr set;
+
+ set = xmlXPathNodeSetCreate(NULL);
+
+ for (i = 0; i < PyList_Size(obj); i++) {
+ node = PyList_GetItem(obj, i);
+ if ((node == NULL) || (node->ob_type == NULL))
+ continue;
+
+ cur = NULL;
+ if (PyCObject_Check(node)) {
+ printf("Got a CObject\n");
+ cur = PyxmlNode_Get(node);
+ } else if (PyInstance_Check(node)) {
+ PyInstanceObject *inst = (PyInstanceObject *) node;
+ PyObject *name = inst->in_class->cl_name;
+
+ if PyString_Check
+ (name) {
+ char *type = PyString_AS_STRING(name);
+ PyObject *wrapper;
+
+ if (!strcmp(type, "xmlNode")) {
+ wrapper =
+ PyObject_GetAttrString(node, (char *) "_o");
+ if (wrapper != NULL) {
+ cur = PyxmlNode_Get(wrapper);
+ }
+ }
+ }
+ } else {
+ printf("Unknown object in Python return list\n");
+ }
+ if (cur != NULL) {
+ xmlXPathNodeSetAdd(set, cur);
+ }
+ }
+ ret = xmlXPathWrapNodeSet(set);
+ } else {
+ printf("Unable to convert Python Object to XPath");
+ }
+ Py_DECREF(obj);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlCatalogPtrWrap(xmlCatalogPtr catal)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlNodePtrWrap: catal = %p\n", catal);
+#endif
+ if (catal == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) catal,
+ (char *) "xmlCatalogPtr", NULL);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlOutputBufferPtrWrap(xmlOutputBufferPtr buffer)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlOutputBufferPtrWrap: buffer = %p\n", buffer);
+#endif
+ if (buffer == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) buffer,
+ (char *) "xmlOutputBufferPtr", NULL);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlParserInputBufferPtrWrap(xmlParserInputBufferPtr buffer)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlParserInputBufferPtrWrap: buffer = %p\n", buffer);
+#endif
+ if (buffer == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) buffer,
+ (char *) "xmlParserInputBufferPtr", NULL);
+ return (ret);
+}
+
+#ifdef LIBXML_REGEXP_ENABLED
+PyObject *
+libxml_xmlRegexpPtrWrap(xmlRegexpPtr regexp)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlRegexpPtrWrap: regexp = %p\n", regexp);
+#endif
+ if (regexp == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) regexp,
+ (char *) "xmlRegexpPtr", NULL);
+ return (ret);
+}
+#endif /* LIBXML_REGEXP_ENABLED */
+
+PyObject *
+libxml_xmlTextReaderPtrWrap(xmlTextReaderPtr reader)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlTextReaderPtrWrap: reader = %p\n", reader);
+#endif
+ if (reader == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) reader,
+ (char *) "xmlTextReaderPtr", NULL);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlTextReaderLocatorPtrWrap(xmlTextReaderLocatorPtr locator)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlTextReaderLocatorPtrWrap: locator = %p\n", locator);
+#endif
+ if (locator == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) locator,
+ (char *) "xmlTextReaderLocatorPtr", NULL);
+ return (ret);
+}
+
+#ifdef LIBXML_SCHEMAS_ENABLED
+PyObject *
+libxml_xmlRelaxNGPtrWrap(xmlRelaxNGPtr ctxt)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlRelaxNGPtrWrap: ctxt = %p\n", ctxt);
+#endif
+ if (ctxt == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) ctxt,
+ (char *) "xmlRelaxNGPtr", NULL);
+ return (ret);
+}
+
+PyObject *
+libxml_xmlRelaxNGParserCtxtPtrWrap(xmlRelaxNGParserCtxtPtr ctxt)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlRelaxNGParserCtxtPtrWrap: ctxt = %p\n", ctxt);
+#endif
+ if (ctxt == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) ctxt,
+ (char *) "xmlRelaxNGParserCtxtPtr", NULL);
+ return (ret);
+}
+PyObject *
+libxml_xmlRelaxNGValidCtxtPtrWrap(xmlRelaxNGValidCtxtPtr valid)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlRelaxNGValidCtxtPtrWrap: valid = %p\n", valid);
+#endif
+ if (valid == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) valid,
+ (char *) "xmlRelaxNGValidCtxtPtr", NULL);
+ return (ret);
+}
+#endif /* LIBXML_SCHEMAS_ENABLED */
+
+PyObject *
+libxml_xmlErrorPtrWrap(xmlErrorPtr error)
+{
+ PyObject *ret;
+
+#ifdef DEBUG
+ printf("libxml_xmlErrorPtrWrap: error = %p\n", error);
+#endif
+ if (error == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
+ ret =
+ PyCObject_FromVoidPtrAndDesc((void *) error,
+ (char *) "xmlErrorPtr", NULL);
+ return (ret);
+}