伙计们,
在 Nokogiri 1.5.6 上运行以下代码
require 'nokogiri'
reader = Nokogiri::XML::Reader(<<-eoxml)
<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
<node label="Session">
<node id="session_query1" label="DTM Buffer Size" />
<node id="session_query2" label="Buffer Block Size"/>
<node id="session_query3" label="Enable Test Load"/>
</node>
<node label="Workflow" >
<node id="workflow_query1" label="Enable HA Recovery"/>
<node id="workflow_query2" label="Suspend on Error"/>
</node>
<node label="Mapping" >
<node id="mapping_query1" label="SQL Override in SQ " />
<node id="mapping_query2" label="SQL Override in lookup" />
</node>
</root>
eoxml
p reader.instance_of? Nokogiri::XML::Reader #true
p reader.xml_encoding #nil
有谁知道为什么 xml_encoding 返回“nil”?