Project

General

Profile

Bug #2423 » rexml_test.rb

./script/runner rexml_test.rb # in the context of rails 2.3.2 - kwerle (Kurt Werle), 12/03/2009 10:48 AM

 
require 'nokogiri'

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}")
(1-1/2)