ext/nokogiri/xml_node.c:1263 contains the line:
return INT2NUM(xmlGetLineNo(node));
but the signature of xmlGetLineNo according to libxml2 2.8.0 (tree.c:4527) is
long
xmlGetLineNo(xmlNodePtr node)
so libxml2 is returning a long that is passed to a macro function that accepts an int , so long is converted to int, and hence capped to 65535
The solution would be to change ext/nokogiri/xml_node.c:1263 to
return LONG2NUM(xmlGetLineNo(node));
and thus a problem that's been around for some years would be fixed.