[Lxml-checkins] r32664 - in lxml/branch/lxml-1.1: . doc src/lxml src/lxml/tests

scoder at codespeak.net scoder at codespeak.net
Wed Sep 27 08:48:36 CEST 2006


Author: scoder
Date: Wed Sep 27 08:48:33 2006
New Revision: 32664

Modified:
   lxml/branch/lxml-1.1/CHANGES.txt
   lxml/branch/lxml-1.1/doc/build.txt
   lxml/branch/lxml-1.1/src/lxml/etree.pyx
   lxml/branch/lxml-1.1/src/lxml/parser.pxi
   lxml/branch/lxml-1.1/src/lxml/tests/test_htmlparser.py
   lxml/branch/lxml-1.1/src/lxml/xmlparser.pxd
Log:
merged in fixes from trunk

Modified: lxml/branch/lxml-1.1/CHANGES.txt
==============================================================================
--- lxml/branch/lxml-1.1/CHANGES.txt	(original)
+++ lxml/branch/lxml-1.1/CHANGES.txt	Wed Sep 27 08:48:33 2006
@@ -12,6 +12,8 @@
 Bugs fixed
 ----------
 
+* HTML script/style content was not propagated to .text
+
 * Show text xincluded between text nodes correctly in .text and .tail
 
 * 'integer * objectify.StringElement' operation was not supported

Modified: lxml/branch/lxml-1.1/doc/build.txt
==============================================================================
--- lxml/branch/lxml-1.1/doc/build.txt	(original)
+++ lxml/branch/lxml-1.1/doc/build.txt	Wed Sep 27 08:48:33 2006
@@ -196,7 +196,11 @@
 
 The ``_a`` part of the library names means that we are linking statically
 against the named library files.  If you want to use dynamic libraries, you
-need to link against the DLL version of the libraries.
+need to link against the DLL version of the libraries.  As `Ashish Kulkarni`_
+notes, you might have to add the standard Windows library ``wsock32.dll`` to
+the above list of libraries to make ``lxml.objectify`` compile.
+
+.. _`Ashish Kulkarni`: 
 
 Now you should be able to pass the ``--static`` option to setup.py and
 everything should work well.  Try calling::

Modified: lxml/branch/lxml-1.1/src/lxml/etree.pyx
==============================================================================
--- lxml/branch/lxml-1.1/src/lxml/etree.pyx	(original)
+++ lxml/branch/lxml-1.1/src/lxml/etree.pyx	Wed Sep 27 08:48:33 2006
@@ -582,7 +582,7 @@
         Returns True or False, depending on whether validation
         succeeded.
 
-        Note: If you are going to applyt he same XML Schema against
+        Note: If you are going to apply the same XML Schema against
         multiple documents, it is more efficient to use the XMLSchema
         class directly.
         """

Modified: lxml/branch/lxml-1.1/src/lxml/parser.pxi
==============================================================================
--- lxml/branch/lxml-1.1/src/lxml/parser.pxi	(original)
+++ lxml/branch/lxml-1.1/src/lxml/parser.pxi	Wed Sep 27 08:48:33 2006
@@ -368,6 +368,9 @@
         self._parser_ctxt = pctxt
         if pctxt is NULL:
             raise ParserError, "Failed to create parser context"
+        if pctxt.sax != NULL:
+            # hard switch-off for CDATA nodes => makes them plain text
+            pctxt.sax.cdataBlock = NULL
         if thread is None or self._parser_type == LXML_ITERPARSE_PARSER:
             # no threading
             self._lockParser   = self.__dummy

Modified: lxml/branch/lxml-1.1/src/lxml/tests/test_htmlparser.py
==============================================================================
--- lxml/branch/lxml-1.1/src/lxml/tests/test_htmlparser.py	(original)
+++ lxml/branch/lxml-1.1/src/lxml/tests/test_htmlparser.py	Wed Sep 27 08:48:33 2006
@@ -51,6 +51,12 @@
         self.assertEqual(self.etree.tostring(element),
                          self.html_str)
 
+    def test_module_HTML_cdata(self):
+        # by default, libxml2 generates CDATA nodes for <script> content
+        html = '<html><head><style>foo</style></head></html>'
+        element = self.etree.HTML(html)
+        self.assertEquals(element[0][0].text, "foo")
+
     def test_module_HTML_access(self):
         element = self.etree.HTML(self.html_str)
         self.assertEqual(element[0][0].tag, 'title')

Modified: lxml/branch/lxml-1.1/src/lxml/xmlparser.pxd
==============================================================================
--- lxml/branch/lxml-1.1/src/lxml/xmlparser.pxd	(original)
+++ lxml/branch/lxml-1.1/src/lxml/xmlparser.pxd	Wed Sep 27 08:48:33 2006
@@ -19,6 +19,10 @@
                                           char* prefix,
                                           char* URI)
 
+    ctypedef void (*cdataBlockSAXFunc)(void* ctx,
+                                       char* value,
+                                       int len)
+
 cdef extern from "libxml/tree.h":
     ctypedef struct xmlParserInput
     ctypedef struct xmlParserInputBuffer:
@@ -29,6 +33,7 @@
     ctypedef struct xmlSAXHandler:
         startElementNsSAX2Func startElementNs
         endElementNsSAX2Func   endElementNs
+        cdataBlockSAXFunc      cdataBlock
 
 cdef extern from "libxml/xmlIO.h":
     cdef xmlParserInputBuffer* xmlAllocParserInputBuffer(int enc)


More information about the lxml-checkins mailing list