[ expat-Patches-567400 ] Patch for cdataSectionProcessor

noreply@sourceforge.net noreply@sourceforge.net
Thu Jun 13 05:57:01 2002


Patches item #567400, was opened at 2002-06-11 09:48
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=310127&aid=567400&group_id=10127

Category: None
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Karl Waclawek (kwaclaw)
Assigned to: Karl Waclawek (kwaclaw)
Summary: Patch for cdataSectionProcessor

Initial Comment:
This patch applies to bug # 441449.

It seems that doContent() should be called with
startTagLevel = 0 for the document entity, and
startTagLevel = 1 for external entities.

This is how contentProcessor() and
externalEntityContentProcessor() are doing it.

So, I propose to change cdataSectionProcessor like
this:
...
if (start) {
  if (parentParser) {
    processor = externalEntityContentProcessor;
    return externalEntityContentProcessor(parser, 
      start, end, endPtr);
  }
  else {
    processor = contentProcessor;
    return contentProcessor(parser,
      start, end, endPtr);
  }
}
...

This seems to fix at least the bug demo example
supplied with bug # 441449.

The patch requires that parentParser is always set
for external entities, therefore it will only
work on newer versions of Expat (1.95.3+).

I also found a small bug that needs fixing:

In function ExternalEntityparserCreate(),
the assignment to parentParser should
be pulled out of the conditional section,
like this:

...
  parentParser = oldParser;   
#ifdef XML_DTD
  paramEntityParsing = oldParamEntityParsing;
  prologState.inEntityValue = oldInEntityValue;  
  // parentParser = oldParser;   -> move out of here
  if (context) {
#endif /* XML_DTD */
...


Karl






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

>Comment By: Karl Waclawek (kwaclaw)
Date: 2002-06-13 08:56

Message:
Logged In: YES 
user_id=290026

Patch checked in.

Karl

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

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=310127&aid=567400&group_id=10127