On Tue, 26 Aug 2003, Gianugo Rabellino wrote:

> A source property (both in webdav sense and in the  SourceProperty
> implementation) is made of three part: a local name (String), a
> namespace (String) and a value (DOM Element). It's worth noticing that
> the property value is actually the *holder element* plus it's value
> (that is a text node - in case of a string value - or other Elements),
> so that effectively you get, in case of webdav,
>
> <getcontenttype xmlns="DAV:">text/xml</getcontenttype>
>
> All this said, I fail to understand why this transformer is somehow
> reinveinting XML by using this syntax:
>
> <source:prop name="author" namespace="meta">me</source:prop>

+1

> which forces, besides, to use a very risky solution to rebuild the property:
>
>    String pre = "<"+name+" xmlns="+quote+namespace+quote+">";
>    String post = "</"+name+">";
>    String xml = pre+value+post;
>    StringReader reader = new StringReader(xml);
>    Document doc = parser.parseDocument(new InputSource(reader));
>    SourceProperty property = new SourceProperty(doc.getDocumentElement());
>    ((InspectableSource)source).setSourceProperty(property);
>
> One of my biggest no-no is not to use string manipulation to build XML:
> this algo would fail in case the element has any XML reserver characters
> or is an XML property value with nested elements.

I must use the string manipulation in the Slide block, because the
properties were stored in Slide in a very unusual manner. It was
a PITA. But the WebDAV implementation should handle this easier, I think.

Stephan.

Reply via email to