Class: VCDOM::MiniDOM::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/vcdom/minidom/node.rb

Direct Known Subclasses

Attr, CharacterData, Document, Element

Constant Summary collapse

ELEMENT_NODE =
1
ATTRIBUTE_NODE =
2
TEXT_NODE =
3
CDATA_SECTION_NODE =
4
ENTITY_REFERENCE_NODE =
5
ENTITY_NODE =
6
PROCESSING_INSTRUCTION_NODE =
7
COMMENT_NODE =
8
DOCUMENT_NODE =
9
DOCUMENT_TYPE_NODE =
10
DOCUMENT_FRAGMENT_NODE =
11
NOTATION_NODE =
12
@@empty_child_nodes =
NodeList.new( [] )

Instance Method Summary collapse

Constructor Details

#initialize(owner_document) ⇒ Node

Returns a new instance of Node.



156
157
158
# File 'lib/vcdom/minidom/node.rb', line 156

def initialize( owner_document )
  @owner_document = owner_document
end

Instance Method Details

#append_child(new_child) ⇒ Object

Raises:



119
120
121
122
123
# File 'lib/vcdom/minidom/node.rb', line 119

def append_child( new_child )
  # 常に HIERARCHY_REQUEST_ERR
  raise DOMException.new( DOMException::HIERARCHY_REQUEST_ERR, 
          'This node can\'t have a child node.' )
end

#attributesObject

Element でオーバーライド



141
# File 'lib/vcdom/minidom/node.rb', line 141

def attributes; return nil end

#child_nodesObject

ModParentNode でオーバーライド



115
# File 'lib/vcdom/minidom/node.rb', line 115

def child_nodes; return @@empty_child_nodes end

#first_childObject



116
# File 'lib/vcdom/minidom/node.rb', line 116

def first_child; return nil end

#has_attributesObject



142
# File 'lib/vcdom/minidom/node.rb', line 142

def has_attributes(); return false end

#has_child_nodesObject



118
# File 'lib/vcdom/minidom/node.rb', line 118

def has_child_nodes(); return false end

#insert_before(new_child, ref_child) ⇒ Object

Raises:



124
125
126
127
128
# File 'lib/vcdom/minidom/node.rb', line 124

def insert_before( new_child, ref_child )
  # 常に HIERARCHY_REQUEST_ERR
  raise DOMException.new( DOMException::HIERARCHY_REQUEST_ERR, 
          'This node can\'t have a child node.' )
end

#last_childObject



117
# File 'lib/vcdom/minidom/node.rb', line 117

def last_child;  return nil end

#local_nameObject



146
# File 'lib/vcdom/minidom/node.rb', line 146

def local_name;    return nil end

#namespace_uriObject

ElementNS, AttrNS でオーバーライド



145
# File 'lib/vcdom/minidom/node.rb', line 145

def namespace_uri; return nil end

#next_siblingObject



112
# File 'lib/vcdom/minidom/node.rb', line 112

def next_sibling;     return nil end

#node_valueObject

nodeValue of type DOMString

The value of this node, depending on its type; see the table above. 
When it is defined to be null, setting it has no effect, including if the node is read-only.

 Interface             nodeValue
 ------------------------------------------------------------------------------------------------
 Attr                  same as Attr.value
 CDATASection          same as CharacterData.data, the content of the CDATA Section
 Comment               same as CharacterData.data, the content of the comment
 Document              null
 DocumentFragment      null
 DocumentType          null   
 Element               null 
 Entity                null
 EntityReference       null  
 Notation              null
 ProcessingInstruction same as ProcessingInstruction.data  
 Text                  same as CharacterData.data, the content of the text node

Exceptions on setting
  DOMException
    NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly and 
              if it is not defined to be null.
Exceptions on retrieval
  DOMException
    DOMSTRING_SIZE_ERR: Raised when it would return more characters than 
              fit in a DOMString variable on the implementation platform.

