Posted by & filed under Uncategorized.

If you’re like me, you absolutely hate having to read XML all on one line, or poorly formatted. Whats the best way to clean up markup languages you ask? Tidy, of course! But, tidy likes to add weird formatting, HTML, etc, and pretty much mangles any XML that it touches…

Well, here’s some settings for your Tidy INI file which will prevent this from happening. Apply these settings to your Tidy configuration file in Notepad++ (Directory below), and reload the program. Then select Clean Indent XML from the Tools/Tidy menu and you’re on your way to non-mangled beautiful XML in no time! Keep in mind though, this doesn’t fix structure, just whitespace, garbage in, garbage out.

C:Program Files (x86)Notepad++pluginsConfigtidyTIDYCFG.INI
[Clean Indent XML]
input-xml: yes
bare:no
clean:no
fix-bad-comments:no
fix-backslash:no
indent:yes
indent-attributes:no
indent-spaces:4
char-encoding:raw
replace-color:no
wrap:0
wrap-asp:no
wrap-jste:no
wrap-php:no
write-back:yes

Thomas Hunter II

Thomas is the author of Advanced Microservices and a prolific public speaker with a passion for reducing complex problems into simple language and diagrams. His career includes working at Fortune 50's in the Midwest, co-founding a successful startup, and everything in between.
  • Gerben

    Awesome, this looks way better. Thank you!

  • Diana

    Thank you, it works like a charm :)

  • Ando

    Works great. Thanks a lot!!!

  • Linn

    That’s work perfectly. Many Thanks!!!

  • Merkan

    Great, but..
    Is there any option to ‘save’ line breaks?
    Some of nodes have text with ‘\n’ and I have to leave it (this is very importand for xslt).

  • I’ve been struggling with XML strings being cut in half when I’ve been running NPP’s default ReIndent XML tidy. This is SO much better! Thanks!

    David

  • Andy

    Produces very good looking XML. Kudos!

  • Hari

    awesome & thanks!

  • Sergio Torrees

    Thank you so much, this is awesome!
    Now would any one know if it’s possible for tidy2 to not delete plain text?
    I have this huge log to analyze which mostly contains XML but it also has some plain text with important procedural description I’ve use your setting and I’m getting beautifully formatted XML (thanks again btw).

    But sadly besides doing this excellent job, Tidy2 also deletes every plain text found in the file. Is there a way I can set it to leave plain text be?
    I’m using notepad++ v6.3.1 and Tidy2 V0.2.0.0
    Thanks a lot!!!

    ****Tiny example of the log I’m analyzing***

    2013-03-21 17:58:14,068 BBD3436D TestServiceThread[OrderServiceCentral] de.volkswagen.dmsbb.util.http.HttpUtilImpl Outgoing http-request:
    POST https://ws-gateway.cpn.vwg/services HTTP/1.1
    Content-Length: 1181
    Content-Type: text/xml; charset=UTF-8
    User-Agent: DMS-Backbone 4.3.0.v3 Production
    Via: 1.0 localhost (DMS-Backbone 4.3.0.v3 Production)
    Date: Thu, 21 Mar 2013 17:58:12 UTC
    Host: ws-gateway.cpn.vwg

    vwesb://xmldefs.vw-group.com/retail/OrderService/V1.5

    http://www.w3.org/2005/08/addressing/none

    MX132600

    MX132600
    Production
    http://xmldefs.vw-group.com/retail/OrderService/V1.5/OrderServicePortType/AliveTest
    urn:uuid:7f9b11dd-0696-4b55-a394-0c2a6e3f60ec

    2013-03-21 17:58:14,075 BBD3437D TestServiceThread[OrderServiceCentral] de.volkswagen.dmsbb.util.http.HttpUtilImpl Incoming http-response (‘1,376’ ms):
    HTTP/1.1 200 OK
    X-Backside-Transport: OK OK
    Connection: Keep-Alive
    Transfer-Encoding: chunked
    Content-Type: text/xml
    Date: Thu, 21 Mar 2013 17:58:12 GMT

    http://www.w3.org/2005/08/addressing/anonymous
    http://xmldefs.vw-group.com/retail/OrderService/V1.5/OrderServicePortType/AliveTestResponse
    urn:uuid:06a9117b-aae8-4a54-87e8-6191352cf923
    urn:uuid:7f9b11dd-0696-4b55-a394-0c2a6e3f60ec

    ****Tiny example of the log I’m analyzing***

    • I have no idea; I haven’t used Notepad++ in a few years.

  • Sergio Torrees


    2013-03-21 17:58:14,068 BBD3436D TestServiceThread[OrderServiceCentral] de.volkswagen.dmsbb.util.http.HttpUtilImpl Outgoing http-request:
    POST https://ws-gateway.cpn.vwg/services HTTP/1.1
    Content-Length: 1181
    Content-Type: text/xml; charset=UTF-8
    User-Agent: DMS-Backbone 4.3.0.v3 Production
    Via: 1.0 localhost (DMS-Backbone 4.3.0.v3 Production)
    Date: Thu, 21 Mar 2013 17:58:12 UTC
    Host: ws-gateway.cpn.vwg

    vwesb://xmldefs.vw-group.com/retail/OrderService/V1.5

    http://www.w3.org/2005/08/addressing/none

    MX132600

    MX132600
    Production
    http://xmldefs.vw-group.com/retail/OrderService/V1.5/OrderServicePortType/AliveTest
    urn:uuid:7f9b11dd-0696-4b55-a394-0c2a6e3f60ec

    2013-03-21 17:58:14,075 BBD3437D TestServiceThread[OrderServiceCentral] de.volkswagen.dmsbb.util.http.HttpUtilImpl Incoming http-response (‘1,376’ ms):
    HTTP/1.1 200 OK
    X-Backside-Transport: OK OK
    Connection: Keep-Alive
    Transfer-Encoding: chunked
    Content-Type: text/xml
    Date: Thu, 21 Mar 2013 17:58:12 GMT

    http://www.w3.org/2005/08/addressing/anonymous
    http://xmldefs.vw-group.com/retail/OrderService/V1.5/OrderServicePortType/AliveTestResponse
    urn:uuid:06a9117b-aae8-4a54-87e8-6191352cf923
    urn:uuid:7f9b11dd-0696-4b55-a394-0c2a6e3f60ec

  • Juan Capristán

    Still working like a charm. Thanks a lot.