Pretty-printing XML with Emacs’ NXML-mode

Did you ever get a stream of XML out of a log file, or in a data stream, and it’s all mashed together without line-breaks so that it just appears as gobble-de-gook? If there’s a data error (not an XML parsing error) then you have to read it so that you can find where the error is, but you don’t have XML-spy and NetBeans is overkill or takes forever to fire up…

Emacs to the rescue! Benjamin Ferrari wrote this increadibly useful (and simple) elisp function to pretty-print a block of XML code:

 Continue reading 
Advertisements

Using punctuation entity names in XHTML

You can use the following XHTML entity names to put propper punctuation symbols into your web pages.

The W3C maintains a complete list, though finding what you need can be a bit tricky. I'm working on a complete list that actually displays the characters together with the other detail from W3C's table, a lot neater coding than this Blogger post too, I hope…

In the mean-time, here's a short-list of common characters that I use quite a lot:

Double quotes: “ ” ⇒ use “ and ”
Single quotes: ‘ ’ ⇒ use ‘ and ’
Ellipsis: ⇒ use …
En-dash: ⇒ use –
Em-dash: ⇒ use —
Minus sign: ⇒ use −

Multiplication: × ⇒ use ×
Division: ÷ ⇒ use ÷
Approximately equal: ⇒ use ≈

Trade Mark: ™ ⇒ use ™
Copyright: © ⇒ use ©
Registered: ® ⇒ use ®

Right-arrow: ⇒ use ⇒