XML Pretty Print functionality

Ideas for new features

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
marc_scheuner
Posts: 10
Joined: Wed Jan 28, 2004 1:32 pm
Location: Berne Switzerland

XML Pretty Print functionality

Post by marc_scheuner »

Folks,
Dealing with a lot of XML files lately, I've often longed for a function in TextPad that would allow me to "pretty print" (or rather: pretty format) a messed-up XML file.

E.g. I'd love to see a function in TextPad that would take an XML file, make sure to put all new elements onto a line of their own, add the perfect indenting to the XML stream, and so forth...

Turn <xml..><root><elem id="1"><subelem sid="2">..</subelem></elem></root>

into

<xml.....>
<root>
<elem id="1">
<subelem sid="2">......</subelem>
</elem>
</root>

or something like that. It'd be nice if I could specify
a) the indentation per "hiearchy level" (e.g. one tab, 2 spaces etc.)
b) whether or not to put a closing </tag> onto the same line or a separate one

With XML being widely used and adopted, I think a lot of folks could benefit from something like this
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

Cooktop already does a good job of cleaning up XML. I can't say much for the rest of the editor but you get what you pay for. ;)
I choose to fight with a sack of angry cats.
saubin
Posts: 1
Joined: Wed Sep 24, 2003 7:17 pm

Post by saubin »

I can't tell you how many time's functionality like this was included in TextPad. Anyone know if a poll for this exists?
User avatar
BenjiSmith
Posts: 49
Joined: Fri Jan 16, 2004 9:37 pm
Contact:

Post by BenjiSmith »

Well, it'd also be nice to pretty-print my Java & Perl & php code. But , to accomplish that, TextPad would have to include parsers for all of these languages, and that would really bulk it up, with very little (though definitely some) benefit.

It would even be pretty cumbersome to include a full XML parser (which would be necessary for the pretty-printer to function correctly).

There are command-line apps that can pretty-print source code for various languages, and I think that's where the functionality belongs. It's currently possible to send the contents of a file to a pretty-printer and get the results back. It's clunky, and I'd like to see the external-command-calling interface improved somewhat, but I don't think pretty-printing belongs in the TextPad core.
User avatar
gracefool
Posts: 76
Joined: Thu Jan 29, 2004 7:21 am
Location: Wellington, New Zealand
Contact:

Post by gracefool »

I second that, Benji.

People are continually suggesting things like this. At most, they should be an add-on (make them yourself, or get it from someone else who's already done it). I can't see any reason why they should be an essential part of Textpad.
Post Reply