Module: Transformator::FormatConverter
Defined Under Namespace
Modules: DocumentFromHash, DocumentFromObject, DocumentFromXml, HashFromDocument, XmlFromDocument
Class Method Summary
collapse
#xml_from_document
#hash_from_document, process_node
#document_from_xml
#document_from_object
#document_from_hash
Class Method Details
.remove_namespaces!(xml) ⇒ Object
14
15
16
|
# File 'lib/transformator/format_converter.rb', line 14
def self.remove_namespaces!(xml)
xml.gsub!(/<(\/?)\w+:(\w+)/, "<\\1\\2")
end
|
.remove_whitespace_only_text_nodes(xml) ⇒ Object
18
19
20
|
# File 'lib/transformator/format_converter.rb', line 18
def self.remove_whitespace_only_text_nodes(xml)
remove_whitespace_only_text_nodes!(xml.dup)
end
|
.remove_whitespace_only_text_nodes!(xml) ⇒ Object
22
23
24
25
26
|
# File 'lib/transformator/format_converter.rb', line 22
def self.remove_whitespace_only_text_nodes!(xml)
xml.gsub!(/>(\s|\n|\r)+</, "><")
xml
end
|