lib/rdf/xsd/extensions.rb
def c14nxl(options = {})
    # Add in-scope namespace definitions, unless supplied
    options[:namespaces] ||= self.namespaces
    element = options[:inplace] ? self : self.dup

    # Add in-scope namespace definitions
    options[:namespaces].each do |prefix, href|
      if prefix.to_s.empty?
        element.add_attribute("xmlns", href) unless element.attribute("xmlns")
      else
        element.add_attribute("xmlns:#{prefix}", href) unless element.attribute("xmlns:#{prefix}")
      end
    end

    # Add language
    element.add_attribute("xml:lang", options[:language].to_s) if
      options[:language] &&
      element.attribute("lang", "http://www.w3.org/XML/1998/namespace").to_s.empty? &&
      element.attribute("lang").to_s.empty?

    # Make sure it formats as open/close tags
    element.text = "" if element.text == nil && element.children.empty?
    
    # Recurse through children to ensure tags are set properly
    element.children.each {|c| c.c14nxl(:inplace => true, :namespaces => {}) if c.is_a?(REXML::Element)}
    element
  end
##
# Canonicalize the Element. Return a new instance of this node
# which is canonicalized and marked as such.
#
# Apply namespaces either passed as an option, or that are in scope.
#
# @param [Hash{Symbol => Object}] options
#   From `Nokogiri::XML::Node#c14nxl`
Canonicalize the Element. Return a new instance of this node
which is canonicalized and marked as such.

Apply namespaces either passed as an option, or that are in scope.
Canonicalize the Element . Return a new instance of this node which is canonicalized and marked as such . Apply namespaces either passed as an option or that are in scope .
def c14nxl(options = {})
    options[:namespaces] ||= self.namespaces
    element = options[:inplace] ? self : self.dup
    options[:namespaces].each do |prefix, href|
      if prefix.to_s.empty?
        element.add_attribute("xmlns", href) unless element.attribute("xmlns")
      else
        element.add_attribute("xmlns:#{prefix}", href) unless element.attribute("xmlns:#{prefix}")
      end
    end
    element.add_attribute("xml:lang", options[:language].to_s) if
      options[:language] &&
      element.attribute("lang", "http://www.w3.org/XML/1998/namespace").to_s.empty? &&
      element.attribute("lang").to_s.empty?
    element.text = "" if element.text == nil && element.children.empty?
    element.children.each {|c| c.c14nxl(:inplace => true, :namespaces => {}) if c.is_a?(REXML::Element)}
    element
  end
def c14nxl ( options = { } ) options [ :namespaces ] ||= self . namespaces element = options [ :inplace ] ? self : self . dup options [ :namespaces ] . each do | prefix , href | if prefix . to_s . empty? element . add_attribute ( "xmlns" , href ) unless element . attribute ( "xmlns" ) else element . add_attribute ( "xmlns:#{prefix}" , href ) unless element . attribute ( "xmlns:#{prefix}" ) end end element . add_attribute ( "xml:lang" , options [ :language ] . to_s ) if options [ :language ] && element . attribute ( "lang" , "http://www.w3.org/XML/1998/namespace" ) . to_s . empty? && element . attribute ( "lang" ) . to_s . empty? element . text = "" if element . text == nil && element . children . empty? element . children . each { | c | c . c14nxl ( :inplace => true , :namespaces => { } ) if c . is_a? ( REXML :: Element ) } element end
Canonicalize the Element.
Canonicalize the Element .
# Add in-scope namespace definitions, unless supplied # Add in-scope namespace definitions # Add language # Make sure it formats as open/close tags # Recurse through children to ensure tags are set properly
options
options From `Nokogiri::XML::Node#c14nxl`
options From ` Nokogiri :: XML :: Node#c14nxl `