vcdom 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. data/lib/vcdom/attr.rb +70 -0
  2. data/lib/vcdom/attr_node_map.rb +30 -0
  3. data/lib/vcdom/attr_ns.rb +38 -0
  4. data/lib/vcdom/character_data.rb +22 -0
  5. data/lib/vcdom/child.rb +53 -0
  6. data/lib/vcdom/document.rb +126 -0
  7. data/lib/vcdom/element.rb +332 -0
  8. data/lib/vcdom/element_ns.rb +44 -0
  9. data/lib/vcdom/node.rb +278 -0
  10. data/lib/vcdom/node_list.rb +32 -0
  11. data/lib/vcdom/parent.rb +126 -0
  12. data/lib/vcdom/text.rb +23 -0
  13. data/lib/vcdom/xml_parser.rb +368 -0
  14. data/lib/vcdom/xml_serializer.rb +55 -0
  15. metadata +48 -81
  16. data/History.txt +0 -4
  17. data/Manifest.txt +0 -34
  18. data/PostInstall.txt +0 -7
  19. data/README.rdoc +0 -51
  20. data/Rakefile +0 -26
  21. data/lib/vcdom/minidom/attr.rb +0 -139
  22. data/lib/vcdom/minidom/attr_ns.rb +0 -47
  23. data/lib/vcdom/minidom/cdata_section.rb +0 -34
  24. data/lib/vcdom/minidom/character_data.rb +0 -263
  25. data/lib/vcdom/minidom/comment.rb +0 -34
  26. data/lib/vcdom/minidom/document.rb +0 -245
  27. data/lib/vcdom/minidom/dom_exception.rb +0 -51
  28. data/lib/vcdom/minidom/dom_implementation.rb +0 -214
  29. data/lib/vcdom/minidom/element.rb +0 -512
  30. data/lib/vcdom/minidom/element_ns.rb +0 -42
  31. data/lib/vcdom/minidom/mini_parser.rb +0 -9
  32. data/lib/vcdom/minidom/mini_serializer.rb +0 -118
  33. data/lib/vcdom/minidom/minidom_standard_error.rb +0 -9
  34. data/lib/vcdom/minidom/mod_child_node.rb +0 -51
  35. data/lib/vcdom/minidom/mod_elements_getter.rb +0 -49
  36. data/lib/vcdom/minidom/mod_namespaceuri_manageable.rb +0 -152
  37. data/lib/vcdom/minidom/mod_parent_node.rb +0 -307
  38. data/lib/vcdom/minidom/named_node_map_attr.rb +0 -277
  39. data/lib/vcdom/minidom/node.rb +0 -178
  40. data/lib/vcdom/minidom/node_list.rb +0 -41
  41. data/lib/vcdom/minidom/text.rb +0 -77
  42. data/lib/vcdom/minidom/xml_reg_exp.rb +0 -39
  43. data/lib/vcdom/minidom.rb +0 -9
  44. data/lib/vcdom.rb +0 -6
  45. data/script/console +0 -10
  46. data/script/destroy +0 -14
  47. data/script/generate +0 -14
  48. data/test/test_helper.rb +0 -3
  49. data/test/test_vcdom.rb +0 -11
