Martijn van Oosterhout wrote:
> On Mon, Mar 31, 2008 at 12:26 PM, Brett Henderson <[EMAIL PROTECTED]> 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 &#27; 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('<'), "&lt;");
xmlEncoding.put(new Character('>'), "&gt;");
xmlEncoding.put(new Character('"'), "&quot;");
xmlEncoding.put(new Character('\''), "&apos;");
xmlEncoding.put(new Character('&'), "&amp;");
xmlEncoding.put(new Character('\n'), "&#xA;");
xmlEncoding.put(new Character('\r'), "&#xD;");
xmlEncoding.put(new Character('\t'), "&#x9;");

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


_______________________________________________
dev mailing list
[email protected]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev

Reply via email to