cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guido Casper" <gcas...@s-und-n.de>
Subject Re: SourcepropWritingTransformer
Date Wed, 27 Aug 2003 13:31:44 GMT
Gianugo Rabellino wrote:
> Guido Casper wrote:
>
>> However concerning interface design I think if you give the
following
>> input to SPWT:
>>
>>     <source:props>
>>       <my:author xmlns:my="my">Me, Myself and I</my:author>
>>     </source:props>
>>
>>
>> One would expect that
>>
>>       WebdavSource.getSourceProperty("my", "author").getValue();
>>
>> returns:
>>
>>       Me, Myself and I
>
> Yes, I see your point. It would be easy to get the value as a
string,
> but what happens if value is an XML fragment? I'm wondering if it's
> safe to assume that if you call getPropertyValueAsString you know
> what you're doing so that you know that there will be no nested XML.
> I'm also thinking about dealing separately with the two cases, so
> that when value is just element + text node return just the text
> node, and return the (String) XML representation otherwise so that
>
> <my:author xmlns:my="my">Me, Myself and I</my:author>
>
> returns
>
> Me, Myself and I
>
> and
>
> <my:author xmlns:my="my">
> <my:firstname>Me</my:firstname>
> <my:lastname>Myself and I</my:lastname>
> </my:author>
>
> returns the untouched XML. Is that overcomplicated?

I would vote now to leave SourceProperty as it is (except fixing
the setValue(String value) method) and cleanup
WebDAVSource.getSourceProperty/ies() with (something like):

    return new SourceProperty(prop.getElement());

InspectableSource implementations without XMLized properties would
have to serialize the XML themselves (in a way they want it to be).
Actually that is what you would have to do then in
WebDAVSource.setSourceProperty() (serializing the XML) since the
WebDAVResource class (of the slide lib) only supports setting
properties via Strings (it's a bit inconsistent in this regard).

But that way you can easily switch SPWT from startTextRecording() to
startRecording().

WebDAVSource.getSourceProperty() also needs to be changed to request
only the wanted property from the WebDAV server and not all
properties.

Another thing we have to agree on is the namespace of SPWT which
currently is:
http://apache.org/cocoon/propwrite/1.0

and of course the name of SourcepropsWritingTransformer itself :-)

Guido


Mime
View raw message