https://play.golang.org/p/W5cQkqS0h_

On Monday, January 30, 2017 at 9:06:49 AM UTC-7, Henrik Johansson wrote:
>
> I am truly sorry for resurrecting this old thread but I found my self 
> needing to emit xml containing:
>
> <a id="an_id" another_attr="some_value" /> 
>
> today and I am unsure how to deal with it.
>
> I have to do it for legacy reasons and there is very little leeway in what 
> the clients can accept.
> It is also high volumes and no files are generated so post processing 
> using files is not really an option.
>
> Any ideas how to do this? Is it perhaps solved since this time but the xml 
> has so little use that it's not even googlable?
>
> Thx,
>
> Den onsdag 9 maj 2012 kl. 18:23:12 UTC+2 skrev Glenn Brown:
>>
>> I suggest creating a custom Writer to post-process the XML stream to 
>> merge <X></X> into <X/>.  Conceptually: 
>>         $ echo '<_F00></_F00>' | sed -e 's@<\([^>]*\)></\1>@<\1/>@g' 
>>         <_F00/> 
>> However, done right, you need to worry about XML quoting, in case you run 
>> across 
>>         <X Y="<_F00></_F00>"> 
>> Also, Go regexp does not support back references, so don't try the 
>> regular expression above with it. 
>>
>> --Glenn
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to