xerces-j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sandy Gao" <sandy...@ca.ibm.com>
Subject Re: Error recovery while parsing XMLs ..
Date Mon, 07 Apr 2003 13:42:04 GMT
But how would the parser know the input is not

  <icon >
   <small-icon>stillTypingMygif
   <large-icon>/tmp/large.gif</large-icon>
   </small-icon>
  </icon>

in which case adding </small-icon> before <large-icon> is worse.

In dealing with errors (especially well-formedness ones), the best the
parser can do is to make a guess, which can't be guaranteed to be the best
in all cases.

Thanks,
Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
sandygao@ca.ibm.com



                                                                                         
                                      
                      Rajiv Shivane                                                      
                                      
                      <murgus@yahoo.com        To:       xerces-j-dev@xml.apache.org  
                                         
                      >                        cc:       xerces-j-user@xml.apache.org 
                                         
                                               Subject:  Re: Error recovery while parsing
XMLs ..                               
                      04/04/2003 04:02                                                   
                                      
                      AM                                                                 
                                      
                      Please respond to                                                  
                                      
                      xerces-j-dev                                                       
                                      
                                                                                         
                                      
                                                                                         
                                      



Hi Neeraj,

Thanks for the prompt reply. I had tried this feature.
But I am not sure if continue-on-error is same as
error-recovery. When we continue on error, the parser
does not seem to take the grammar into consideration
and hence generates lots of spurious errors. On error
recovery I would expect the parser to proceed in a
normal fashion. But, you recommend it only at
development time as there are no guarantees on normal
operation of the parser after a recovery and since it
might result in infinite loops.

For example for the following document framgment:

  <icon >
   <small-icon>stillTypingMygif
   <large-icon>/tmp/large.gif</large-icon>
  </icon>

the content model for small-icon has only #PCDATA. I
would expect the parser to recover by inserting
</small-icon> into the stream before encountering
<large-icon>. But the parser recovers by changing
</icon> to </small-icon>. This results in cascading
spurious errors.

How does the error recovery work? Could you give me
some pointers as to where I can look for it in the
sources? All I could see was that in case of a fatal
error if the feature is set, then the saxexception is
not propagated.

Would appreaciate any suggestions/pointers you can
provide.

Thanks!
Rajiv

--- Neeraj Bajaj <neeraj.bajaj@sun.com> wrote:
>
> set the following  feature to true.
>
http://apache.org/xml/features/continue-after-fatal-error
>
> You should be completely aware of the fact that
> there is no guarntee
> that parser will behave in normal fashion after
> encountering fatal
> error. It is advisable to use this feature only
> during development time
> and NEVER at the production time. XML document
> should be corrected as
> the first step. Please read the feature
> documentation [1] for more detail.
>
>
> [1] http://xml.apache.org/xerces2-j/features.html
>
>
> Neeraj
>
>

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Mime
View raw message