Registered Member
|
I have god non-formatted XML file (all in one string). I want to format it easily and fast.
As my text editor, I prefer Kate). It has nice XML highlighting, but no XML formatting. |
Registered Member
|
I would love to see more plugins/scripts for kate for various text-manipulation tasks like this. There may be a way to write a script for kate to do it, but I'm not sure where to get started.
airdrik, proud to be a member of KDE forums since 2008-Dec.
|
Registered Member
|
You can always make use of existing scripts and call them through Tools -> External Tools -> Run script.
Jucato, proud to be a member of KDE forums since 2008-Oct.
|
Registered Member
|
Does anyone know if there is a collection of (KDE4.x compatible) scripts and/or plugins for Kate? It looks like the only ones available are the ones that come with KDE and the kate-plugins package for KDE 3.5.
Kate seems like it should be such a nice text editor, but when you look at the available extensions it seems a little limited.
airdrik, proud to be a member of KDE forums since 2008-Dec.
|
Registered Member
|
You can try kde-files.org and kde-apps.org. But when I mentioned scripts up there, I really meant command line scripts, which are easier to make than Kate plugins and are more abundant. I'm sure someone somewhere has come up with a solution to a similar problem. You can run those using External Tools (or even make your own using Javascript). Google for "Kate External Tools". Here are some links I've found:
http://docs.kde.org/stable/en/kdesdk/ka ... pting.html http://kate-editor.org/article/dcop_scr ... pplication http://www.tuxmachines.org/node/13762
Jucato, proud to be a member of KDE forums since 2008-Oct.
|
Registered Member
|
Thanks. I'll take a look.
airdrik, proud to be a member of KDE forums since 2008-Dec.
|
Registered Member
|
I had the same question stumbling over this thread. It's somewhat old, but here is my solution:
1. Make sure xmlstarlet is installed on your system 2. activate the text filter plugin in kate 3. Select all the text 3. Go to Tools->Filter Text..., enter "xmlstarlet fo" and OK. This will format the xml file. On some systems the xmlstarlet command ist just "xml". |
Registered Member
|
|
Registered Member
|
Thanks mrmenke.
Does anybody have suggestions for how to handle XML code that causes errors (because you want it formatted to start debugging it and you can't change how it gets generated)? Is there any xml formatting script that ignores errors? |
Registered Member
|
[Bumping old thread, for incoming googlers]
A (more available) alternative to xmlstarlet is xmllint: "Tools->Filter Text" with
(sed removed the first "<?xml version="1.0"?>" line) It also has the "--nowarning" option but there there seems to be no way to ignore arbitrary errors. |
Registered Member
|
Kate is one awesome editor ( If you don't like Vim for its 'CLI'ness ) When working from the command line we can use a handy tool 'xmllint' to format XML files using its --format option. But it is a tedious task to use it when you have some content in Kate ( more so if it is an unsaved file ) and want to format it. If you use xmllint you would do something like this, Save File ( MySavedFile.xml ) Go to Command Line cat MySavedFile.txt | xmllint --format - > MySavedFile.txt |
Registered users: bartoloni, Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]