Class: Nokogiri::XML::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/rdf/microdata/jsonld_reader.rb

Instance Method Summary collapse

Instance Method Details

#baseObject

Get any xml:base in effect for this element


223
224
225
226
227
228
229
230
231
# File 'lib/rdf/microdata/jsonld_reader.rb', line 223

def base
  if @base.nil?
    @base = attributes['xml:base'] ||
    (parent && parent.element? && parent.base) ||
    false
  end

  @base == false ? nil : @base
end

#languageObject

Get any xml:lang or lang in effect for this element


236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/rdf/microdata/jsonld_reader.rb', line 236

def language
  if @language.nil?
    language = case
    when self["xml:lang"]
      self["xml:lang"].to_s
    when self["lang"]
      self["lang"].to_s
    else
      parent && parent.element? && parent.language
    end
  end
  @language == false ? nil : @language
end