# File nqxml/tokenizer.rb, line 289 def normalizeAttributeValue(str) return nil if str.nil? val = str.dup result = '' until val.empty? pos = val =~ /[&\<]/m if pos.nil? result << val return result end result << $` val = val[pos .. -1] if val =~ /\&#x([0-9a-f]*);/ni result << $1.hex.chr val = $' elsif val =~ /\&#([0-9]*);/n result << $1.to_i.chr val = $' elsif val =~ /\&([^&;]*);/n ref = $1 case ref when 'amp'; result << '&' when 'lt'; result << '<' when 'gt'; result << '>' when 'quot'; result << '"' when 'apos'; result << '\' else replacement = @internalEntities[ref] if replacement.nil? str = "entity reference '#{ref}' is undefined" raise ParserError.new(str, self) end if !replacement.index('<').nil? str = "attribute values may not contain '<'" raise ParserError.new(str, self) end result << normalizeAttributeValue(replacement) end val = $' elsif val =~ /\/m result << ' ' val = $' elsif val[0] == ?< str = "attribute values may not contain '<'" raise ParserError.new(str, self) end end return result end