class ChupaText::Decomposers::OfficeOpenXML::AttributesListener
Constants
- CORE_PROPERTIES_URI
- DUBLIN_CORE_TERMS_URI
- DUBLIN_CORE_URI
- EXTENDED_PROPERTIES_URI
Public Class Methods
Source
# File lib/chupa-text/decomposers/office-open-xml.rb, line 178 def initialize(attributes) @attributes = attributes @name = nil @type = nil end
Public Instance Methods
Source
# File lib/chupa-text/decomposers/office-open-xml.rb, line 219 def cdata(content) set_attribute(content) end
Source
# File lib/chupa-text/decomposers/office-open-xml.rb, line 215 def characters(text) set_attribute(text) end
Source
# File lib/chupa-text/decomposers/office-open-xml.rb, line 210 def end_element(uri, local_name, qname) @name = nil @type = nil end
Source
# File lib/chupa-text/decomposers/office-open-xml.rb, line 223 def set_attribute(value) return if @name.nil? value = CGI.unescapeHTML(value) case @type when :w3cdtf value = Time.xmlschema(value) end @attributes[@name] = value end
Source
# File lib/chupa-text/decomposers/office-open-xml.rb, line 184 def start_element(uri, local_name, qname, attributes) case uri when CORE_PROPERTIES_URI case local_name when "keywords" @name = local_name end when EXTENDED_PROPERTIES_URI case local_name when "Application" @name = local_name.downcase end when DUBLIN_CORE_URI case local_name when "description", "title", "subject" @name = local_name end when DUBLIN_CORE_TERMS_URI case local_name when "created", "modified" @name = "#{local_name}_time" @type = :w3cdtf end end end