You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Adrian Herscu <bm...@fastmail.fm> on 2007/06/17 23:45:15 UTC

recover from document not found exceptions

Hi all,

I need to implement a validator in which one of its rules must check the 
existence of external documents. In case that an external document does 
not exist, a message should be created and the validation should 
continue. I couldn't find a way to make the XSLT engine continue after a 
FileNotFoundException has been thrown :-(

Is it possible to recover from a call to the document() function which 
has failed?

Adrian.


Re: recover from document not found exceptions

Posted by Henry Zongaro <zo...@ca.ibm.com>.
Hi, Adrian.

news <ne...@sea.gmane.org> wrote on 2007-06-18 11:36:18 AM:
> The spec says: "If there is an error retrieving the resource, then the 
> XSLT processor may signal an error; if it does not signal an error, it 
> must recover by returning an empty node-set." 
> [http://www.w3.org/TR/xslt#function-document]
> 
> I though that there is some "feature" or "property" that I can set in 
> order to get that recovery.

There is no such feature today.  You can open a feature request in 
Jira.[1]  Of course, all the contributors on this project are stretched 
pretty thinly; if you were able to contribute the implementation for such 
a feature or property, that would be greatly appreciated!

Thanks,

Henry
[1] http://issues.apache.org/jira/secure/CreateIssue!default.jspa
------------------------------------------------------------------
Henry Zongaro      XSLT Processors Development
IBM SWS Toronto Lab   T/L 969-6044;  Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com


Re: recover from document not found exceptions

Posted by Adrian Herscu <bm...@fastmail.fm>.
The spec says: "If there is an error retrieving the resource, then the 
XSLT processor may signal an error; if it does not signal an error, it 
must recover by returning an empty node-set." 
[http://www.w3.org/TR/xslt#function-document]

I though that there is some "feature" or "property" that I can set in 
order to get that recovery.

Adrian.

Santiago Pericas-Geertsen wrote:
> Adrian,
> 
>  Have you tried using a URIResolver [1]? That should give you some 
> control over how the processor resolves external references. For 
> example, you could return an "empty" Source when a resource isn't 
> available or something like that.
> 
> -- Santiago
> [1] http://java.sun.com/j2se/1.5.0/docs/api/
> 
> On Jun 17, 2007, at 5:45 PM, Adrian Herscu wrote:
> 
>> Hi all,
>>
>> I need to implement a validator in which one of its rules must check 
>> the existence of external documents. In case that an external document 
>> does not exist, a message should be created and the validation should 
>> continue. I couldn't find a way to make the XSLT engine continue after 
>> a FileNotFoundException has been thrown :-(
>>
>> Is it possible to recover from a call to the document() function which 
>> has failed?
>>
>> Adrian.
>>
> 
> 


Re: recover from document not found exceptions

Posted by Santiago Pericas-Geertsen <Sa...@Sun.COM>.
Adrian,

  Have you tried using a URIResolver [1]? That should give you some  
control over how the processor resolves external references. For  
example, you could return an "empty" Source when a resource isn't  
available or something like that.

-- Santiago 

[1] http://java.sun.com/j2se/1.5.0/docs/api/

On Jun 17, 2007, at 5:45 PM, Adrian Herscu wrote:

> Hi all,
>
> I need to implement a validator in which one of its rules must  
> check the existence of external documents. In case that an external  
> document does not exist, a message should be created and the  
> validation should continue. I couldn't find a way to make the XSLT  
> engine continue after a FileNotFoundException has been thrown :-(
>
> Is it possible to recover from a call to the document() function  
> which has failed?
>
> Adrian.
>