Re: Saxon on .NET: How to provide a XmlResolver for documents returned by collection()?

O'Neil Delpratt <oneil-JkSD5nQpfvpWk0Htik3J/[email protected]> Fri, 18 Dec 2020 12:03:27 +0000
Newsgroups gmane.text.xml.saxon.help
Message-ID <[email protected]>
Hi Emanuel,

We have added the CollectionFinder feature to .NET which should be available in the next maintenance release, but was wondering if the current method: RegisterCollection(Uri collectionURI, IEnumerable content) could work for what you are doing?

See: https://www.saxonica.com/html/documentation/dotnetdoc/Saxon/Api/Processor.html#RegisterCollection(Uri,IEnumerable) <https://www.saxonica.com/html/documentation/dotnetdoc/Saxon/Api/Processor.html#RegisterCollection(Uri,IEnumerable)>

kind regards,

O'Neil

> On 26 Nov 2020, at 06:35, Emanuel Wlaschitz <[email protected]> wrote:
> 
> Thanks O'Neil!
>  
> I wonder how accurate this is though - it does have one, and it is called; but the more we read up about it we're more uncertain if thats even the place we should be looking at.
>  
> - Emanuel
>  
> From: O'Neil Delpratt <oneil-JkSD5nQpfvpWk0Htik3J/[email protected]> 
> Sent: Wednesday, November 25, 2020 23:55
> To: Mailing list for the SAXON XSLT and XQuery processor <[email protected]>
> Subject: Re: [saxon] Saxon on .NET: How to provide a XmlResolver for documents returned by collection()?
>  
> Hi Emmanuel,
>  
> Thanks for reporting this bug issue. The .NET product does not have its own CollectionFinder, which it should have had as in the Java product.
>  
> I have created the following bug issue to track progress:
>  
> https://saxonica.plan.io/issues/4839 <https://saxonica.plan.io/issues/4839>
>  
> kind regards,
>  
> O'Neil
> 
> 
> On 25 Nov 2020, at 13:00, Emanuel Wlaschitz <[email protected] <mailto:[email protected]>> wrote:
>  
> We've recently started to make more and more use of the collection() function and its ability to iterate files in a folder, which made a lot of custom C# code obsolete that we had to use in the past.
> While trying to replace (a lot more) code with (a lot less) XSLT calling collection(), we ran into the following error (which results in the transformation to fail): 
> 
> collection(): failed to parse XML file file:/D:/Test/sample1.xml: I/O error reported by XML parser processing file:/D:/Test/sample1.xml: Could not find file 'D:\Test\doctype.dtd'.
> 
> Obviously, that folder does not contain doctype.dtd (which is referenced by the DOCTYPE declaration of sample1.xml, as System ID); and for the most part we don't want (or need) it there.
> And for other purposes (which was mainly document() in the past) we've registered a XmlResolver as XsltTransformer.InputXmlResolver that redirects (and/or ignores) all requests for DTD or XSD files.
> 
> However, it appears the default CollectionFinder does not use XsltTransformer.InputXmlResolver; otherwise we wouldn't be seeing that error.
> We've also looked into implementing our own CollectionFinder (or rather: deriving from StandardCollectionFinder so we don't have to implement everything from scratch), but we couldn't find the appropriate place to plug in our code.
> The only thing that seemed remotely related was the context parameter in findCollection, but its uriResolver field was null.
> 
> And that's where our adventure ended, so we turned to the ML:
> 
> How can we get our custom XmlResolver into the default CollectionFinder?
> If that's not how it works, where would we plug our own code in a custom CollectionFinder?
> Also, after looking at "Writing your own Collection Finder": Is this even what we should be doing? The Collection Finder returns resources (as a sequence of URIs), not documents.
> 
> In case it matters, we've tried this on Saxon-HE 9.9.1.2N and 10.2N, but we plan on moving to 10.3N soon.
> 
> Thanks in advance,
> Emanuel
> 
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/ <http://saxon.markmail.org/>
> [email protected] <mailto:[email protected]>
> https://lists.sourceforge.net/lists/listinfo/saxon-help <https://lists.sourceforge.net/lists/listinfo/saxon-help>
>  
> -------------------------------
> O'Neil Delpratt
> Software Developer, Saxonica Limited 
> Email: oneil-JkSD5nQpfvpWk0Htik3J/[email protected] <mailto:oneil-JkSD5nQpfvpWk0Htik3J/[email protected]>
> Twitter: https://twitter.com/ond1 <https://twitter.com/ond1>
> Tel: +447859044188
> Web: http://www.saxonica.com <http://www.saxonica.com/>
> Saxonica Community site: http://dev.saxonica.com <http://dev.saxonica.com/>
> Bug tracking site: https://saxonica.plan.io/ <https://saxonica.plan.io/>
>  
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/saxon-help 



-------------------------------
O'Neil Delpratt
Software Developer, Saxonica Limited 
Email: oneil-JkSD5nQpfvpWk0Htik3J/[email protected]
Twitter: https://twitter.com/ond1
Tel: +447859044188
Web: http://www.saxonica.com
Saxonica Community site: http://dev.saxonica.com
Bug tracking site: https://saxonica.plan.io/

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help