Convert XML strings to "plan text"?

3 views
Skip to first unread message

Matt

unread,
Nov 18, 2008, 4:46:40 PM11/18/08
to vim_use
I am working with a monitoring tool that exports events to XML. In
many cases, long XML strings are part of the event detail, thus I wind
up with XML inside of XML where some characters are escaped (ex.
"'<ROOT><E Empl=" is represented as "&apos;&lt;ROOT&gt;&lt;E Empl=").

Is there a simple method or plugin that will allow the interior XML
strings to be selected, and translated back their original form (non-
escaped)?

David Fishburn

unread,
Nov 19, 2008, 8:48:33 AM11/19/08
to vim...@googlegroups.com

I would just write a function that would do the following:
:%s/\&gt;/>/g
:%s/\&lt;/</g
...

Then you can run it at any time.

Dave

Tony Mechelynck

unread,
Nov 19, 2008, 9:58:55 AM11/19/08
to vim...@googlegroups.com

For the general case (as with &apos; in the example) you would nead a
dictionary of all symbolic entity-names, and a function to translate
entities on the base of that plus Unicode codepoint numbers in decimal
&#1234; and hex &#xABCD; -- and that wouldn't be as simple.


Best regards,
Tony.
--
The software said it requires Windows 95 or better, so I installed Linux.

Reply all
Reply to author
Forward
0 new messages