1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-27 04:55:04 +03:00
Commit Graph

345 Commits

Author SHA1 Message Date
Alexey Neyman
a9016c4927 Fix a few problems with setEntityLoader
1. Setting entity loader does not increment the refcount on the Python object
passed in. This works only if the object is not deleted. For example, the
following code results in segmentation fault in Python interpreter when
attempting to process any document:

[[[
def register_entity_loader():
    def entity_loader(URL, ID, ctxt):
        ...
    libxml2.setEntityLoader(entity_loader

register_entity_loader()
]]]

2. setEntityLoader() does not verify if the passed object is callable. If it
is not, current implementation attempts to call it anyway and failing that,
silently moves on to default entity loader. Attached patch makes
setEntityLoader raise ValueError exception if non-callable object is
passed.

3. In debug mode, pythonExternalEntityLoader() outputs the result object to
stderr, while the messages before and after the object (description + newline)
go to stdout. Attached patch makes them all go to stdout.
2013-02-25 16:07:09 +08:00
Alexey Neyman
48da90bc4a Python binding for xmlRegisterInputCallback
It is possible to make xmlIO handle any protocol by means of
xmlRegisterInputCallback(). However, that function is currently only
available in C API. So, the natural solution seems to be implementing Python
bindings for the xmlRegisterInputCallback.

* python/generator.py: skip xmlPopInputCallbacks
* python/libxml.c python/libxml.py python/libxml_wrap.h: implement the
  wrappers
* python/tests/input_callback.py python/tests/Makefile.am: also add a test case
2013-02-25 15:54:25 +08:00
Alexey Neyman
e32ceb93f4 Python bindings: DOM casts everything to xmlNode
I noticed another issue with Python bindings of libxml: the access methods do
not cast the pointers to specific classes such as xmlDtd, xmlEntityDecl, etc.
For example, with the following document:

<?xml version="1.0"?>
<!DOCTYPE root [<!ELEMENT root EMPTY>]>
<root/>

the following script:

import libxml2
doc = libxml2.readFile("c.xml", None, libxml2.XML_PARSE_DTDLOAD)
print repr(doc.children)

prints:

<xmlNode (root) object at 0xb74963ec>

With properly cast nodes, it outputs the following:

<xmlDtd (root) object at 0xb746352c>

The latter object (xmlDtd) enables one to use DTD-specific methods such as
debugDumpDTD(), copyDTD(), and so on.
2013-02-21 16:00:03 +08:00
Daniel Veillard
f8e3db0445 Big space and tab cleanup
Remove all space before tabs and space and tabs at end of lines.
2012-09-11 13:26:36 +08:00
Csaba Raduly
429d3a0aae Allow to set the quoting character of an xmlWriter
It's otherwise impossible to set the quoting character of
attribute values of an xmlWriter.
2012-09-11 11:52:46 +08:00
Daniel Veillard
857104cd49 Remove all .cvsignore as they are not used anymore
For https://bugzilla.gnome.org/show_bug.cgi?id=682985
suggested by Adrian Bunk <bunk@stusta.de>
2012-09-04 14:25:23 +08:00
Akira TAGOH
961b535c10 Bug 676544 - fails to build with --without-sax1
Added some ifdef'd LIBXML_SAX1_ENABLED to make it buildable with
--without-sax1 configure option.
2012-08-28 22:03:16 +08:00
Daniel Richard G
d10a72ce8c Bundles all generated files for python into the distribution
So end users building the Python module don't need to
regenerate any source files. some clean-up too.
2012-08-14 12:50:25 +08:00
Roumen Petrov
c3b1d09ba2 clean redefinition of {v}snprintf in C-source
as those from *config.h are preferable (e.g. win32config.h)
2012-08-13 16:57:30 +08:00
Daniel Veillard
aa017c54dd Release candidate 1 of libxml2-2.9.0
* configure.in libxml.spec.in python/setup.py: bumped release numbers
* doc//*: regenerated as part of the release
2012-08-10 10:42:56 +08:00
Daniel Richard G
5d6c02ba61 Various "make distcheck" and portability fixups 2nd part
doc/examples/Makefile.am:

* Use $(VAR), not @VAR@

* Use $(MKDIR_P) instead of $(mkinstalldirs), as the latter is an
* obsolete
  name

* Added $(srcdir) qualification to the various test program invocations
* in
  the "tests" target. More work is needed here (notably, when the
  reference output contains the path to the input file), but this gets
  things a lot closer to working correctly in an out-of-source build.

doc/examples/reader4.res:

* Added "./" path qualifiers so that the reader4 test continues to pass
  cleanly for in-source builds

python/tests/Makefile.am:

* Symlink in test input files for out-of-source builds
2012-08-07 10:05:34 +08:00
Daniel Richard G
5706b6d876 Various "make distcheck" and portability fixups
Makefile.am:

* Don't use @VAR@, use $(VAR). Autoconf's AC_SUBST provides us the Make
   variable, it allows overriding the value at the command line, and
   (notably) it avoids a Make parse error in the libxml2_la_LDFLAGS
   assignment when @MODULE_PLATFORM_LIBS@ is empty

* Changed how the THREADS_W32 mechanism switches the build between
   testThreads.c and testThreadsWin32.c as appropriate; using AM_CONDITIONAL
   allows this to work cleanly and plays well with dependencies

* testapi.c should be specified as BUILT_SOURCES

* Create symlinks to the test/ and result/ subdirs so that the runtests
   target is usable in out-of-source-tree builds

* Don't do MAKEFLAGS+=--silent as this is not portable to non-GNU Makes

* Fixed incorrect find(1) syntax in the "cleanup" rule, and doing "rm -f"
   instead of just "rm" is good form

* (DIST)CLEANFILES needed a bit more coverage to allow "make distcheck" to
   pass

configure.in:

* Need AC_PROG_LN_S to create test/ and result/ symlinks in Makefile.am

* AC_LIBTOOL_WIN32_DLL and AM_PROG_LIBTOOL are obsolete; these have been
   superceded by LT_INIT

* Don't rebuild docs by default, as this requires GNU Make (as
   implemented)