@@ -1,277 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- module VCDOM
4
- module MiniDOM
5
- class NamedNodeMapAttr
6
-
7
- include Enumerable
8
-
9
- # ===== Attributes =====
10
-
11
- # length of type unsigned long, readonly
12
- # The number of nodes in this map.
13
- # The range of valid child node indices is 0 to length-1 inclusive.
14
- def length; return @nodes.size() end
15
-
16
- # ===== Methods =====
17
-
18
- # item
19
- #
20
- # Returns the indexth item in the map. If index is greater than or equal to the number of nodes in this map, this returns null.
21
- #
22
- # Parameters
23
- # index of type unsigned long
24
- # Index into this map.
25
- # Return Value
26
- # Node
27
- # The node at the indexth position in the map, or null if that is not a valid index.
28
- # No Exceptions
29
- def item( index )
30
- if( index < 0 ) then
31
- return nil
32
- end
33
- return @nodes[index]
34
- end
35
-
36
- # getNamedItem
37
- #
38
- # Retrieves a node specified by name.
39
- #
40
- # Parameters
41
- # name of type DOMString
42
- # The nodeName of a node to retrieve.
43
- # Return Value
44
- # Node
45
- # A Node (of any type) with the specified nodeName, or null if it does not identify any node in this map.
46
- # No Exceptions
47
- def get_named_item( name )
48
- return @owner_element.get_attribute_node( name )
49
- end
50
-
51
- # getNamedItemNS introduced in DOM Level 2
52
- #
53
- # Retrieves a node specified by local name and namespace URI.
54
- # Per [XML Namespaces], applications must use the value null
55
- # as the namespaceURI parameter for methods if they wish to have no namespace.
56
- #
57
- # Parameters
58
- # namespaceURI of type DOMString
59
- # The namespace URI of the node to retrieve.
60
- # localName of type DOMString
61
- # The local name of the node to retrieve.
62
- # Return Value
63
- # Node
64
- # A Node (of any type) with the specified local name and namespace URI, or null
65
- # if they do not identify any node in this map.
66
- # Exceptions
67
- # DOMException
68
- # NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML"
69
- # and the language exposed through the Document does not support XML Namespaces
70
- # (such as [HTML 4.01]).
71
- def get_named_item_ns( namespace_uri, local_name )
72
- return @owner_element.get_attribute_node_ns( namespace_uri, local_name )
73
- end
74
-
75
- # setNamedItem
76
- #
77
- # Adds a node using its nodeName attribute.
78
- # #=> Node.nodeName を使用するノードを追加します.
79
- # If a node with that name is already present in this map,
80
- # it is replaced by the new one.
81
- # #=> もし同じ名前 (Node.nodeName) を持つノードが既にこのマップ内にある場合, 新しいものに置き換えられます.
82
- # Replacing a node by itself has no effect.
83
- # #=> 自分自身を自分自身で置き換えることは何の効果もありません.
84
- # As the nodeName attribute is used to derive the name which the node must be stored under,
85
- # multiple nodes of certain types (those that have a "special" string value) cannot be stored as
86
- # the names would clash.
87
- # #=> Node.nodeName が, 一意性を保証するために使用される名前を引き出すのに使用されるとき, 名前が衝突してしまうため
88
- # #=> あるタイプ (「特別な」 文字列値を持っているもの) の複数のノードを保存できません. ...?
89
- # This is seen as preferable to allowing nodes to be aliased.
90
- # #=> これはノードが aliased されるのを許容するより望ましいとみなされます.
91
- #
92
- # Parameters
93
- # arg of type Node
94
- # A node to store in this map.
95
- # The node will later be accessible using the value of its nodeName attribute.
96
- # Return Value
97
- # Node
98
- # If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned.
99
- # Exceptions
100
- # DOMException
101
- # WRONG_DOCUMENT_ERR: Raised if arg was created from a different document than the one that created
102
- # this map.
103
- # NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
104
- # INUSE_ATTRIBUTE_ERR: Raised if arg is an Attr that is already an attribute of another Element object.
105
- # The DOM user must explicitly clone Attr nodes to re-use them in other elements.
106
- # HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node doesn't belong in this NamedNodeMap.
107
- # Examples would include trying to insert something other than an Attr node
108
- # into an Element's map of attributes, or a non-Entity node into the DocumentType's map of
109
- # Entities.
110
- def set_named_item( arg )
111
- if arg.node_type != Node::ATTRIBUTE_NODE then
112
- raise DOMException.new( DOMException::HIERARCHY_REQUEST_ERR,
113
- 'This map can contain only nodes that are type of Attr.' )
114
- end
115
- begin
116
- replaced_node = @owner_element.set_attribute_node( arg )
117
- rescue DOMException => err
118
- case err.code
119
- when DOMException::WRONG_DOCUMENT_ERR then
120
- raise DOMException.new( err.code, 'The argument arg was created from a different document than the one that created this map.' )
121
- when DOMException::NO_MODIFICATION_ALLOWED_ERR then
122
- raise DOMException.new( err.code, 'This map is readonly.' )
123
- else
124
- raise DOMException.new( err )
125
- end
126
- end
127
- return replaced_node
128
- end
129
-
130
- # setNamedItemNS introduced in DOM Level 2
131
- #
132
- # Adds a node using its namespaceURI and localName.
133
- # If a node with that namespace URI and that local name is already present in this map,
134
- # it is replaced by the new one. Replacing a node by itself has no effect.
135
- # Per [XML Namespaces], applications must use the value null as the namespaceURI parameter
136
- # for methods if they wish to have no namespace.
137
- #
138
- # Parameters
139
- # arg of type Node
140
- # A node to store in this map. The node will later be accessible using the value of
141
- # its namespaceURI and localName attributes.
142
- # Return Value
143
- # Node
144
- # If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned.
145
- # Exceptions
146
- # DOMException
147
- # WRONG_DOCUMENT_ERR: Raised if arg was created from a different document than the one that created
148
- # this map.
149
- # NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
150
- # INUSE_ATTRIBUTE_ERR: Raised if arg is an Attr that is already an attribute of another Element object.
151
- # The DOM user must explicitly clone Attr nodes to re-use them in other elements.
152
- # HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node doesn't belong in this NamedNodeMap.
153
- # Examples would include trying to insert something other than an Attr node into
154
- # an Element's map of attributes, or a non-Entity node into the DocumentType's map of Entities.
155
- # NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML"
156
- # and the language exposed through the Document does not support XML Namespaces
157
- # (such as [HTML 4.01]).
158
- def set_named_item_ns( arg )
159
- if arg.node_type != Node::ATTRIBUTE_NODE then
160
- raise DOMException.new( DOMException::HIERARCHY_REQUEST_ERR,
161
- 'This map can contain only nodes that are type of Attr.' )
162
- end
163
- begin
164
- replaced_node = @owner_element.set_attribute_node_ns( arg )
165
- rescue DOMException => err
166
- case err.code
167
- when DOMException::WRONG_DOCUMENT_ERR then
168
- raise DOMException.new( err.code, 'The argument arg was created from a different document than the one that created this map.' )
169
- when DOMException::NO_MODIFICATION_ALLOWED_ERR then
170
- raise DOMException.new( err.code, 'This map is readonly.' )
171
- else
172
- raise DOMException.new( err )
173
- end
174
- end
175
- return replaced_node
176
- end
177
-
178
- # removeNamedItem
179
- #
180
- # Removes a node specified by name.
181
- # When this map contains the attributes attached to an element, if the removed attribute is known to
182
- # have a default value, an attribute immediately appears containing the default value as well as
183
- # the corresponding namespace URI, local name, and prefix when applicable.
184
- #
185
- # Parameters
186
- # name of type DOMString
187
- # The nodeName of the node to remove.
188
- # Return Value
189
- # Node
190
- # The node removed from this map if a node with such a name exists.
191
- # Exceptions
192
- # DOMException
193
- # NOT_FOUND_ERR: Raised if there is no node named name in this map.
194
- # NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
195
- def remove_named_item( name )
196
- attr = @owner_element.get_attribute_node( name )
197
- if ! attr.nil? then
198
- begin
199
- return @owner_element.remove_attribute_node( attr )
200
- rescue DOMException => err
201
- case err.code
202
- when DOMException::NO_MODIFICATION_ALLOWED_ERR then
203
- raise DOMException.new( err.code, 'This map is readonly.' )
204
- when DOMException::NOT_FOUND_ERR then
205
- raise DOMException.new( err.code, 'There is no node named name in this map.' )
206
- else
207
- raise DOMException.new( err )
208
- end
209
- end
210
- else
211
- raise DOMException.new( DOMException::NOT_FOUND_ERR,
212
- 'There is no node named name in this map.' )
213
- end
214
- end
215
-
216
- # removeNamedItemNS introduced in DOM Level 2
217
- #
218
- # Removes a node specified by local name and namespace URI.
219
- # A removed attribute may be known to have a default value when this map contains the attributes
220
- # attached to an element, as returned by the attributes attribute of the Node interface.
221
- # If so, an attribute immediately appears containing the default value as well as the corresponding
222
- # namespace URI, local name, and prefix when applicable.
223
- # Per [XML Namespaces], applications must use the value null as the namespaceURI parameter for methods
224
- # if they wish to have no namespace.
225
- #
226
- # Parameters
227
- # namespaceURI of type DOMString
228
- # The namespace URI of the node to remove.
229
- # localName of type DOMString
230
- # The local name of the node to remove.
231
- # Return Value
232
- # Node
233
- # The node removed from this map if a node with such a local name and namespace URI exists.
234
- # Exceptions
235
- # DOMException
236
- # NOT_FOUND_ERR: Raised if there is no node with the specified namespaceURI and localName in this map.
237
- # NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
238
- # NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML"
239
- # and the language exposed through the Document does not support XML Namespaces
240
- # (such as [HTML 4.01]).
241
- def remove_named_item_ns( namespace_uri, local_name )
242
- attr = @owner_element.get_attribute_node_ns( namespace_uri, local_name )
243
- if ! attr.nil? then
244
- begin
245
- return @owner_element.remove_attribute_node( attr )
246
- rescue DOMException => err
247
- case err.code
248
- when DOMException::NO_MODIFICATION_ALLOWED_ERR then
249
- raise DOMException.new( err.code, 'This map is readonly.' )
250
- when DOMException::NOT_FOUND_ERR then
251
- raise DOMException.new( err.code, 'There is no node named name in this map.' )
252
- else
253
- raise DOMException.new( err )
254
- end
255
- end
256
- else
257
- raise DOMException.new( DOMException::NOT_FOUND_ERR,
258
- 'There is no node named name in this map.' )
259
- end
260
- end
261
-
262
- # ===== 独自拡張 =====
263
-
264
- def each
265
- @nodes.each do |item|
266
- yield( item )
267
- end
268
- end
269
-
270
- def initialize( array, element )
271
- @nodes = array
272
- @owner_element = element
273
- end
274
-
275
- end
276
- end
277
- end
@@ -1,178 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- require "vcdom/minidom/node_list"
4
-
5
- module VCDOM
6
- module MiniDOM
7
- class Node
8
-
9
- ELEMENT_NODE = 1
10
- ATTRIBUTE_NODE = 2
11
- TEXT_NODE = 3
12
- CDATA_SECTION_NODE = 4
13
- ENTITY_REFERENCE_NODE = 5
14
- ENTITY_NODE = 6
15
- PROCESSING_INSTRUCTION_NODE = 7
16
- COMMENT_NODE = 8
17
- DOCUMENT_NODE = 9
18
- DOCUMENT_TYPE_NODE = 10
19
- DOCUMENT_FRAGMENT_NODE = 11
20
- NOTATION_NODE = 12
21
-
22
- @@empty_child_nodes = NodeList.new( [] )
23
-
24
- # clone_node
25
- # node_type
26
- # node_name
27
- # は各 class で実装
28
-
29
- # nodeValue of type DOMString
30
- # The value of this node, depending on its type; see the table above.
31
- # When it is defined to be null, setting it has no effect, including if the node is read-only.
32
- #
33
- # Interface nodeValue
34
- # ------------------------------------------------------------------------------------------------
35
- # Attr same as Attr.value
36
- # CDATASection same as CharacterData.data, the content of the CDATA Section
37
- # Comment same as CharacterData.data, the content of the comment
38
- # Document null
39
- # DocumentFragment null
40
- # DocumentType null
41
- # Element null
42
- # Entity null
43
- # EntityReference null
44
- # Notation null
45
- # ProcessingInstruction same as ProcessingInstruction.data
46
- # Text same as CharacterData.data, the content of the text node
47
- #
48
- # Exceptions on setting
49
- # DOMException
50
- # NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly and
51
- # if it is not defined to be null.
52
- # Exceptions on retrieval
53
- # DOMException
54
- # DOMSTRING_SIZE_ERR: Raised when it would return more characters than
55
- # fit in a DOMString variable on the implementation platform.
56
- #
57
- # Attr, PI, CharacterData ( = CDATASection, Comment, Text ) でオーバーロード
58
- def node_value; return nil end
59
- def node_value=( value ); end
60
-
61
- # textContent of type DOMString, introduced in DOM Level 3
62
- #
63
- # This attribute returns the text content of this node and its descendants.
64
- # When it is defined to be null, setting it has no effect.
65
- # On setting, any possible children this node may have are removed and,
66
- # if it the new string is not empty or null, replaced by a single Text node
67
- # containing the string this attribute is set to.
68
- # On getting, no serialization is performed, the returned string does not
69
- # contain any markup. No whitespace normalization is performed and the
70
- # returned string does not contain the white spaces in element content
71
- # (see the attribute Text.isElementContentWhitespace).
72
- # Similarly, on setting, no parsing is performed either, the input string
73
- # is taken as pure textual content.
74
- #
75
- # The string returned is made of the text content of this node depending on
76
- # its type, as defined below:
77
- #
78
- # Node type Content
79
- # ---------------------------------------------------
80
- # ELEMENT_NODE, ATTRIBUTE_NODE, concatenation of the textContent attribute value
81
- # ENTITY_NODE, of every child node, excluding COMMENT_NODE and
82
- # ENTITY_REFERENCE_NODE, PROCESSING_INSTRUCTION_NODE nodes. This is the
83
- # DOCUMENT_FRAGMENT_NODE empty string if the node has no children.
84
- # TEXT_NODE, CDATA_SECTION_NODE, nodeValue
85
- # COMMENT_NODE,
86
- # PROCESSING_INSTRUCTION_NODE
87
- # DOCUMENT_NODE, null ( = nodeValue )
88
- # DOCUMENT_TYPE_NODE,
89
- # NOTATION_NODE
90
- #
91
- # Exceptions on setting
92
- # DOMException
93
- # NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
94
- # Exceptions on retrieval
95
- # DOMException
96
- # DOMSTRING_SIZE_ERR: Raised when it would return more characters
97
- # than fit in a DOMString variable on the implementation platform.
98
- #
99
- # ModParentNode ( = Element, Attr, Entity, EntityReference, DocumentFragment )
100
- # Document
101
- # でオーバーライド
102
- def text_content
103
- return self.node_value
104
- end
105
- def text_content=( value )
106
- self.node_value = value
107
- end
108
-
109
- # ModChildNode でオーバーライド
110
- def parent_node; return nil end
111
- def previous_sibling; return nil end
112
- def next_sibling; return nil end
113
-
114
- # ModParentNode でオーバーライド
115
- def child_nodes; return @@empty_child_nodes end
116
- def first_child; return nil end
117
- def last_child; return nil end
118
- def has_child_nodes(); return false end
119
- def append_child( new_child )
120
- # 常に HIERARCHY_REQUEST_ERR
121
- raise DOMException.new( DOMException::HIERARCHY_REQUEST_ERR,
122
- 'This node can\'t have a child node.' )
123
- end
124
- def insert_before( new_child, ref_child )
125
- # 常に HIERARCHY_REQUEST_ERR
126
- raise DOMException.new( DOMException::HIERARCHY_REQUEST_ERR,
127
- 'This node can\'t have a child node.' )
128
- end
129
- def remove_child( old_child )
130
- # 常に NOT_FOUND_ERR
131
- raise DOMException.new( DOMException::NOT_FOUND_ERR,
132
- 'This node can\'t have a child node.' )
133
- end
134
- def replace_child( new_child, old_child )
135
- # 常に NOT_FOUND_ERR
136
- raise DOMException.new( DOMException::NOT_FOUND_ERR,
137
- 'This node can\'t have a child node.' )
138
- end
139
-
140
- # Element でオーバーライド
141
- def attributes; return nil end
142
- def has_attributes(); return false end
143
-
144
- # ElementNS, AttrNS でオーバーライド
145
- def namespace_uri; return nil end
146
- def local_name; return nil end
147
- def prefix; return nil end
148
- def prefix=( value ); end
149
-
150
- # ownerDocument of type Document, readonly, modified in DOM Level 2
151
- # The Document object associated with this node.
152
- # This is also the Document object used to create new nodes.
153
- # When this node is a Document or a DocumentType which is not used with any Document yet, this is null.
154
- def owner_document; return @owner_document end
155
-
156
- def initialize( owner_document )
157
- @owner_document = owner_document
158
- end
159
-
160
- protected
161
- def owner_document=( value )
162
- @owner_document = value
163
- end
164
-
165
- def is_readonly()
166
- elem = self
167
- while ! elem.nil? do
168
- case elem.node_type
169
- when Node::ENTITY_NODE, Node::NOTATION_NODE then return true
170
- end
171
- elem = elem.parent_node
172
- end
173
- return false
174
- end
175
-
176
- end
177
- end
178
- end
@@ -1,41 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # ソースコードのエンコーディング指定
3
-
4
- module VCDOM
5
- module MiniDOM
6
- class NodeList
7
-
8
- include Enumerable
9
-
10
- # ===== インスタンス変数 =====
11
- # 子ノードを配列で保持
12
- def length; return @nodes.length end
13
- def item( index )
14
- # aIndex が 0 より小さい場合は nil を返す
15
- return nil if index < 0
16
- # 大きすぎて範囲外の場合は自動的に nil になる
17
- return @nodes[index]
18
- end
19
-
20
- # ===== 独自拡張 =====
21
-
22
- def each
23
- @nodes.each do |item|
24
- yield( item )
25
- end
26
- end
27
-
28
- def each_with_index
29
- @nodes.each_with_index do |item, index|
30
- yield( item, index )
31
- end
32
- end
33
-
34
- # ===== コンストラクタ =====
35
- def initialize( array )
36
- @nodes = array
37
- end
38
-
39
- end
40
- end
41
- end
@@ -1,77 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- require "vcdom/minidom/node"
4
- require "vcdom/minidom/character_data"
5
- require "vcdom/minidom/mod_child_node"
6
- require "vcdom/minidom/dom_exception"
7
-
8
- module VCDOM
9
- module MiniDOM
10
- class Text < CharacterData
11
-
12
- # nodeType of type unsigned short, readonly
13
- # A code representing the type of the underlying object, as defined above.
14
- def node_type
15
- return Node::TEXT_NODE
16
- end
17
-
18
- # nodeName of type DOMString, readonly
19
- # The name of this node, depending on its type; see the table above.
20
- #
21
- # Interface nodeName
22
- # --------------------------------------------------
23
- # Text "#text"
24
- def node_name
25
- return "#text"
26
- end
27
-
28
- # splitText
29
- #
30
- # Breaks this node into two nodes at the specified offset, keeping both in the
31
- # tree as siblings. After being split, this node will contain all the content
32
- # up to the offset point. A new node of the same type, which contains all the
33
- # content at and after the offset point, is returned. If the original node had
34
- # a parent node, the new node is inserted as the next sibling of the original
35
- # node. When the offset is equal to the length of this node, the new node has
36
- # no data.
37
- #
38
- # Parameters
39
- # offset of type unsigned long
40
- # The 16-bit unit offset at which to split, starting from 0.
41
- # Return Value
42
- # Text
43
- # The new node, of the same type as this node.
44
- # Exceptions
45
- # DOMException
46
- # INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than
47
- # the number of 16-bit units in data.
48
- # NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
49
- def split_text( offset )
50
- if self.is_readonly then
51
- raise DOMException.new( DOMException::NO_MODIFICATION_ALLOWED_ERR,
52
- 'This node is readonly.' )
53
- end
54
- begin
55
- substrs = split( offset )
56
- rescue DOMException => err
57
- raise DOMException.new( err )
58
- end
59
- self.data = substr[0]
60
- new_node = self.owner_document.create_text_node( substrs[1] )
61
- if ! self.parent_node.nil? then
62
- if ! self.next_sibling.nil? then
63
- self.parent_node.insert_before( new_node, self.next_sibling )
64
- else
65
- self.parent_node.append_child( new_node )
66
- end
67
- end
68
- return new_node
69
- end
70
-
71
- def initialize( owner_document, value )
72
- super( owner_document, value )
73
- end
74
-
75
- end
76
- end
77
- end
@@ -1,39 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- module VCDOM
4
- module MiniDOM
5
- module XMLRegExp
6
-
7
- def self.create_range_str( arg )
8
- [arg[0]].pack('U') + '-' + [arg[1]].pack('U')
9
- end
10
-
11
- # cf. http://www.w3.org/TR/REC-xml/#NT-Name
12
- STR_NCNAME_START_CHAR = '_a-zA-Z' +
13
- create_range_str( [0xC0,0xD6] ) +
14
- create_range_str( [0xD8,0xF6] ) +
15
- create_range_str( [0xF8,0x2FF] ) +
16
- create_range_str( [0x370,0x37D] ) +
17
- create_range_str( [0x37F,0x1FFF] ) +
18
- create_range_str( [0x200C,0x200D] ) +
19
- create_range_str( [0x2070,0x218F] ) +
20
- create_range_str( [0x2C00,0x2FEF] ) +
21
- create_range_str( [0x3001,0xD7FF] ) +
22
- create_range_str( [0xF900,0xFDCF] ) +
23
- create_range_str( [0xFDF0,0xFFFD] ) +
24
- create_range_str( [0x10000,0xEFFFF] )
25
- STR_NCNAME_CHAR = STR_NCNAME_START_CHAR + '\-\.0-9' +
26
- [0xB7].pack('U') + create_range_str( [0x0300,0x036F] ) +
27
- create_range_str( [0x203F,0x2040] )
28
- STR_NCNAME = '[' + STR_NCNAME_START_CHAR + '][' + STR_NCNAME_CHAR + ']*'
29
- NCNAME = /\A#{STR_NCNAME}\Z/u
30
- QNAME = /\A#{STR_NCNAME}(?:\:#{STR_NCNAME})?\Z/u
31
-
32
- STR_NAME_START_CHAR = '\:' + STR_NCNAME_START_CHAR
33
- STR_NAME_CHAR = '\:' + STR_NCNAME_CHAR
34
- STR_NAME = '[' + STR_NAME_START_CHAR + '][' + STR_NAME_CHAR + ']*'
35
- NAME = /\A#{STR_NAME}\Z/u
36
-
37
- end
38
- end
39
- end
data/lib/vcdom/minidom.rb DELETED
@@ -1,9 +0,0 @@
1
- require "vcdom/minidom/dom_implementation"
2
-
3
- module VCDOM
4
- module MiniDOM
5
- def self.get_dom_implementation()
6
- return VCDOM::MiniDOM::DOMImplementation.get_instance()
7
- end
8
- end
9
- end
data/lib/vcdom.rb DELETED
@@ -1,6 +0,0 @@
1
- $:.unshift(File.dirname(__FILE__)) unless
2
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
-
4
- module VCDOM
5
- VERSION = '0.2.0'
6
- end
data/script/console DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
-
5
- libs = " -r irb/completion"
6
- # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
- # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
- libs << " -r #{File.dirname(__FILE__) + '/../lib/vcdom.rb'}"
9
- puts "Loading vcdom gem"
10
- exec "#{irb} #{libs} --simple-prompt"
data/script/destroy DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Generate.new.run(ARGV)
data/test/test_helper.rb DELETED
@@ -1,3 +0,0 @@
1
- require 'stringio'
2
- require 'test/unit'
3
- require File.dirname(__FILE__) + '/../lib/vcdom'