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

Re: [xml] Incorrect character callback invocation?



 

On Fri, Aug 03, 2007 at 09:28:49PM +0530, Ashwin wrote:
> 
>    Ok  point  taken, 
 
  :-)
 
>    but  setting aside user defined entities. Something
>    like
> 
>    <element attr1= >missing AttValue in Attribute</element>
> 
>    also  exhibits  the same behaviour. Should it not return error, rather
>    than the character callback being invoked?
 
> paphio:~/XML -> ./testSAX test.xml 
> xmlSAXUserParseFile returned error 39
> SAX.setDocumentLocator()
> SAX.startDocument()
> SAX.error: AttValue: " or ' expected
> SAX.characters(missing AttValue in Attribute, 29)
> SAX.endDocument()
> xmlSAXUserParseFile returned error 39
> paphio:~/XML -> 
 
>  Dohhhh. This should not happen. You need the endDocument() to 
> help the application clear its context, but it should not push characters.
> I will investigate it is probably very easy. Thanks for pointinmg this out !
 
Hi,
  I am attaching the patch for the above problem……It was a minor fix..
 
Regards
Ashwin

 

 

 

 

 

 

 

 

*** parser.c	2008-01-24 06:50:04.000000000 -0800
--- parserfix.c	2008-02-22 23:01:08.000000000 -0800
*************** get_more_space:
*** 3551,3557 ****
  
  		    if ((ctxt->sax != NULL) &&
  		        (ctxt->sax->ignorableWhitespace !=
! 		         ctxt->sax->characters)) {
  			if (areBlanks(ctxt, tmp, nbchar, 1)) {
  			    if (ctxt->sax->ignorableWhitespace != NULL)
  				ctxt->sax->ignorableWhitespace(ctxt->userData,
--- 3551,3557 ----
  
  		    if ((ctxt->sax != NULL) &&
  		        (ctxt->sax->ignorableWhitespace !=
! 		         ctxt->sax->characters) && (!ctxt->disableSAX)) {
  			if (areBlanks(ctxt, tmp, nbchar, 1)) {
  			    if (ctxt->sax->ignorableWhitespace != NULL)
  				ctxt->sax->ignorableWhitespace(ctxt->userData,
*************** get_more_space:
*** 3564,3570 ****
  			        *ctxt->space = -2;
  			}
  		    } else if ((ctxt->sax != NULL) &&
! 		               (ctxt->sax->characters != NULL)) {
  			ctxt->sax->characters(ctxt->userData,
  					      tmp, nbchar);
  		    }
--- 3564,3570 ----
  			        *ctxt->space = -2;
  			}
  		    } else if ((ctxt->sax != NULL) &&
! 		               (ctxt->sax->characters != NULL) && (!ctxt->disableSAX)) {
  			ctxt->sax->characters(ctxt->userData,
  					      tmp, nbchar);
  		    }
*************** get_more:
*** 3598,3604 ****
  	    }
  	    nbchar = in - ctxt->input->cur;
  	    if (nbchar > 0) {
! 		if ((ctxt->sax != NULL) &&
  		    (ctxt->sax->ignorableWhitespace !=
  		     ctxt->sax->characters) &&
  		    (IS_BLANK_CH(*ctxt->input->cur))) {
--- 3598,3604 ----
  	    }
  	    nbchar = in - ctxt->input->cur;
  	    if (nbchar > 0) {
! 		if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
  		    (ctxt->sax->ignorableWhitespace !=
  		     ctxt->sax->characters) &&
  		    (IS_BLANK_CH(*ctxt->input->cur))) {
*************** get_more:
*** 3618,3624 ****
  		    }
                      line = ctxt->input->line;
                      col = ctxt->input->col;
! 		} else if (ctxt->sax != NULL) {
  		    if (ctxt->sax->characters != NULL)
  			ctxt->sax->characters(ctxt->userData,
  					      ctxt->input->cur, nbchar);
--- 3618,3624 ----
  		    }
                      line = ctxt->input->line;
                      col = ctxt->input->col;
! 		} else if (ctxt->sax != NULL && (!ctxt->disableSAX)) {
  		    if (ctxt->sax->characters != NULL)
  			ctxt->sax->characters(ctxt->userData,
  					      ctxt->input->cur, nbchar);


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