cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: XML Fragements in widgets
Date Wed, 11 May 2005 13:13:39 GMT
Reinhard Poetz wrote:

> Sylvain Wallez wrote:
>
>> Reinhard Poetz wrote:
>>
>>>
>>> I have the need for a widget that contains XML fragments. Those 
>>> fragements should also be streamed as XML and not as strings. How 
>>> can I achieve this? My first (and only) idea is implementing a new 
>>> widget type (XMLWidget). Or are there better solutions?
>>
>>
>>
>> I've had for months an unfinished and therefore uncommitted XML 
>> datatype on my hard disk and the associated convertors. Want to 
>> finish them?
>
>
> Sounds interesting but I'm not sure if this solves my problem. If I 
> have a widget that has the value "<someXML>bla</someXML>" I need it 
> serialized as
>
> <fi:field>
>   <fi:value>
>     <someXML>bla</someXML>
>   </fi:value>
> </fi:field>
>
> and not as
>
> <fi:field>
>   <fi:value>
>     &lt;someXML&gt;bla&lt;/someXML&gt;
>   </fi:value>
> </fi:field>
>
> After looking at Field.generateSAXFragement() (line 405) I don't think 
> that a special datatype or a convertor can help here as only the 
> string representation of the value is passed to the content handler:
>
> contentHandler.characters(stringValue.toCharArray(), 0, 
> stringValue.length());
>
> Therefore my conclusion that I need a special XML widget that can 
> produce more than character events, right?


Right. Unfortunate but right.

What's your use case? If it's of general interest, we could add some 
"xml aware" convertors that could produce a SAX stream additionally to a 
string:

interface XMLConvertor extends Convertor {
    convertToXML(Object value, Locale locale, FormatCache cache, 
ContentHandler handler)
}

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Mime
View raw message