O'Reilly logo

Pro Windows PowerShell by Hristo Deshev

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

21.5. XML Tools

PowerShell offers really great XML support through its type adapters, but there is always room for improvement. One such example is pretty printing. Quite often, we get XML that is so horribly formatted that it is close to being unreadable. For example, here is how a snippet of the XHTML (HTML expressed as valid XML) code taken from the W3C looks:

PS> type unformatted.xml <div class="navBlock"> <h2 class="spot-head">W3C Technical Plenary</h2> <div class="spot-image"> <a href="http://www.bea.com/"> <img width="120" height="75" alt="BEA logo" src="/2007/11/TPAC/bea.png" /></a> </div> <div class="spot-image"> <a href="http://www.cisco.com/"> <img width="120" height="63" alt="Cisco logo" src="/2007/11/Cisco-logo.png" /></a> </div> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required