* Check for uint32_t as some platforms don't provide it

* Check for some more functions, and undefine HAVE_MMAP if we don't also
   HAVE_MUNMAP (one system I tested on actually needed this)

* Changed THREADS_W32 from a filename insert into an Automake conditional

* The "Copyright" file will not be in the current directory if builddir !=
   srcdir

doc/Makefile.am:

* EXTRA_DIST cannot use wildcards when they refer to generated files; this
   breaks dependencies. What I did was define EXTRA_DIST_wc, which uses GNU
   Make $(wildcard) directives to build up a list of files, and EXTRA_DIST,
   as a literal expansion of EXTRA_DIST_wc. I also added a new rule,
   "check-extra-dist", to simplify checking that the two variables are
   equivalent. (Note that this works only when builddir == srcdir)

   (I can implement this differently if desired; this is just one way of
   doing it)

* Don't define an "all" target; this steps on Automake's toes

* Fixed up the "libxml2-api.xml ..." rule by using $(wildcard) for
   dependencies (as Make doesn't process the wildcards otherwise) and
   qualifying appropriate files with $(srcdir)

   (Note that $(srcdir) is not needed in the dependencies, thanks to VPATH,
   which we can count on as this is GNU-Make-only code anyway)

doc/devhelp/Makefile.am:

* Qualified appropriate files with $(srcdir)

* Added an "uninstall-local" rule so that "make distcheck" passes

doc/examples/Makefile.am:

* Rather than use a wildcard that doesn't work, use a substitution that
   most Make programs can handle

doc/examples/index.py:

* Do the same here

include/libxml/nanoftp.h:

* Some platforms (e.g. MSVC 6) already #define INVALID_SOCKET:

     user@host:/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/\
     Include$ grep -R INVALID_SOCKET .
     ./WINSOCK.H:#define INVALID_SOCKET  (SOCKET)(~0)
     ./WINSOCK2.H:#define INVALID_SOCKET  (SOCKET)(~0)

include/libxml/xmlversion.h.in:

* Support ancient GCCs (I was actually able to build the library with 2.5
   but for this bit)

python/Makefile.am:

* Expanded CLEANFILES to allow "make distcheck" to pass

python/tests/Makefile.am:

* Define CLEANFILES instead of a "clean" rule, and added tmp.xml to allow
   "make distcheck" to pass

testRelax.c:

* Use HAVE_MMAP instead of the less explicit HAVE_SYS_MMAN_H (as some
   systems have the header but not the function)

testSchemas.c:

* Use HAVE_MMAP instead of the less explicit HAVE_SYS_MMAN_H

testapi.c:

* Don't use putenv() if it's not available

threads.c:

* This fixes the following build error on Solaris 8:

     libtool: compile:  cc -DHAVE_CONFIG_H -I. -I./include -I./include \
     -D_REENTRANT -D__EXTENSIONS__ -D_REENTRANT -Dsparc -Xa -mt -v \
     -xarch=v9 -xcrossfile -xO5 -c threads.c  -KPIC -DPIC -o threads.o
     "threads.c", line 442: controlling expressions must have scalar type
     "threads.c", line 512: controlling expressions must have scalar type
     cc: acomp failed for threads.c
     *** Error code 1

trio.c:

* Define isascii() if the system doesn't provide it

trio.h:

* The trio library's HAVE_CONFIG_H header is not the same as LibXML2's
   HAVE_CONFIG_H header; this change is needed to avoid a double-inclusion

win32/configure.js:

* Added support for the LZMA compression option

win32/Makefile.{bcb,mingw,msvc}:

* Added appropriate bits to support WITH_LZMA=1

* Install the header files under $(INCPREFIX)\libxml2\libxml instead of
   $(INCPREFIX)\libxml, to mirror the install location on Unix+Autotools

xml2-config.in:

* @MODULE_PLATFORM_LIBS@ (usually "-ldl") needs to be in there in order for
   `xml2-config --libs` to provide a complete set of dependencies

xmllint.c:

* Use HAVE_MMAP instead of the less-explicit HAVE_SYS_MMAN_H
2012-08-06 11:32:54 +08:00
Daniel Veillard
c943f708f1 Release of libxml2-2.8.0
- Makefile.am: don't package .git
- configure.in : update to new release
- doc/xml.html: added the new release
- doc/* testapi.c: regenerated
2012-05-23 17:10:59 +08:00
Daniel Veillard
22030ef888 Restore code for Windows compilation
Try to keep as close to rc1 but still allow the change from Roumen for
mingw
2012-05-23 15:52:45 +08:00
Roumen Petrov
978ff224b2 use mingw C99 compatible functions {v}snprintf instead those from MSVC runtime 2012-05-21 10:20:09 +08:00
Pacho Ramos
1ea6b14125 Fix undefined reference in python module
For https://bugzilla.gnome.org/show_bug.cgi?id=622023
when compiled with LDFLAGS="${LDFLAGS} -Wl,-z,-defs -Wl,--no-undefined"
the python module would failed due to the undefined. This add an
explicit reference to python lib.
2012-05-15 19:36:02 +08:00
Daniel Veillard
39d027cdb7 Fix html serialization error and htmlSetMetaEncoding()
For https://bugzilla.gnome.org/show_bug.cgi?id=630682
The python tests were reporting errors, some of it was due to
a small change in case encoding, but the main one was about
htmlSetMetaEncoding(doc, NULL) being broken by not removing
the associated meta tag anymore
2012-05-11 12:38:23 +08:00
Thomas Lemm
066c697772 Allow to compile with Visual Studio 2010
For https://bugzilla.gnome.org/show_bug.cgi?id=666491

This patch adds project files to compile and debug libxml2 using Visual
Studio 2010. Only few minor changes have been made to the actual source
code.

This patch also requires for the iconv package to be compiled with visual
studio 2010 which has been submitted to the iconv project (see:
https://savannah.gnu.org/bugs/?35088)
2012-05-09 18:27:04 +08:00
Daniel Veillard
0795348aeb fix a pair of possible out of array char references
When serializing char references back to an character string
Reported by Abhishek Arya <inferno@chromium.org>
2012-01-22 17:42:35 +08:00
Stefan Kost
fdd3c04a61 python: remove unused variable 2011-05-25 17:20:05 +03:00
Stefan Kost
c31e06cc18 python: flag two unused args 2011-05-25 17:20:05 +03:00
Daniel Veillard
4c2e7c651f Release of libxml2-2.7.8 2010-11-04 18:35:57 +01:00
LRN
fbd4ddf226 607273 Fix python detection on MSys/Windows
Fix the lookup for python executable and headers, add an
extra variable for new dependancies when linking for Python
on Win32
2010-11-04 15:45:46 +01:00
Koop Mast
e306260f54 Fix compilation with Clang
Don't redefine vsnprintf if it is available
2010-11-03 16:10:26 +01:00
Mike Hommey
10455bb48f Sort python generated stubs
to avoid shuffling each time python changes or on different
architectures
2010-10-15 18:39:50 +02:00
Daniel Veillard
bb5055f387 Release of libxml2-2.7.7
* configure.in: bump version
* doc//*: regenerated
2010-03-15 16:21:00 +01:00
Paul Smith
38af74f7b1 fix build error in libxml2/python
There are missing $(srcdir) values in libxml2/python/Makefile.am which
cause it to fail if built remote from out of tree.
2010-03-15 10:22:25 +01:00
Daniel Veillard
794613770d Fix python generator to not use deprecated xmllib
* python/generator.py: use xml.sax instead, patch based on similar
  fir for libvirt by Cole Robinson <crobinso@redhat.com>
2010-01-13 15:34:50 +01:00
Martin
729601f157 Fix memory leak in xmlXPathEvalExpression()
* xpath.c: plug some leaks when parsing misformed XPath expressions
* python/tests/xpathleak.py: expand the regression tests for those
2009-10-12 22:42:26 +02:00
Daniel Veillard
96bb740e21 Release of libxml2-2.7.6
* configure.in doc/xml.html: updates for release
* NEWS doc/libxml2.xsa doc/news.html python/setup.py: regenerated
2009-10-06 18:38:15 +02:00
Daniel Veillard
7a896ce260 Release of libxml2-2.7.5
* configure.in doc/xml.html: updated
* doc/libxml2.xsa doc/xml.html python/setup.py: regenerated
2009-09-24 18:38:57 +02:00
Frederic Crozat
e21731dec8 link python module with python library
* configure.in python/Makefile.am: libxml2 python module wasn't linked
  with python library
2009-09-12 18:02:40 +02:00
Daniel Veillard
293416828e Release of libxml2-2.7.4
* configure.in: new version
* libxml.spec.in: cleanup
* xmlregexp.c: fix a comment
* doc/apibuild.py: update
* doc/*: regenerate everything
2009-09-10 18:23:39 +02:00
Daniel Veillard
594e5dfb48 Chasing dead assignments reported by clang-scan
* SAX2.c dict.c error.c hash.c nanohttp.c parser.c python/libxml.c
  relaxng.c runtest.c tree.c valid.c xinclude.c xmlregexp.c xmlsave.c
  xmlschemas.c xpath.c xpointer.c: mostly removing unneded affectations,
  but this led to a few real bugs and some part not yet understood
  (relaxng/interleave)
2009-09-07 14:58:47 +02:00
Leonid Evdokimov
147687f108 544910 typo: "renciliateNs"
* python/libxml.py: typo on a comment
2009-08-24 14:08:43 +02:00
Daniel Veillard
f5ac0a4b80 Fix python regression test after 583439 cleanup 2009-08-24 11:59:07 +02:00
Daniel Veillard
53c32edfa5 Rebuilt the API and regenerated docs 2009-08-21 15:20:55 +02:00
Daniel Veillard
4ab6755755 A couple of generated but modified files
* config.h.in: update of libtool seems to have modified it
* python/libxml2class.txt: python update modified the
  order of classes apparently
2009-07-09 08:53:51 +02:00
Daniel Veillard
97ff9b367a preparing 0.7.3 release fix a typo in a name Daniel
* configure.in doc/xml.html doc/*: preparing 0.7.3 release
* include/libxml/parserInternals.h SAX2.c: fix a typo in a name
Daniel

svn path=/trunk/; revision=3814
2009-01-18 21:43:30 +00:00
Daniel Veillard
be2bd6ac6f adds element traversal support avoid a warning regenerated daniel
* include/libxml/tree.h tree.c python/generator.py: adds
  element traversal support
* valid.c: avoid a warning
* doc/*: regenerated
daniel

svn path=/trunk/; revision=3804
2008-11-27 15:26:28 +00:00
Daniel Veillard
7f4547cdbd preparing the release of 2.7.2 fix the Solaris portability issue
* configure.in doc/* NEWS: preparing the release of 2.7.2
* dict.c: fix the Solaris portability issue
* parser.c: additional cleanup on #554660 fix
* test/ent13 result/ent13* result/noent/ent13*: added the
  example in the regression test suite.
* HTMLparser.c: handle leading BOM in htmlParseElement()
Daniel

svn path=/trunk/; revision=3799
2008-10-03 07:58:23 +00:00
Daniel Veillard
a7036d93a0 prepare release of 2.7.1 daniel
* doc/xml.html doc/news.html configure.in python/setup.py NEWS:
  prepare release of 2.7.1
daniel

svn path=/trunk/; revision=3792
2008-09-01 14:50:19 +00:00
Daniel Veillard
074f37e7eb applied a couple of patches from Martin avoiding some leaks, fixinq QName
* schematron.c xpath.c: applied a couple of patches from Martin
  avoiding some leaks, fixinq QName checks in XPath, XPath debugging
  and schematron code cleanups.
* python/tests/Makefile.am python/tests/xpathleak.py: add the
  specific regression tests, just tweak it to avoid output by default
Daniel

svn path=/trunk/; revision=3791
2008-09-01 13:38:22 +00:00
Daniel Veillard
da3fee406d Borland C fix from Moritz Both regenerate, workaround a problem for buffer
* trionan.c: Borland C fix from Moritz Both
* testapi.c: regenerate, workaround a problem for buffer testing
* xmlIO.c HTMLtree.c: new internal entry point to hide even better
  xmlAllocOutputBufferInternal
* tree.c: harden the code around buffer allocation schemes
* parser.c: restore the warning when namespace names are not absolute
  URIs
* runxmlconf.c: continue regression tests if we get the expected
  number of errors
* Makefile.am: run the python tests on make check
* xmlsave.c: handle the HTML documents and trees
* python/libxml.c: convert python serialization to the xmlSave APIs
  and avoid some horrible hacks
Daniel

svn path=/trunk/; revision=3790
2008-09-01 13:08:57 +00:00
Daniel Veillard
1572425c27 preparing 2.7.0 release remove some testing traces remove some warnings
* configure.in, doc/*: preparing 2.7.0 release
* tree.c: remove some testing traces
* parser.c xmlIO.c xmlschemas.c: remove some warnings
Daniel

svn path=/trunk/; revision=3788
2008-08-30 15:01:04 +00:00
Daniel Veillard
2cba415895 fix a small initialization problem raised by Ashwin increase testing
* threads.c: fix a small initialization problem raised by Ashwin
* testapi.c gentest.py: increase testing especially for document
  with an internal subset, and entities
* tree.c: fix a deallocation issue when unlinking entities from
  a document.
* valid.c: fix a missing entry point test not found previously.
* doc/*: regenerated the APIs, docs etc.
daniel

svn path=/trunk/; revision=3778
2008-08-27 11:45:41 +00:00
Daniel Veillard
34e3f64191 implement XML-1.0 5th edition, add parser option XML_PARSE_OLD10 to stick
* include/libxml/parser.h include/libxml/xmlerror.h parser.c:
  implement XML-1.0 5th edition, add parser option XML_PARSE_OLD10
  to stick to old behaviour
* testapi.c gentest.py: modified slightly and regenerated
* Makefile.am: add testchar
Daniel

svn path=/trunk/; revision=3755
2008-07-29 09:02:27 +00:00
Daniel Veillard
39801e572a apply patch from Martin fixing python whitespaces following previous
* python/generator.py python/setup.py: apply patch from Martin fixing
  python whitespaces
* NEWS: following previous commit rebuilt now in UTF-8
Daniel

svn path=/trunk/; revision=3746
2008-06-03 16:08:54 +00:00
Daniel Veillard
438ebbd59a fx compilation when configured without the reader should fix #513110
* xmlschemas.c runtest.c testapi.c include/libxml/xmlreader.h
  python/types.c python/libxml_wrap.h python/libxml.c: fx compilation
  when configured without the reader should fix #513110
* doc/*: regenerated
Daniel

svn path=/trunk/; revision=3743
2008-05-12 12:58:46 +00:00
Daniel Veillard
dee23485f6 added new function xmlSchemaValidCtxtGetParserCtxt based on Holger
* include/libxml/xmlschemas.h xmlschemas.c: added new function
  xmlSchemaValidCtxtGetParserCtxt based on Holger Kaelberer patch
* doc/apibuild.py doc/*: regenerated the doc, chased why the new
  function didn't got any documentation, added more checking in the
  generator
* include/libxml/relaxng.h include/libxml/schematron.h
  include/libxml/xmlschemas.h include/libxml/c14n.h
  include/libxml/xmlregexp.h include/libxml/globals.h
  include/libxml/xmlreader.h threads.c xmlschemas.c: various changes
  and cleanups following the new reports
Daniel

svn path=/trunk/; revision=3738
2008-04-11 12:58:43 +00:00