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
#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#choice ⇒ Choice
Returns choice data.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb', line 13 def choice @choice end |
#office2007_content ⇒ Object
Returns the value of attribute office2007_content.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb', line 11 def office2007_content @office2007_content end |
#office2010_content ⇒ Object
Returns the value of attribute office2010_content.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb', line 11 def office2010_content @office2010_content end |
Instance Method Details
#parse(node) ⇒ AlternateContent
Parse AlternateContent
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb', line 18 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 |