1 require 'rexml/xmltokens'
4 # Adds named attributes to an object.
6 # The name of the object, valid if set
7 attr_reader :name, :expanded_name
8 # The expanded name of the object, valid if name is set
11 NAMESPLIT = /^(?:(#{NCNAME_STR}):)?(#{NCNAME_STR})/u
13 # Sets the name and the expanded name
26 # Compares names optionally WITH namespaces
27 def has_name?( other, ns=nil )
29 return (namespace() == ns and name() == other)
30 elsif other.include? ":"
31 return fully_expanded_name == other
37 alias :local_name :name
39 # Fully expand the name, even if the prefix wasn't specified in the
41 def fully_expanded_name
43 return "#{ns}:#@name" if ns.size > 0