How do I format XML in Notepad++?

后端 未结 20 2489
不思量自难忘°
不思量自难忘° 2020-11-27 08:40

I have Notepad++ and I got some XML code which is very long. When I pasted it in Notepad++ there was a long line of code (difficult to read and work with).

I want to

相关标签:
20条回答
  • 2020-11-27 09:11

    All the previous answers do not define how to add the plugin manager in your Notepad++ installation.

    This is for the folks who do not see the the plugin manager in the plugin tab

    Download the plugin manager from this link - this is for the 64-bit plugin manager. Once you download the plugin manager, paste in the plugin folder. This is was my location of plugin folder: C:\Program Files\Notepad++\plugins

    After pasting the .dll file restart Notepad++. Now you can install any plugin. To install a plugin, click on the plugin tab, then go to plugin manager and select the plugin whatever you want.

    0 讨论(0)
  • 2020-11-27 09:12

    The location of XML tools has changed slightly since this question was first asked.

    I am currently using Notepad++ v7.8.6

    New location is:

    • Plugins tab
    • Plugins Admin...
    • Plugins Admin dialog appears with Available plugins tab as the default
    • Scroll to the bottom and check the XML Tools checkbox
    • Click Install button in top right of the dialog

    This will close Notepad++ while it installs and then restart it automatically.

    Then there are a couple keyboard shortcuts to beautify the XML:

    • Pretty Print: Ctrl + Shift + Alt + B
    • Pretty Print (indent attributes): Ctrl + Shift + Alt + A

    To see more XML Tools options:

    • Plugins tab
    • XML Tools option
    0 讨论(0)
  • 2020-11-27 09:13

    Plugins -> XML Tools -> Pretty Print (libXML) or Ctrl+Alt+Shift+B

    You probably need to install the plugin:

    Plugins > Plugins Manager > Show Plugins Manager

    If you are behind a proxy, download it from here.

    Then copy XMLTools.dll to the plugins directory and external libraries (four dlls) into the root Notepad++ directory.

    0 讨论(0)
  • 2020-11-27 09:14

    If your XML is imperfect, try this with the TextFX Characters plugin (install from Plugin manager):

    First, find a ">" to copy into the clipboard. Then select ALL your text, and then...

    On the main menu: TextFX -> TextFX Edit -> Solit lines at clipboard char...

    This will do a reasonable job, not perfect, but things will be readable, at least.

    I had to do this with XML code stored in an SQL Server database, where the headers weren't stored, just the XML body...

    0 讨论(0)
  • 2020-11-27 09:15

    There is no such a thing like TextFX in Notepad++, not in the latest version at least. This is one of the reasons I'm still with DreamWeaver even if it is driving me insane being slow and unresponsive from time to time...

    0 讨论(0)
  • 2020-11-27 09:16

    Since I see lots of comments about people having problems with the plugin, I thought I'd mention the work around that I use.

    I just use one of the online sites for XML viewing (I use https://codebeautify.org/xmlviewer, but there are plenty out there) as follows:

    1. Paste the XML content in the input window
    2. Click the "Beautify / Format" button
    3. Copy formatted XML output from the result window
    4. Paste in Notepad++

    I don't know if it qualifies as answering the OP's question exactly, but it's very simple and easy for anyone who is having problems with the plugin.

    0 讨论(0)
提交回复
热议问题