[Yanel-dev] different schemes in yanel

Evaldas Taroza etaroza at optaros.com
Mon Jan 14 14:40:10 CET 2008



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.

Evaldas


More information about the Yanel-development mailing list