<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Snipplr</title>
    <description>Recent snippets posted on Snipplr.com</description>
    <link>https://snipplr.com/</link>
    <lastBuildDate>Wed, 10 Jun 2026 02:56:05 +0000</lastBuildDate>
    <item>
      <title>(Ruby) REXML Language Identification monkey patch - tommorris</title>
      <link>https://snipplr.com/view/6744/rexml-language-identification-monkey-patch</link>
      <description>&lt;p&gt;REXML does not seem to have a 'lang' method, which is strange since lang is in the XML 1.0 Specification Â§2.12 'Language Identification', and in many other libraries. Because of Ruby's 'monkey patching', it's pretty easy to add - you just recursively browse the ancestors. Alas, because attributes are stored internally as strings and not an Attribute object, there does not seem to be any way of monkey patching Â§2.12 support on to REXML's attribute handling.&#13;
&#13;
One day, Ruby will have a really good XML parser - speedy as a SAX and fully DOMinanting over the vagaries of namespaces etc.&#13;
&#13;
Enclosed is an RSpec test that demonstrates usage.&lt;/p&gt;</description>
      <pubDate>Mon, 16 Jun 2008 21:30:16 UTC</pubDate>
      <guid>https://snipplr.com/view/6744/rexml-language-identification-monkey-patch</guid>
    </item>
  </channel>
</rss>
