Dan Janowski wrote:
> To do this, please send a sample xml document and ruby code using  
> libxml that illustrates the problem clearly and (hopefully) compactly  
> and indicate what you are expecting but not getting and I will peer  
> into the fog of namespaces (a component I have not updated).

OK, here it is. I have attached two example XML files - one with a
namespace declared on the root node (test-ns.xml), and one without
(test-nons.xml). This is the only difference between them.

Here's what I get for them. Everything's just as expected, except that
the first find should return 2 as well.

$ irb
irb(main):001:0> require 'xml/libxml'
=> true
irb(main):002:0>
XML::Document.file('test-ns.xml').find('nodes/subnode').size
        => 0
irb(main):003:0>
XML::Document.file('test-nons.xml').find('nodes/subnode').size
=> 2
irb(main):004:0>
XML::Document.file('test-ns.xml').find('myns:nodes/myns:subnode',
'myns:http://some-ns.com/').size
=> 2

The docs here say that if I don't specify a namespace on the search,
then any NS may be matched:

http://web.archive.org/web/20070208211112/http://libxml.rubyforge.org/doc/classes/XML/XPath.html

As a side note, the API Docs link is broken on the new front page,
taht's why I included this cached copy.

mortee
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- <!DOCTYPE somedoctype PUBLIC "-//AAA//DTD somedoctype//EN" "http://bogus-host/somedoctype.dtd";> -->
<root>
	<nodes>
		<subnode>
		</subnode>
		<subnode>
		</subnode>
	</nodes>
</root>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- <!DOCTYPE somedoctype PUBLIC "-//AAA//DTD somedoctype//EN" "http://bogus-host/somedoctype.dtd";> -->
<root xmlns="http://some-ns.com/"; version="1.0">
	<nodes>
		<subnode>
		</subnode>
		<subnode>
		</subnode>
	</nodes>
</root>
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to