[Yanel-dev] different schemes in yanel

Josias Thöny josias.thoeny at wyona.com
Mon Jan 14 16:53:34 CET 2008


Evaldas Taroza wrote:
> 
> 
> Josias Thöny wrote:
>> Evaldas Taroza wrote:
>>> Hi,
>>>
>>> I am trying to understand how I can programmatically access a 
>>> resource in Yanel without passing it through HTTP.
>>>
>>> Can anyone explain how yanelrepo: and yanelreource: schemes are 
>>> working? For instance I have an XML resource (extends 
>>> BasicXMLResource) for which I get content as specified in the 
>>> parameter. I need a class which transparently gives me an XML with 
>>> any given URI in the repository, for example, the parameters for my 
>>> resource can be
>>> 1. my.xml
>>> 2. yanelrepo:/my.xml
>>> 3. yanelresource:/my.xml
>>>
>>> Is there anything like:
>>> InputStream is = new NodeInRepository(paramURI).getContents();
>>
>> The yanelrepo protocol can be used to access a repository node, and 
>> the yanelresource protocol can be used to access a resource view (it's 
>> like calling getView() on the resource).
>>
>> I'm not sure which protocol you need. Be aware that a repository node 
>> does not necessarily correspond to a resource. I mean a resource may 
>> store its content in a repo node, but it doesn't have to. Moreover the 
>> path of the resource does not have to be the same as the repository 
>> path. It depends on the resource implementation.
>>
>> If you want to resolve a URI like e.g. yanelrepo:/my.xml, you can use 
>> the SourceResolver:
>>
>> SourceResolver resolver = new SourceResolver(resource);
>> Source source = resolver.resolve("yanelrepo:/my.xml", null);
>> InputStream is = SAXSource.sourceToInputSource(source).getByteStream();
> 
> Thanks, this was helpful.
> I just don't understand why XInclude is needed for Yanel. There is:
> 
> //Set an object that will be used to resolve URIs used in document().
> void javax.xml.transform.Transformer.setURIResolver(URIResolver)
> 
> The URIResolver can be the SourceResolver.

I think we could have used document() with a resolver. I guess we didn't 
think about this alternative because of our cocoon/lenya background, 
where xinclude is used frequently.

One advantage of xinclude is that you can put it also into the content 
xml, not only into the xsl.

One day we will have to set an URIResolver on the transformer anyway, to 
allow including another xslt.

Feel free to file an enhancement bug.

josias

> 
> Evaldas
> _______________________________________________
> Yanel-development mailing list
> Yanel-development at wyona.com
> http://lists.wyona.org/cgi-bin/mailman/listinfo/yanel-development



More information about the Yanel-development mailing list