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
XML Pretty Print functionality
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 10
- Joined: Wed Jan 28, 2004 1:32 pm
- Location: Berne Switzerland
- talleyrand
- Posts: 624
- Joined: Mon Jul 21, 2003 6:56 pm
- Location: Kansas City, MO, USA
- Contact:
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.
- BenjiSmith
- Posts: 49
- Joined: Fri Jan 16, 2004 9:37 pm
- Contact:
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.
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.