[Yanel-dev] Another namespace problem with the XML resource

Josias Thöny josias.thoeny at wyona.com
Wed Aug 15 13:18:26 CEST 2007


Michael Wechner wrote:
> Josias Thöny wrote:
> 
>> Michael Wechner wrote:
>>
>>> Hi
>>>
>>> Is it possible that if no XSLT is being applied when using the XML 
>>> resource, that all namespaces are being stripped off, e.g.
>>>
>>> the original
>>>
>>> <service xmlns="http://www.w3.org/2007/app" 
>>> xmlns:atom="http://www.w3.org/2005/Atom">
>>>  <workspace title="Yulup Website">
>>>    <atom:title type="text">Yulup Website</atom:title>
>>>    <collection title="Releases" 
>>> href="release-atom-entries/?yanel.resource.viewid=atom">
>>>      <atom:title type="text">Releases</atom:title>
>>>    </collection>
>>>    <collection title="News" 
>>> href="../news-entries/?yanel.resource.viewid=atom">
>>>      <atom:title type="text">News</atom:title>
>>>    </collection>
>>>  </workspace>
>>> </service>
>>>
>>> is being delivered as
>>>
>>> <service>
>>>  <workspace title="Yulup Website">
>>>    <atom:title type="text">Yulup Website</atom:title>
>>>    <collection title="Releases" 
>>> href="release-atom-entries/?yanel.resource.viewid=atom">
>>>      <atom:title type="text">Releases</atom:title>
>>>    </collection>
>>>    <collection title="News" 
>>> href="../news-entries/?yanel.resource.viewid=atom">
>>>      <atom:title type="text">News</atom:title>
>>>    </collection>
>>>  </workspace>
>>> </service>
>>>
>>>
>>> Any idea what might be wrong?
>>
>>
>> I'm able to reproduce the problem, and I found this workaround:
>>
>> add this line to BasicXMLResource.java at line 119:
>>
>> xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", 
>> true);
> 
> 
> that seems to work, thanks very much.
> 
>>
>> However I'm not sure if this is a good solution.
> 
> 
> why not?

Our XMLSerializer expects that an element in the SAX stream with a 
namespace either has an attribute which declares this namespace (or one 
of the ancestors has such an attribute).
AFAIK this is not required in a SAX stream, and apparently the default 
of the Xerces XMLReader is to omit the namespace declaration attributes.
This has been changed by the above setFeature(...) line, but if someone 
uses our serializer in a different situation, the same problem may occur 
again.

> 
>> I guess the "correct" solution would be to implement namespace 
>> normalization in the XMLSerializer. But that might be a lot of work...
> 
> 
> have we a bug/task entry for this already?

I just filed a bug:

http://bugzilla.wyona.com/cgi-bin/bugzilla/show_bug.cgi?id=5458

Josias

> 
> Cheers
> 
> Michi
> 
>>
>> Josias
>>
>>
>>
>>>
>>> Thanks
>>>
>>> Michi
>>>
>>
>> _______________________________________________
>> 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