[Lxml-checkins] r49761 - in lxml/trunk: . src/lxml src/lxml/tests
scoder at codespeak.net
scoder at codespeak.net
Fri Dec 14 08:42:43 CET 2007
Author: scoder
Date: Fri Dec 14 08:42:43 2007
New Revision: 49761
Modified:
lxml/trunk/ (props changed)
lxml/trunk/src/lxml/serializer.pxi
lxml/trunk/src/lxml/tests/test_etree.py
lxml/trunk/src/lxml/tests/test_sax.py
Log:
r3088 at delle: sbehnel | 2007-12-09 17:56:04 +0100
on serialisation: add new lines after root-level processing instructions and comments
Modified: lxml/trunk/src/lxml/serializer.pxi
==============================================================================
--- lxml/trunk/src/lxml/serializer.pxi (original)
+++ lxml/trunk/src/lxml/serializer.pxi Fri Dec 14 08:42:43 2007
@@ -236,12 +236,13 @@
# we are at a root node, so add PI and comment siblings
c_sibling = c_node
while c_sibling.prev != NULL and \
- (c_sibling.prev.type == tree.XML_PI_NODE or \
- c_sibling.prev.type == tree.XML_COMMENT_NODE):
+ (c_sibling.prev.type == tree.XML_PI_NODE or \
+ c_sibling.prev.type == tree.XML_COMMENT_NODE):
c_sibling = c_sibling.prev
while c_sibling != c_node:
tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
pretty_print, encoding)
+ tree.xmlOutputBufferWriteString(c_buffer, "\n")
c_sibling = c_sibling.next
cdef void _writeNextSiblings(tree.xmlOutputBuffer* c_buffer, xmlNode* c_node,
@@ -252,8 +253,9 @@
# we are at a root node, so add PI and comment siblings
c_sibling = c_node.next
while c_sibling != NULL and \
- (c_sibling.type == tree.XML_PI_NODE or \
- c_sibling.type == tree.XML_COMMENT_NODE):
+ (c_sibling.type == tree.XML_PI_NODE or \
+ c_sibling.type == tree.XML_COMMENT_NODE):
+ tree.xmlOutputBufferWriteString(c_buffer, "\n")
tree.xmlNodeDumpOutput(c_buffer, c_node.doc, c_sibling, 0,
pretty_print, encoding)
c_sibling = c_sibling.next
Modified: lxml/trunk/src/lxml/tests/test_etree.py
==============================================================================
--- lxml/trunk/src/lxml/tests/test_etree.py (original)
+++ lxml/trunk/src/lxml/tests/test_etree.py Fri Dec 14 08:42:43 2007
@@ -284,7 +284,7 @@
tostring = self.etree.tostring
XMLParser = self.etree.XMLParser
- xml = '<?test?><a><?A?><b><?B?><c/></b><?C?></a><?tail?>'
+ xml = '<?test?>\n<a><?A?><b><?B?><c/></b><?C?></a>\n<?tail?>'
f = StringIO(xml)
tree = parse(f)
Modified: lxml/trunk/src/lxml/tests/test_sax.py
==============================================================================
--- lxml/trunk/src/lxml/tests/test_sax.py (original)
+++ lxml/trunk/src/lxml/tests/test_sax.py Fri Dec 14 08:42:43 2007
@@ -44,9 +44,9 @@
xml_out)
def test_etree_sax_pi_root(self):
- tree = self.parse('<?this and that?><a>ab</a>')
+ tree = self.parse('<?this and that?>\n<a>ab</a>')
xml_out = self._saxify_serialize(tree)
- self.assertEquals('<?this and that?><a>ab</a>',
+ self.assertEquals('<?this and that?>\n<a>ab</a>',
xml_out)
def test_etree_sax_attributes(self):
More information about the lxml-checkins
mailing list