Attr, PI, CharacterData ( = CDATASection, Comment, Text ) でオーバーロード



58
# File 'lib/vcdom/minidom/node.rb', line 58

def node_value; return nil end

#node_value=(value) ⇒ Object



59
# File 'lib/vcdom/minidom/node.rb', line 59

def node_value=( value );  end

#owner_documentObject

ownerDocument of type Document, readonly, modified in DOM Level 2

The Document object associated with this node. 
This is also the Document object used to create new nodes. 
When this node is a Document or a DocumentType which is not used with any Document yet, this is null.


154
# File 'lib/vcdom/minidom/node.rb', line 154

def owner_document; return @owner_document end

#parent_nodeObject

ModChildNode でオーバーライド



110
# File 'lib/vcdom/minidom/node.rb', line 110

def parent_node;      return nil end

#prefixObject



147
# File 'lib/vcdom/minidom/node.rb', line 147

def prefix; return nil end

#prefix=(value) ⇒ Object



148
# File 'lib/vcdom/minidom/node.rb', line 148

def prefix=( value ); end

#previous_siblingObject



111
# File 'lib/vcdom/minidom/node.rb', line 111

def previous_sibling; return nil end

#remove_child(old_child) ⇒ Object

Raises:



129
130
131
132
133
# File 'lib/vcdom/minidom/node.rb', line 129

def remove_child( old_child )
  # 常に NOT_FOUND_ERR
  raise DOMException.new( DOMException::NOT_FOUND_ERR, 
          'This node can\'t have a child node.' )
end

#replace_child(new_child, old_child) ⇒ Object

Raises:



134
135
136
137
138
# File 'lib/vcdom/minidom/node.rb', line 134

def replace_child( new_child, old_child )
  # 常に NOT_FOUND_ERR
  raise DOMException.new( DOMException::NOT_FOUND_ERR, 
          'This node can\'t have a child node.' )
end

#text_contentObject

textContent of type DOMString, introduced in DOM Level 3

This attribute returns the text content of this node and its descendants. 
When it is defined to be null, setting it has no effect. 
On setting, any possible children this node may have are removed and, 
if it the new string is not empty or null, replaced by a single Text node 
containing the string this attribute is set to.
On getting, no serialization is performed, the returned string does not 
contain any markup. No whitespace normalization is performed and the 
returned string does not contain the white spaces in element content 
(see the attribute Text.isElementContentWhitespace). 
Similarly, on setting, no parsing is performed either, the input string 
is taken as pure textual content.

The string returned is made of the text content of this node depending on 
its type, as defined below:

     Node type                        Content
     ---------------------------------------------------
     ELEMENT_NODE, ATTRIBUTE_NODE,    concatenation of the textContent attribute value
      ENTITY_NODE,                     of every child node, excluding COMMENT_NODE and 
      ENTITY_REFERENCE_NODE,           PROCESSING_INSTRUCTION_NODE nodes. This is the  
      DOCUMENT_FRAGMENT_NODE           empty string if the node has no children.
     TEXT_NODE, CDATA_SECTION_NODE,   nodeValue
      COMMENT_NODE,
      PROCESSING_INSTRUCTION_NODE
     DOCUMENT_NODE,                   null ( = nodeValue )
      DOCUMENT_TYPE_NODE, 
      NOTATION_NODE

Exceptions on setting
  DOMException
    NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
Exceptions on retrieval
  DOMException
    DOMSTRING_SIZE_ERR: Raised when it would return more characters 
              than fit in a DOMString variable on the implementation platform.

ModParentNode ( = Element, Attr, Entity, EntityReference, DocumentFragment ) Document でオーバーライド



102
103
104
# File 'lib/vcdom/minidom/node.rb', line 102

def text_content
  return self.node_value
end

#text_content=(value) ⇒ Object



105
106
107
# File 'lib/vcdom/minidom/node.rb', line 105

def text_content=( value )
  self.node_value = value
end