Class: VCDOM::ElementNS

Inherits:
Element
  • Object
show all
Defined in:
lib/vcdom/element_ns.rb

Overview

This class implements the interface Element of W3C DOM Element. This class (ElementNS) supports a namespace URI, and the class Element doesn’t support a namespace URI.

Instance Method Summary collapse

Methods inherited from Element

#append_child, #attributes, #child_element_count, #each_attr_node, #first_element_child, #get_attribute, #get_attribute_ns, #last_element_child, #next_element_sibling, #normalize_namespaces, #previous_element_sibling, #set_attribute, #set_attribute_node, #set_attribute_node_ns, #set_attribute_ns

Methods included from Child

#_leave_from_tree, #_set_next_sibling, #_set_parent_node, #initialize_child, #next_sibling, #parent_node, #previous_sibling

Constructor Details

#initialize(doc, namespace_uri, prefix, local_name) ⇒ ElementNS

:nodoc:



12
13
14
15
16
# File 'lib/vcdom/element_ns.rb', line 12

def initialize( doc, namespace_uri, prefix, local_name ) # :nodoc:
  super( doc, local_name )
  @namespace_uri = namespace_uri
  @prefix = prefix
end

Instance Method Details

#local_nameObject



34
35
36
# File 'lib/vcdom/element_ns.rb', line 34

def local_name
  @local_name.to_s()
end

#namespace_uriObject



37
38
39
# File 'lib/vcdom/element_ns.rb', line 37

def namespace_uri
  @namespace_uri.nil? ? nil : @namespace_uri.to_s()
end

#node_typeObject



18
19
20
# File 'lib/vcdom/element_ns.rb', line 18

def node_type
  ELEMENT_NODE
end

#prefixObject



31
32
33
# File 'lib/vcdom/element_ns.rb', line 31

def prefix
  @prefix.nil? ? nil : @prefix.to_s()
end

#tag_nameObject Also known as: node_name



22
23
24
25
26
27
28
# File 'lib/vcdom/element_ns.rb', line 22

def tag_name
  if @prefix then
    "#{@prefix.to_s}:#{@local_name.to_s}"
  else
    @local_name.to_s()
  end
end