Module: REXML::Namespace
Overview
Adds named attributes to an object.
Constant Summary
- NAMESPLIT =
/^(?:(#{NCNAME_STR}):)?(#{NCNAME_STR})/u
Constants included from XMLTokens
XMLTokens::NAME, XMLTokens::NAMECHAR, XMLTokens::NAME_STR, XMLTokens::NCNAME_STR, XMLTokens::NMTOKEN, XMLTokens::NMTOKENS, XMLTokens::REFERENCE
Instance Attribute Summary (collapse)
-
- (Object) expanded_name
readonly
The name of the object, valid if set.
-
- (Object) name
(also: #local_name)
The name of the object, valid if set.
-
- (Object) prefix
The expanded name of the object, valid if name is set.
Instance Method Summary (collapse)
-
- (Object) fully_expanded_name
Fully expand the name, even if the prefix wasn't specified in the source file.
-
- (Boolean) has_name?(other, ns = nil)
Compares names optionally WITH namespaces.
Instance Attribute Details
- (Object) expanded_name (readonly)
The name of the object, valid if set
7 8 9 |
# File 'lib/rexml/namespace.rb', line 7 def @expanded_name end |
- (Object) name Also known as: local_name
The name of the object, valid if set
7 8 9 |
# File 'lib/rexml/namespace.rb', line 7 def name @name end |
- (Object) prefix
The expanded name of the object, valid if name is set
9 10 11 |
# File 'lib/rexml/namespace.rb', line 9 def prefix @prefix end |
Instance Method Details
- (Object) fully_expanded_name
Fully expand the name, even if the prefix wasn't specified in the source file.
41 42 43 44 45 |
# File 'lib/rexml/namespace.rb', line 41 def ns = prefix return "#{ns}:#@name" if ns.size > 0 return @name end |
- (Boolean) has_name?(other, ns = nil)
Compares names optionally WITH namespaces
27 28 29 30 31 32 33 34 35 |
# File 'lib/rexml/namespace.rb', line 27 def has_name?( other, ns=nil ) if ns return (namespace() == ns and name() == other) elsif other.include? ":" return == other else return name == other end end |