Re: [xml] Availability of libxm2-2.9.0 release candidate 1
- From: Daniel Veillard <veillard redhat com>
- To: Stefan Behnel <stefan_ml behnel de>
- Cc: xml <xml gnome org>
- Subject: Re: [xml] Availability of libxm2-2.9.0 release candidate 1
- Date: Fri, 10 Aug 2012 14:55:49 +0800
On Fri, Aug 10, 2012 at 08:14:32AM +0200, Stefan Behnel wrote:
Daniel Veillard, 10.08.2012 07:21:
BTW do you have a git commit for 2.9.0 preparation in lxml now ? I may
forward this to the packager for Fedora.
Hmm, I'm fixing it up only for lxml 3.0. Due to various changes in the code
base, that won't apply directly to the latest 2.3.x, and I'm not sure I
want to add support in the 2.3.x series. I might ...
The fixes aren't all that complex, though. If it's just to get it working,
the attached patch should show the necessary changes, but it won't apply to
2.3.x as is.
BTW, with my latest changes, I get lots of XSLT test failures like this
when I run it with libxslt 1.1.26:
"""
Failed example:
str(result)
Expected:
'<?xml version="1.0"?>\n<foo><child>NEW TEXT</child></foo>\n'
Got:
'<?xml version=?>\n<foo><child>NEW TEXT</child></foo>\n'
"""
You might have seen these before.
yes that's what I was gettng with rc0, and should be fixed in rc1,
basically libxslt was writing directly to the old xmlBuffer for the
encoding and version there, but with rc1 code that is properly handled.
# HG changeset patch
# Parent a071dfc78c525bb6fda60746bbe694ff1b257200
adapt to upcoming buffer changes in libxml2 2.9
diff -r a071dfc78c52 -r e5da17790fc2 src/lxml/includes/etree_defs.h
--- a/src/lxml/includes/etree_defs.h Thu Aug 09 17:06:50 2012 +0200
+++ b/src/lxml/includes/etree_defs.h Thu Aug 09 18:24:42 2012 +0200
@@ -152,6 +152,13 @@
# define xmlSchematronSetValidStructuredErrors(ctxt, errorfunc, data)
#endif
+#include "libxml/tree.h"
+#ifndef LIBXML2_NEW_BUFFER
+ typedef xmlBuffer xmlBuf;
+# define xmlBufContent(buf) xmlBufferContent(buf)
+# define xmlBufLength(buf) xmlBufferLength(buf)
+#endif
ah, okay, that's a bit funky, but should work I guess :-)
/* libexslt 1.1.25+ support EXSLT functions in XPath */
#if LIBXSLT_VERSION < 10125
#define exsltDateXpathCtxtRegister(ctxt, prefix)
diff -r a071dfc78c52 -r e5da17790fc2 src/lxml/includes/tree.pxd
--- a/src/lxml/includes/tree.pxd Thu Aug 09 17:06:50 2012 +0200
+++ b/src/lxml/includes/tree.pxd Thu Aug 09 18:24:42 2012 +0200
@@ -285,9 +285,11 @@
ctypedef struct xmlBuffer
+ ctypedef struct xmlBuf # new in libxml2 2.9
+
ctypedef struct xmlOutputBuffer:
- xmlBuffer* buffer
- xmlBuffer* conv
+ xmlBuf* buffer
+ xmlBuf* conv
int error
const_xmlChar* XML_XML_NAMESPACE
@@ -359,6 +361,8 @@
cdef void xmlBufferFree(xmlBuffer* buf) nogil
cdef const_xmlChar* xmlBufferContent(xmlBuffer* buf) nogil
cdef int xmlBufferLength(xmlBuffer* buf) nogil
+ cdef const_xmlChar* xmlBufContent(xmlBuf* buf) nogil # new in libxml2 2.9
+ cdef size_t xmlBufLength(xmlBuf* buf) nogil # new in libxml2 2.9
cdef int xmlKeepBlanksDefault(int val) nogil
cdef xmlChar* xmlNodeGetBase(xmlDoc* doc, xmlNode* node) nogil
cdef void xmlNodeSetBase(xmlNode* node, const_xmlChar* uri) nogil
diff -r a071dfc78c52 -r e5da17790fc2 src/lxml/serializer.pxi
--- a/src/lxml/serializer.pxi Thu Aug 09 17:06:50 2012 +0200
+++ b/src/lxml/serializer.pxi Thu Aug 09 18:24:42 2012 +0200
@@ -81,7 +81,7 @@
tree.
"""
cdef tree.xmlOutputBuffer* c_buffer
- cdef tree.xmlBuffer* c_result_buffer
+ cdef tree.xmlBuf* c_result_buffer
cdef tree.xmlCharEncodingHandler* enchandler
cdef const_char* c_enc
cdef const_xmlChar* c_version
@@ -133,11 +133,11 @@
try:
if encoding is _unicode:
- result = (<unsigned char*>tree.xmlBufferContent(
- c_result_buffer))[:tree.xmlBufferLength(c_result_buffer)].decode('UTF-8')
+ result = (<unsigned char*>tree.xmlBufContent(
+ c_result_buffer))[:tree.xmlBufLength(c_result_buffer)].decode('UTF-8')
else:
- result = <bytes>(<unsigned char*>tree.xmlBufferContent(
- c_result_buffer))[:tree.xmlBufferLength(c_result_buffer)]
+ result = <bytes>(<unsigned char*>tree.xmlBufContent(
+ c_result_buffer))[:tree.xmlBufLength(c_result_buffer)]
finally:
error_result = tree.xmlOutputBufferClose(c_buffer)
if error_result < 0:
@@ -287,6 +288,9 @@
tree.xmlOutputBufferWrite(c_buffer, 3, ' [\n')
if c_dtd.notations != NULL:
- tree.xmlDumpNotationTable(c_buffer.buffer,
- <tree.xmlNotationTable*>c_dtd.notations)
+ c_buf = tree.xmlBufferCreate()
+ tree.xmlDumpNotationTable(c_buf, <tree.xmlNotationTable*>c_dtd.notations)
+ tree.xmlOutputBufferWrite(
+ c_buffer, tree.xmlBufferLength(c_buf), <const_char*>tree.xmlBufferContent(c_buf))
+ tree.xmlBufferFree(c_buf)
c_node = c_dtd.children
while c_node is not NULL:
okay, thanks !
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel veillard com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]