Re: [xml] strange behaviour of SAX characters callback

On Tue, Sep 17, 2002 at 11:35:36AM +0100, Vladimir F. wrote:
Hi Guys,

I'm new subsriber to this list and want to address the
question about using SAX.

So, there is callback "characters" and I'm trying to use
it to get content of the element like:


But I noticed that "characters" callback is called
twice for content "vas00001-sub". One call gets me content
like "\r\n<n-spaces>vas00001-sub..." another just

If I remove "\r\n" sequence (which is after "vas0001-sub")
this callback is called just once as it was expected.

How can I force this callback to be called just once for
my elements (independent of the number of spaces, new_lines, etc.
in the content).

  Sorry, you can't ... You have to assume that you may get multiple
characters() callback, it's an optimization related to end of line character
normalization, and also  because I don't want to grow a possibly infinite
buffer in the parser when operating in SAX mode.


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]