* one line big XML to multiline
@ 2012-07-02 11:16 Mihamina Rakotomandimby
2012-07-02 11:51 ` Tassilo Horn
0 siblings, 1 reply; 5+ messages in thread
From: Mihamina Rakotomandimby @ 2012-07-02 11:16 UTC (permalink / raw)
To: help-gnu-emacs
Hi all,
I got a big one line XML file.
I want to break the lines to make it more readable.
Replacing "><" with "C-j" then indenting is the most obvious solution,
but would you know a more elegant solution?
I'm using Emacs 23 (FC17) with nXml or sgml-mode usable.
Thank you.
--
RMA.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: one line big XML to multiline
2012-07-02 11:16 Mihamina Rakotomandimby
@ 2012-07-02 11:51 ` Tassilo Horn
2012-07-05 22:46 ` Matt McClure
0 siblings, 1 reply; 5+ messages in thread
From: Tassilo Horn @ 2012-07-02 11:51 UTC (permalink / raw)
To: help-gnu-emacs
Mihamina Rakotomandimby <mihamina@rktmb.org> writes:
Hi,
> I got a big one line XML file.
> I want to break the lines to make it more readable.
>
> Replacing "><" with "C-j" then indenting is the most obvious solution,
> but would you know a more elegant solution?
I'd go with some external tool such as xmllint which comes with libxml.
$ xmllint --format --output formatted.xml original.xml
should do what you want.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: one line big XML to multiline
[not found] <mailman.3864.1341227814.855.help-gnu-emacs@gnu.org>
@ 2012-07-02 15:13 ` John Bokma
2012-07-03 23:06 ` Xah Lee
1 sibling, 0 replies; 5+ messages in thread
From: John Bokma @ 2012-07-02 15:13 UTC (permalink / raw)
To: help-gnu-emacs
Mihamina Rakotomandimby <mihamina@rktmb.org> writes:
> Hi all,
>
> I got a big one line XML file.
> I want to break the lines to make it more readable.
>
> Replacing "><" with "C-j" then indenting is the most obvious solution,
> but would you know a more elegant solution?
>
> I'm using Emacs 23 (FC17) with nXml or sgml-mode usable.
>
> Thank you.
I've used this in the past, with success:
http://blog.bookworm.at/2007/03/pretty-print-xml-with-emacs.html
--
John Bokma j3b
Blog: http://johnbokma.com/ Perl Consultancy: http://castleamber.com/
Perl for books: http://johnbokma.com/perl/help-in-exchange-for-books.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: one line big XML to multiline
[not found] <mailman.3864.1341227814.855.help-gnu-emacs@gnu.org>
2012-07-02 15:13 ` one line big XML to multiline John Bokma
@ 2012-07-03 23:06 ` Xah Lee
1 sibling, 0 replies; 5+ messages in thread
From: Xah Lee @ 2012-07-03 23:06 UTC (permalink / raw)
To: help-gnu-emacs
On Jul 2, 4:16 am, Mihamina Rakotomandimby <miham...@rktmb.org> wrote:
> Hi all,
>
> I got a big one line XML file.
> I want to break the lines to make it more readable.
>
> Replacing "><" with "C-j" then indenting is the most obvious solution,
> but would you know a more elegant solution?
>
> I'm using Emacs 23 (FC17) with nXml or sgml-mode usable.
you can record a keyboard macro, save it, assign it a key. So, just
press one key, and the file is indented and well-formatted.
〈Emacs: Using Keyboard Macro to Record/Playback Keystrokes〉
http://ergoemacs.org/emacs/emacs_macro_example.html
to indent, just select all then 【Ctrl+Alt+\】.
or, this can be easily done by writing a elisp command.
Xah
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: one line big XML to multiline
2012-07-02 11:51 ` Tassilo Horn
@ 2012-07-05 22:46 ` Matt McClure
0 siblings, 0 replies; 5+ messages in thread
From: Matt McClure @ 2012-07-05 22:46 UTC (permalink / raw)
To: Tassilo Horn; +Cc: help-gnu-emacs
On Mon, Jul 2, 2012 at 7:51 AM, Tassilo Horn <tassilo@member.fsf.org> wrote:
> I'd go with some external tool such as xmllint which comes with libxml.
>
> $ xmllint --format --output formatted.xml original.xml
>
> should do what you want.
I prefer `xmlstarlet`[1]. To format a buffer:
C-x h C-u M-| xml fo RET
[1]: http://xmlstar.sourceforge.net/docs.php
--
Matt McClure
http://www.matthewlmcclure.com
http://www.mapmyfitness.com/profile/matthewlmcclure
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-07-05 22:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.3864.1341227814.855.help-gnu-emacs@gnu.org>
2012-07-02 15:13 ` one line big XML to multiline John Bokma
2012-07-03 23:06 ` Xah Lee
2012-07-02 11:16 Mihamina Rakotomandimby
2012-07-02 11:51 ` Tassilo Horn
2012-07-05 22:46 ` Matt McClure
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).