[xml] behaviour of SAX "characters" callback
- From: "Vladimir F." <faidenv logica com>
- To: xml gnome org
- Subject: [xml] behaviour of SAX "characters" callback
- Date: Wed, 27 Nov 2002 13:58:38 +0000
Hi Guys,
Sorry, it looks big, but anyway,
I want to address the question about SAX parser behaviour.
(the question itself is at the end of this mail).
There is "characters" callback (or handler) function in
xmlSAXHandler structure. I'm trying to use this handler to
process some elements of my interest. So as soon as SAX found
such an element I set "characters" callback to my handler function
expecting that SAX will call this my assigned handler afterwords.
But I noticed that this handler is called ONLY if the next symbol
after element is NOT '<'
So, the question is:
is it possible to switch on/off such behaviour of SAX, or
"characters" callback is designed to be called (if assigned) ONLY for
elements wich have some NON-xml content ?
--------
Example:
suppose we expect <submitReq> element in XML input data stream and
element handler is like this:
void process_submit(void *cbarg,
const xmlChar *data,
int data_len)
{
msg->messgeType = SUBMIT_REQ;
submit = malloc(sizeof(struct submit));
....
msg->data = submit;
return;
}
then, as soon as SAX found this element we do like this:
my_parser->sax->characters = process_submit;
But next, SAX will call (or call not) process_submit() depending on
formating of input XML stream, so
1. process_submit() is not called here (because there is '<' of 'sender'
element after <submitReq>):
<submitReq><sender>a b com</sender></submitReq>
2. but process_submit() is called here (because there is '\r' after
<submitReq>):
<submitReq>\r\n<sender>a b com</sender>\r\n</submitReq>
--regards,
Vladimir
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain
proprietary material, confidential information and/or be subject to legal privilege. It should not be
copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please
promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]