[Yanel-dev] XML Resource serializer problem

Josias Thöny josias.thoeny at wyona.com
Mon Jan 7 09:36:42 CET 2008


Michael Wechner wrote:
> Michael Wechner wrote:
> 
>> Hi
>>
>> It seems to me that the XML resource has still some troubles re 
>> serializer in some cases. For instance when I try to serve some APP 
>> service document with mime type application/atomsvc+xml and it 
>> contains some XHTML snippets, then the APP namespace is being replaced 
>> by the XHTML namespace
>>
>> http://127.0.0.1:8080/yanel/yulup-demo/atom/entries/introspection-.xml
>>
>> resp.
>>
>> http://demo.yulup.org/atom/entries/introspection-.xml
>>
>>
>> <?x
>>  ml version="1.0"?>.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
>> Strict//EN" "http://www.w3.org/T
>>  R/xhtml1/DTD/xhtml1-strict.dtd">.<service 
>> xmlns="http://www.w3.org/1999/xhtml">.  <workspace tit
>>  le="Yulup Demo">.    <title type="text">Yulup Demo</title>..    
>> <collection title="Releases" hre
>>  f="../entries/?yanel.resource.viewid=atom">.      <title 
>> type="html">Early Yulup &lt;i>Releases&
>>  lt;/i></title>..    </collection>...  </workspace>..  <workspace 
>> title="Yulup Website">.    <tit
>>  le type="text">Yulup Website</title>..    <collection 
>> title="Releases" href="http://www.yulup.or
>>  g/download/release-atom-entries/?yanel.resource.viewid=atom">.      
>> <title type="xhtml"><div>Yul
>>  up <b>Releases</b></div>.</title>..    </collection>...  
>> </workspace>..</service>
>>
>>
>> whereas this doesn't happen when setting the mime type to 
>> application/xml within the resource config of this particular 
>> document. Also please note it doesn't happen for
>>
>> http://www.yulup.org/download/introspection-atom.xml
>>
>> or
>>
>> http://www.yulup.org/news-entries/introspection-atom.xml
>>
>> Any idea what might be wrong?
> 
> 
> it seems to me that
> 
> src/impl/java/org/wyona/yanel/impl/resources/BasicXMLResource.java
> 
> should retuen the view if no XSLT has been set

I don't understand what you mean with "return the view". Which view?

> 
> String[] xsltPaths = viewDescriptor.getXSLTPaths();
>            if (xsltPaths == null || xsltPaths.length == 0) {
>                xsltPaths = getXSLTPath(getPath());
>            }
> 
> whereas I have noticed that even if no XSLT is being configured 
> xsltPaths won't be null, because
> 
>    protected String[] getXSLTPath(String path) throws Exception {
>        String[] xsltPath = getResourceConfigProperties("xslt");
>        if (xsltPath != null) return xsltPath;
>        log.info("No XSLT Path within: " + path);
>        return new String[0];
> 
> but I'm not sure if this really makes sense (only maybe because if one 
> still wants to apply the i18n Transformer, but that has actually nothing 
> to do with the XSLTs.
> 
> WDYT?

I think it makes sense for this method to return an empty array instead 
of null. It makes it easier for the caller, and it's something like best 
practice.
Or maybe I just don't understand what the problem is...

josias

> 
> Thanks
> 
> Michi
> 
>>
>> Thanks
>>
>> Michi
>>
> 
> 



More information about the Yanel-development mailing list