I have a log file with lots of web service XML data (example follows). Ideally I would like to just go to a line and type ,x
to create pretty formatted XML for readability.
Response XML: <ZZZZZ_EXBListLocalEftposRS xmlns="http://types.wise.zzzzz.com/2005/06"><PayLoad><TimeStamp>2015-04-07T10:25:18.797+12:00</TimeStamp></PayLoad><Success/><EftposTerminalID CurrentlyMapped="true" ProbablyLocal="true">TEST_EFTD</EftposTerminalID><EftposTerminalID CurrentlyMapped="true" ProbablyLocal="true">TEST_EFT</EftposTerminalID><EftposTerminalID CurrentlyMapped="false" ProbablyLocal="false">TESTBadD1</EftposTerminalID><EftposTerminalID CurrentlyMapped="false" ProbablyLocal="false">TESTBadD2</EftposTerminalID><EftposTerminalID CurrentlyMapped="false" ProbablyLocal="false">TESTBadD3</EftposTerminalID><EftposTerminalID CurrentlyMapped="false" ProbablyLocal="false">TESTBadNoP</EftposTerminalID><EftposTerminalID CurrentlyMapped="false" ProbablyLocal="false">TESTBadS</EftposTerminalID><EftposTerminalID CurrentlyMapped="false" ProbablyLocal="false">TESTBadS2</EftposTerminalID><EftposTerminalID CurrentlyMapped="false" ProbablyLocal="false">TESTBadS3</EftposTerminalID><EftposTerminalID CurrentlyMapped="false" ProbablyLocal="false">TESTBadS4</EftposTerminalID><EftposTerminalID CurrentlyMapped="false" ProbablyLocal="false">TESTBadS5</EftposTerminalID><EftposTerminalID CurrentlyMapped="false" ProbablyLocal="false">TESTBadS6</EftposTerminalID><EftposTerminalID CurrentlyMapped="false" ProbablyLocal="true">TESTBadScl</EftposTerminalID><EftposTerminalID CurrentlyMapped="false" ProbablyLocal="false">TESTBadTyp</EftposTerminalID></ZZZZZ_EXBListLocalEftposRS>
Currently, I can format the line as follows
- put the XML stuff on a new line (If you don't do this xmllint has problems)
- get the line number I need (199 in this case)
call xmllint.exe as follows:
:199 :!C:\apps\xmllint.exe % --format
Is there some way to automate some or all of this process?
I'm using gvim on windows, and xmllint.exe from google code.