Project

General

Profile

Bug #2423 » rexml_test.rb

modified rexml test - tenderlovemaking (Aaron Patterson), 12/03/2009 12:20 PM

 
require 'nokogiri'
require 'rexml/document'

docstring = <<EOS
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE x SYSTEM "licenseOut.xsd">
<a>
<c>A bigger than B</c>
</a>
EOS

nd = Nokogiri::XML.parse(docstring)
noko_value = nd.xpath("//c").text
puts("noko_value: #{noko_value}")

xml_doc = REXML::Document.new(docstring)
return_string = xml_doc.root.elements["//c"].text
puts("return_string: #{return_string}")
########################################################
docstring = <<EOS
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE x SYSTEM "licenseOut.xsd">
<a>
<c>A &gt; B</c>
</a>
EOS

nd = Nokogiri::XML.parse(docstring)
noko_value = nd.xpath("//c").text
puts("noko_value: #{noko_value}")

xml_doc = REXML::Document.new(docstring)
return_string = xml_doc.root.elements["//c"].text
puts("return_string: #{return_string}")
(2-2/2)