Module: XmlUtils2
- Defined in:
- lib/buzzcore/extra/xml_utils2.rb
Constant Summary collapse
- BASIC_HEADER =
'<?xml version="1.0"?>'
Class Method Summary collapse
-
.clean_data(aXmlString) ⇒ Object
for yore, need to convert XmlUtils.add_xml_from_string : node XmlUtils.get_file_root : node XmlUtils.read_simple_items : hash XmlUtils.single_node : node XmlUtils.peek_node_value : String.
Class Method Details
.clean_data(aXmlString) ⇒ Object
for yore, need to convert XmlUtils.add_xml_from_string : node XmlUtils.get_file_root : node XmlUtils.read_simple_items : hash XmlUtils.single_node : node XmlUtils.peek_node_value : String
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/buzzcore/extra/xml_utils2.rb', line 15 def self.clean_data(aXmlString) doc = Nokogiri::XML(aXmlString) {|c| c. ||= Nokogiri::XML::ParseOptions.NOBLANKS} doc.traverse do |n| case when n.is_a?(Nokogiri::XML::Comment) n.remove when n.is_a?(Nokogiri::XML::Text) n.remove if (n.next || n.previous) && n.content.strip.empty? end end doc.to_xml(:indent => 0) end |