<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Tom Moertel's Weblog: Tag xml</title>
    <link>http://blog.moertel.com/articles/tag/xml?tag=xml</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Quality rants on programming theory and stuff geeks like</description>
    <item>
      <title>PXSL Tools 1.0: Your ticket out of XML Hell</title>
      <description>&lt;p&gt;&lt;span class="caps"&gt;XML&lt;/span&gt; is fine for representing document-like things, but when it&amp;#8217;s
twisted to represent build recipes, configuration files, and little
programming languages, it opens the gates to &lt;em&gt;&lt;span class="caps"&gt;XML&lt;/span&gt; Hell&lt;/em&gt;.  Once the
gates are opened, the demons of cargo-cult thinking are loosed upon
the world, where they are free to trick innocent programmers into
working with grotesquely twisted &lt;span class="caps"&gt;XML&lt;/span&gt; documents &amp;#8211; something no human
mind was designed to comprehend.  Ensnared, these programmers are
slowly drawn into the depths of &lt;span class="caps"&gt;XML&lt;/span&gt; Hell, from which their
&lt;a href="http://www.google.com/search?q=%22xml+hell%22"&gt;lamentations echo across the
universe&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;When the demons of cargo-cult thinking come for you, don&amp;#8217;t be
ensnared!  Instead, be prepared &amp;#8211; with &lt;span class="caps"&gt;PXSL&lt;/span&gt; &amp;#8211; the &lt;a href="http://community.moertel.com/ss/space/pxsl"&gt;Parsimonious &lt;span class="caps"&gt;XML&lt;/span&gt;
Shorthand Language&lt;/a&gt;
(pronounced &amp;#8220;pixel&amp;#8221;).&lt;/p&gt;


	&lt;p&gt;What&amp;#8217;s &lt;span class="caps"&gt;PXSL&lt;/span&gt;?  It&amp;#8217;s a luxurious, thermonuclear smoking jacket that you
can slip on using a convenient preprocessor.  Use it whenever you see
grotesque &lt;span class="caps"&gt;XML&lt;/span&gt; on the horizon.  Within &lt;span class="caps"&gt;PXSL&lt;/span&gt;&amp;#8217;s plush (and stylish)
protection, you can create all the nasty, twisted &lt;span class="caps"&gt;XML&lt;/span&gt; that may be
demanded of you, but you need not descend into &lt;span class="caps"&gt;XML&lt;/span&gt; Hell to do it.
Instead, you can work from the comfort of a well-stocked lounge, where
clarity and conciseness are always on tap.&lt;/p&gt;


	&lt;p&gt;For example, here&amp;#8217;s a snippet from an &lt;span class="caps"&gt;XSLT&lt;/span&gt; stylesheet, in the
original &lt;span class="caps"&gt;XML&lt;/span&gt;:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;&amp;lt;xsl:template match="/"&amp;gt;
  &amp;lt;xsl:for-each select="//*/@src|//*/@href"&amp;gt;
    &amp;lt;xsl:value-of select="."/&amp;gt;
    &amp;lt;xsl:text&amp;gt;&amp;amp;#10;&amp;lt;/xsl:text&amp;gt;
  &amp;lt;/xsl:for-each&amp;gt;
&amp;lt;/xsl:template&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;And here&amp;#8217;s the same snippet, written in &lt;span class="caps"&gt;PXSL&lt;/span&gt;:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;template /
  for-each //*/@src|//*/@href
    value-of .
    text &amp;lt;&amp;lt;&amp;amp;#10;&amp;gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Isn&amp;#8217;t that refreshing?&lt;/p&gt;


	&lt;h3&gt;Why &lt;span class="caps"&gt;PXSL&lt;/span&gt;?&lt;/h3&gt;


	&lt;p&gt;There are lots of &lt;span class="caps"&gt;XML&lt;/span&gt; shorthands available.  (The &lt;a href="http://community.moertel.com/ss/space/PXSL/FAQs"&gt;&lt;span class="caps"&gt;PXSL FAQ&lt;/span&gt;&lt;/a&gt; lists about ten of them.)  So why choose
&lt;span class="caps"&gt;PXSL&lt;/span&gt;?  Here&amp;#8217;s why:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;&lt;span class="caps"&gt;PXSL&lt;/span&gt; lets you intermix &lt;span class="caps"&gt;PXSL&lt;/span&gt; and &lt;span class="caps"&gt;XML&lt;/span&gt; syntax&lt;/strong&gt; in one document. Feel free to use whichever syntax works best for each portion of your documents.  (See &lt;a href="http://community.moertel.com/pxsl/#xml-quoting-lt-lt-gt-gt-delimiters"&gt;the &lt;span class="caps"&gt;PXSL&lt;/span&gt; documentation&lt;/a&gt; for some examples.)&lt;/li&gt;
		&lt;li&gt;&lt;strong&gt;&lt;span class="caps"&gt;PXSL&lt;/span&gt; is customizable&lt;/strong&gt; with application-specific shortcuts.  (The &lt;span class="caps"&gt;PXSL&lt;/span&gt; snippet above, for example, uses &lt;span class="caps"&gt;XSLT&lt;/span&gt; shortcuts. Again, &lt;a href="http://community.moertel.com/pxsl/#element-defaults-provide-convenient-customizable-shortcuts"&gt;the &lt;span class="caps"&gt;PXSL&lt;/span&gt; documentation&lt;/a&gt; has examples.)&lt;/li&gt;
		&lt;li&gt;&lt;strong&gt;&lt;span class="caps"&gt;PXSL&lt;/span&gt; has a powerful macro system&lt;/strong&gt; that lets you build complicated document structures safely and conveniently.  (Read about &lt;a href="http://community.moertel.com/pxsl/#macro-facility"&gt;macros in the &lt;span class="caps"&gt;PXSL&lt;/span&gt; documentation&lt;/a&gt;.  For an advanced example of what you can do with &lt;span class="caps"&gt;PXSL&lt;/span&gt; macros, see this &lt;a href="http://www.kuro5hin.org/story/2003/6/4/12434/75716"&gt;article on refactoring &lt;span class="caps"&gt;XSLT&lt;/span&gt; one-offs into clean, maintainable code&lt;/a&gt;.)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Also, &lt;span class="caps"&gt;PXSL&lt;/span&gt; is battle tested.  It was first released in 2003 and has
been saving people from &lt;span class="caps"&gt;XML&lt;/span&gt; Hell since.  People who try it seem to like it:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;em&gt;I think &lt;span class="caps"&gt;PXSL&lt;/span&gt; could do wonders for soothing my irrational hatred for all things &lt;span class="caps"&gt;XML&lt;/span&gt;.&lt;/em&gt; &amp;#8212;&lt;a href="http://koweynlg.blogspot.com/2006/03/mmax-encore-encore-yay-pxsl.html"&gt;kowey&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;em&gt;Impressive&amp;#8230; I converted some of my files from &lt;span class="caps"&gt;XML&lt;/span&gt; to &lt;span class="caps"&gt;PXSL&lt;/span&gt; and the readability was much improved.&lt;/em&gt; &amp;#8212;&lt;a href="http://community.moertel.com/ss/comments/PXSL+Ask-a-Question#comment-PXSL%20Ask-a-Question-6"&gt;chris&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;em&gt;Quite aside from the fact that &lt;span class="caps"&gt;XSLT&lt;/span&gt; is finally somewhat readable, the fact that you&amp;#8217;ve added a serious macro system means that some serious scripting of &lt;span class="caps"&gt;XML&lt;/span&gt; can occur. I&amp;#8217;m very impressed.&lt;/em&gt; &amp;#8212;&lt;a href="http://community.moertel.com/ss/comments/PXSL+Ask-a-Question#comment-PXSL%20Ask-a-Question-4"&gt;invisible&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;The next time you&amp;#8217;re headed for &lt;span class="caps"&gt;XML&lt;/span&gt; Hell, why not &lt;a href="http://community.moertel.com/pxsl/#getting-or-building-the-pxsl-tools"&gt;give the venerable &lt;span class="caps"&gt;PXSL&lt;/span&gt; a try&lt;/a&gt;?  You might just find that you like it, too.&lt;/p&gt;


&lt;hr/&gt;

	&lt;p&gt;This public service announcement was brought to you in celebration of
the 1.0 release of the &lt;strong&gt;pxsl-tools&lt;/strong&gt; package.  The &lt;span class="caps"&gt;PXSL&lt;/span&gt;-to-XML compiler
&lt;em&gt;pxslcc&lt;/em&gt; is written in &lt;a href="http://haskell.org/"&gt;Haskell&lt;/a&gt; and uses the
cross-platform &lt;a href="http://www.haskell.org/cabal/"&gt;Haskell Cabal&lt;/a&gt;
build/package system to let you use &lt;span class="caps"&gt;PXSL&lt;/span&gt; just about anywhere.&lt;/p&gt;</description>
      <pubDate>Mon, 17 Dec 2007 22:33:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:fd34e396-beca-406a-9f9e-46a1dd5fe7ce</guid>
      <author>Tom Moertel</author>
      <link>http://blog.moertel.com/articles/2007/12/17/pxsl-tools-1-0-your-ticket-out-of-xml-hell</link>
      <category>programming</category>
      <category>haskell</category>
      <category>xml</category>
      <category>pxsl</category>
      <category>xslt</category>
      <trackback:ping>http://blog.moertel.com/articles/trackback/672</trackback:ping>
    </item>
    <item>
      <title>Bloglines doesn't handle inter-element white space properly</title>
      <description>&lt;p&gt;If you&amp;#8217;re reading my blog via &lt;a href="http://bloglines.com/"&gt;Bloglines&lt;/a&gt;, you
may have noticed that some of my posts look terrible, especially when
they contain code snippets.  I am sorry for that, but it&amp;#8217;s not my
fault. Bloglines doesn&amp;#8217;t handle white space properly.&lt;/p&gt;


	&lt;p&gt;Here&amp;#8217;s the more detailed explanation.  When you request one of my
feeds in, say, Atom format, you get back a bunch of &lt;span class="caps"&gt;XML&lt;/span&gt; that contains
the most-recent posts from my blog.  Each post is represented as
lovingly crafted &lt;span class="caps"&gt;HTML&lt;/span&gt;, escaped per the Atom specs.  When Bloglines
gets its hands on this very same &lt;span class="caps"&gt;HTML&lt;/span&gt;, it attempts to scrub it nice
and clean &amp;#8211; get rid of any naughty bits, you know.  And there&amp;#8217;s
nothing wrong with that.  Except when the scrubbing goes horribly,
horribly wrong.  Which is exactly what happens when Bloglines
encounters perfectly legitimate markup that represents
syntax-highlighted code snippets.&lt;/p&gt;


	&lt;p&gt;What does Bloglines do then?  It strips out &lt;em&gt;all&lt;/em&gt; of the significant white
space, turning each block of code into a single, mile-long,
unbreakable line of NoSpaceText that forces your web browser to expand
the page until it is wide enough to enshroud a small solar system.  Then
&lt;em&gt;you&lt;/em&gt; are forced to scroll forever to read each line of the text
column.  Ugg.&lt;/p&gt;


	&lt;p&gt;More specifically, each syntax-highlighted code block is
represented in &lt;span class="caps"&gt;HTML&lt;/span&gt; as a preformatted (PRE) text block.
Each word in that block is wrapped in a &lt;span class="caps"&gt;SPAN&lt;/span&gt; element
whose class attribute indicates the word&amp;#8217;s role in the
original source code.  Keywords get one
class, identifiers another, and so on. For example,
the code &amp;#8220;&lt;tt&gt;import List&lt;/tt&gt;&amp;#8221; might be represented
as follows:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;&amp;lt;span class="kwd"&amp;gt;import&amp;lt;/span&amp;gt; &amp;lt;span class="name"&amp;gt;List&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;But when Bloglines gets its hands on that markup, it strips
out the whitespace between the &lt;span class="caps"&gt;SPAN&lt;/span&gt; elements:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;&amp;lt;span class="kwd"&amp;gt;import&amp;lt;/span&amp;gt;&amp;lt;span class="name"&amp;gt;List&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Thus the markup renders as &amp;#8220;&lt;tt&gt;importList&lt;/tt&gt;&amp;#8221; when it hits your web
browser.  Now imagine the same space-denuding bad behavior applied to
&lt;em&gt;all&lt;/em&gt; of the inter-element white space in a full-length block of code.
That&amp;#8217;s right, what you end up with is a single, insanely long
LineOfUnbreakableText that your web browser chokes on. Again:
Ugg.&lt;/p&gt;


	&lt;p&gt;The folks at Bloglines &lt;a href="http://intertwingly.net/blog/2006/04/13/Bloglines-Breakages"&gt;have had similar problems in the past&lt;/a&gt;, most of which have been fixed.  I hope they fix this particular problem soon, too.&lt;/p&gt;


	&lt;p&gt;Until that time, however, you might want to consider other feed readers.&lt;/p&gt;</description>
      <pubDate>Tue, 11 Sep 2007 12:51:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:6f848f04-4c76-496e-b518-7d86d1899be6</guid>
      <author>Tom Moertel</author>
      <link>http://blog.moertel.com/articles/2007/09/11/bloglines-doesnt-handle-inter-element-white-space-properly</link>
      <category>rants</category>
      <category>bloglines</category>
      <category>rants</category>
      <category>markup</category>
      <category>atom</category>
      <category>xml</category>
      <category>html</category>
      <trackback:ping>http://blog.moertel.com/articles/trackback/576</trackback:ping>
    </item>
  </channel>
</rss>
