Class: REXML::Element
- Inherits:
-
Object
- Object
- REXML::Element
- Defined in:
- lib/rena/rexml_hacks.rb
Overview
def subdocument_writer(el)
el.prefixes.each { |ns|
el.add_attribute('xmlns:' + ns, el.namespaces[ns].to_s)
}
return el.to_s
end
Instance Method Summary collapse
Instance Method Details
#base ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/rena/rexml_hacks.rb', line 37 def base if self.attributes['xml:base'] return self.attributes['xml:base'].to_s elsif self.parent != nil return self.parent.base else return nil end end |
#base? ⇒ Boolean
29 30 31 32 33 34 35 |
# File 'lib/rena/rexml_hacks.rb', line 29 def base? if self.base != nil true else false end end |
#lang ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/rena/rexml_hacks.rb', line 19 def lang if self.attributes['xml:lang'] return self.attributes['xml:lang'].to_s elsif self.parent != nil return self.parent.lang else return nil end end |
#lang? ⇒ Boolean
12 13 14 15 16 17 18 |
# File 'lib/rena/rexml_hacks.rb', line 12 def lang? if self.lang != nil true else false end end |
#write(excl = []) ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/rena/rexml_hacks.rb', line 47 def write(excl=[]) # TODO: add optional list argument of excluded namespaces self.prefixes.each { |ns| self.add_attribute('xmlns:' + ns, self.namespaces[ns].to_s) unless excl.include? self.namespaces[ns] } self.support_write_recursive(self.namespaces, self) return self.to_s end |