[OSM-dev] Odd data in daily diffs (potlatch related?)
Brett Henderson
brett at bretth.com
Mon Mar 31 23:03:35 BST 2008
Martijn van Oosterhout wrote:
> On Mon, Mar 31, 2008 at 12:26 PM, Brett Henderson <brett at bretth.com> wrote:
>
>> Anyway, yell if anybody violently disagrees and thinks there is a bug
>> that needs fixing in osmosis.
>>
>
> While I agree in general, osmoss does currently make the assumption
> that any character that appears in a string in the database is
> automatically valid XML. I would have expected the XML output creater
> to have escaped it to at least.
>
> However, if we determine that we don't want characters < 32 in the
> database then there's no problem. I assume XML accepts newlines inside
> attributes OK; I can imagine a case being made for then at some point.
>
> Have a nice day,
>
Ah, I didn't realise I had a problem with escaping. I'm hesitant to
hack the parser when it is working correctly, but if I'm not escaping
data correctly on output then that must be fixed. The class
ElementWriter defines the following replacements for characters.
xmlEncoding.put(new Character('<'), "<");
xmlEncoding.put(new Character('>'), ">");
xmlEncoding.put(new Character('"'), """);
xmlEncoding.put(new Character('\''), "'");
xmlEncoding.put(new Character('&'), "&");
xmlEncoding.put(new Character('\n'), "
");
xmlEncoding.put(new Character('\r'), "
");
xmlEncoding.put(new Character('\t'), "	");
Perhaps this list should be extended. That's a fairly straightforward
change.
Does anybody know of a library suitable generating output xml in a
streamy fashion? Perhaps I shouldn't be rolling my own like this.
Brett
More information about the dev
mailing list