[Expat-bugs] Linefeed as part of chardata

Fred L. Drake, Jr. fdrake at acm.org
Thu Jan 2 13:39:51 EST 2003

Roskanuk Michal writes:
 > I work on some parser, which needs to handle LF's as part of tag value,
 > but expat (1.95.5 win32) returns LF only if it's a first character AND
 > strips the rest. When LF is in the middle of contents, then it's taken
 > as end of chardata block. As i understand the XML specification LF is
 > legal part of chardata (see 2.2) or am i wrong?

This sounds like you're not collecting character data but trying to
handle complete content in the handler.  That won't work; the handler
is called several times for stretches of PCDATA that include newlines;
you'll need to collect each 'chunk' and then process it once you have
it all.


Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation

More information about the Expat-bugs mailing list