[Expat-bugs] [ expat-Bugs-1506891 ] XML_SetCharacterDataHandler callback function not parsing

SourceForge.net noreply at sourceforge.net
Fri Jun 16 20:07:22 CEST 2006


Bugs item #1506891, was opened at 2006-06-15 15:08
Message generated for change (Comment added) made by sketkar
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110127&aid=1506891&group_id=10127

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: Test Required
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: XML_SetCharacterDataHandler callback function not parsing

Initial Comment:
Hello,

I have a XML_SetCharacterDataHandler callback function
that uses the text to build a directory path.  I have
noticed that at times the 1st node or last node will
result in a partial capture of the text. 

example.

<directory>my-57/actual image/</directory>

will return with "my-57/actual" only.  I've attached my
callback functions, startelement, endelement and
dataelement.  

Thank you,

Satyajit


----------------------------------------------------------------------

Comment By: sssketkar man! (sketkar)
Date: 2006-06-16 13:07

Message:
Logged In: YES 
user_id=944435

Okay, I changed my approach, so that the StartElementHandler
sets a flag that is used by the CharacterHandler to collect
user text until the EndElementHandlers is called at which
point the buffered text is retreived.  This approach seems
to work expect for the last "iteration", i.e if there are 5
nodes, the first 4 are parsed properly.  The last one is
still not getting buffered all the way or correctly.

Here is a debug output from each Handler...

START: tool
START: tooladdress
END: tooladdress
START: imageid
END: imageid
START: directory
END: directory
XXY-WER/Actual Image/          <-- correct 
END: tool
START: tool
START: tooladdress
END: tooladdress
START: imageid
END: imageid
START: directory
END: directory
XYZ-W3/Actualage//e/        <-- not so correct
END: tool

As you can see the last tool node directory is incorrect, it
should have been XYZ-W3/Actual Image/

Thank you,

Satyajit

----------------------------------------------------------------------

Comment By: sssketkar man! (sketkar)
Date: 2006-06-15 17:42

Message:
Logged In: YES 
user_id=944435

Thank you very much.  I was expecting that the
CharacterHandler was collecting all non-XML data in 1-shot.
 I wasn't using the EndElement as a check.  I'll try that.

Satyajit


----------------------------------------------------------------------

Comment By: Karl Waclawek (kwaclaw)
Date: 2006-06-15 16:52

Message:
Logged In: YES 
user_id=290026

Do not expect Expat to return all character data within an
element in one call-back. You have to accumulate the text in
a buffer until the end-tag is reported. Are you doing this?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110127&aid=1506891&group_id=10127


More information about the Expat-bugs mailing list