<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -12,22 +12,28 @@ module Webrat
     defined?(RAILS_ROOT) ? RAILS_ROOT : Merb.root
   end
 
+  def self.require_xml
+    if on_java?
+      # We need Nokogiri's CSS to XPath support, even if using REXML and Hpricot for parsing and searching
+      require &quot;nokogiri/css&quot;
+      require &quot;hpricot&quot;
+      require &quot;rexml/document&quot;
+    else
+      require &quot;nokogiri&quot;
+      require &quot;webrat/core/nokogiri&quot;
+    end
+  end
+  
+  def self.on_java?
+    RUBY_PLATFORM =~ /java/
+  end
+  
 end
 
-if RUBY_PLATFORM =~ /java/
-  # We need Nokogiri's CSS to XPath support, even if using REXML and Hpricot for parsing and searching
-  require &quot;nokogiri/css&quot;
-  require &quot;hpricot&quot;
-  require &quot;rexml/document&quot;
-else
-  require &quot;nokogiri&quot;
-  require &quot;webrat/core/nokogiri&quot;
-end
+Webrat.require_xml
 
 require &quot;webrat/core&quot;
 
 # TODO: This is probably not a good idea.
 # Probably better for webrat users to require &quot;webrat/rails&quot; etc. directly
-if defined?(RAILS_ENV)
-  require &quot;webrat/rails&quot;
-end
+require &quot;webrat/rails&quot; if defined?(RAILS_ENV)</diff>
      <filename>lib/webrat.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ec8bc82c243541a1fef06de19ed1ecd338881984</id>
    </parent>
  </parents>
  <author>
    <name>Bryan Helmkamp</name>
    <email>bryan@brynary.com</email>
  </author>
  <url>http://github.com/brynary/webrat/commit/f1b4486594311d1daaef4c9038657d7d28c18386</url>
  <id>f1b4486594311d1daaef4c9038657d7d28c18386</id>
  <committed-date>2008-11-19T12:52:56-08:00</committed-date>
  <authored-date>2008-11-19T12:52:56-08:00</authored-date>
  <message>Moving requiring of Nokogiri/Hpricot/REXML to a method</message>
  <tree>1fc4d3b0a5ea8358ff6b0a8e895084251dd52ba3</tree>
  <committer>
    <name>Bryan Helmkamp</name>
    <email>bryan@brynary.com</email>
  </committer>
</commit>
