
I noticed a strange behavior, and can only describe it as the code I write is fully owned my those who employ me. I was utilizing an lxml iterator routine to go through all of the nodes in some xml documents to look for differences. Now, because of the rigor of this computation, I had decided to convert some of these elements to string using the etree function by the same name. What I have observed in practice, but not expected, is that sometimes the tostring function will append a carriage return to the output. This seems to occur when there is white space between the closing tag and the next tag, which in this case was another closing tag. So if I had two duplicate documents which I nicened using "xmllint --format filename" and added a carriage return to the second which was just outside of the closing tag, something like this might occur. So everything between tags would be precisely the same, and then an extra carriage return after end tag would cause the tostring to output different. I'm using a version of Python 2. I could probably post version of lxml and libxml2 additionally. Has anyone had this experience? Sent from my Planet
participants (2)
-
Alex Boese
-
Stefan Behnel