看起來答案是否定的;不像圖書館目前所寫的,也許根本不是。跟蹤呼叫路徑爲節點的序列化:
Nokogiri::XML::Node#to_s
電話to_xml
Nokogiri::XML::Node#to_xml
電話serialize
(設置了幾個默認選項)
Nokogiri::XML::Node#serialize
電話write_to
Nokogiri::XML::Node#write_to
電話native_write_to
Nokogiri::XML::Node#native_write_to
電話native_write_to
,看起來像th是:
&bsp;
def native_write_to(io, encoding, indent_string, options)
set_xml_indent_tree_output 1
set_xml_tree_indent_string indent_string
savectx = LibXML.xmlSaveToIO(IoCallbacks.writer(io), nil, nil, encoding, options)
LibXML.xmlSaveTree(savectx, cstruct)
LibXML.xmlSaveClose(savectx)
io
end
所以,你在libxml的擺佈在這一點上。谷歌搜索libxml serialize single quote attributes不會立即啓動任何吸菸槍。
我想你應該file a feature request,看看你能得到什麼樣的tenderlovin。 :)
關於_「或保留任何引用樣式在原來的」_參見[可以Nokogiri保留屬性引用樣式?](http://stackoverflow.com/q/8424858/405017) – Phrogz 2011-12-08 17:12:41