On Thu, 11 May 2006 17:18:56 +0100, Ross Bamford <[EMAIL PROTECTED]> wrote:

I attached a testcase (which, incidentally, REXML
does pass so I guess this probably is a bug).


Apologies for noise, forgot the attachment. Why do I *always* do that ? }:-|

--
Ross Bamford - [EMAIL PROTECTED]
require 'test/unit'
require 'xml/libxml'

class TC_Libxml_XPath_Bug < Test::Unit::TestCase
  XML_DTD = <<-EOX
?xml version='1.0' encoding='utf-8'?>
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
  <html>
  <body>
    <div class='main'>
      <h1>The code</h1>
    </div>
    
    <div class='other'>
    </div>			
  </body>
  </html>
  EOX

  # make a copy without the DOCTYPE
  XML_NODTD = XML_DTD.gsub(/<!DOCTYPE(.*)/, '')

  def test_xpath_without_validation
    doc = XML::Parser.string(XML_NODTD).parse
    assert_equal 2, doc.find('//div').length
  end

  def test_xpath_with_validation
    doc = XML::Parser.string(XML_DTD).parse
    assert_equal 2, doc.find('//div').length
  end
end
_______________________________________________
libxml-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to