I tried opening xml file using both the ways, but only the latter part worked when I tried to use xpath.
eg., doc = as in title;
doc.xpath('//feed/xyz'), worked only when I open the file using parse method.
One thing I noted was, the object when I open using XML:: is Nokogiri::XML::Document, while the latter one was Nokogiri::HTML::Document
Any comments?
Nokogiri.parseparses HTML documents, whileNokogiri::XMLexpects valid XML document. it seems that when XML parsing fails, error is not raised, rather an empty XML document is generated. tryputs doc.to_s, you’ll probably see"<?xml version=\"1.0\"?>\n"