Class: OoxmlParser::AlternateContent
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::AlternateContent
- Defined in:
- lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb
Overview
Class for storing fallback graphic elements
Instance Attribute Summary collapse
-
#choice ⇒ Choice
Choice data.
-
#office2007_content ⇒ Object
Returns the value of attribute office2007_content.
-
#office2010_content ⇒ Object
Returns the value of attribute office2010_content.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#parse(node) ⇒ AlternateContent
Parse AlternateContent.
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, #initialize, unzip_file, #with_data?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#choice ⇒ Choice
Returns choice data.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb', line 11 def choice @choice end |
#office2007_content ⇒ Object
Returns the value of attribute office2007_content.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb', line 9 def office2007_content @office2007_content end |
#office2010_content ⇒ Object
Returns the value of attribute office2010_content.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb', line 9 def office2010_content @office2010_content end |
Instance Method Details
#parse(node) ⇒ AlternateContent
Parse AlternateContent
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb', line 16 def parse(node) node.xpath('*').each do |node_child| begin node_child.xpath('w:drawing') rescue Nokogiri::XML::XPath::SyntaxError # This mean it is Chart case node_child.name when 'Choice' @office2010_content = ChartStyle.new(parent: self).parse(node_child) when 'Fallback' @office2007_content = ChartStyle.new(parent: self).parse(node_child) end next end case node_child.name when 'Choice' @office2010_content = DocxDrawing.new(parent: self).parse(node_child.xpath('w:drawing').first) unless node_child.xpath('w:drawing').first.nil? @choice = Choice.new(parent: self).parse(node_child) when 'Fallback' @office2007_content = OldDocxPicture.new(parent: self).parse(node_child.xpath('w:pict').first) unless node_child.xpath('w:pict').first.nil? end end self end |