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:

<mm7:TransactionID
xmlns:mm7="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-0";
env:mustUnderstand="1">
    vas00001-sub
</mm7:TransactionID>

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
"\r\n...".

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

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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