meteor 0.9.12 → 0.9.14
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.
- checksums.yaml +4 -4
- data/ChangeLog +9 -1
- data/Gemfile.lock +3 -3
- data/README.md +5 -3
- data/demo/html.rb +82 -69
- data/demo/html4.rb +87 -77
- data/demo/ml/sample.xml +36 -38
- data/demo/ml/sample_html.html +12 -6
- data/demo/ml/sample_html4.html +13 -6
- data/demo/ml/sample_xhtml.html +13 -7
- data/demo/ml/sample_xhtml4.html +13 -6
- data/demo/xhtml.rb +71 -57
- data/demo/xhtml4.rb +61 -49
- data/demo/xml.rb +86 -81
- data/lib/meteor/attribute.rb +33 -0
- data/lib/meteor/attribute_map.rb +148 -0
- data/lib/meteor/core/kernel.rb +2210 -0
- data/lib/meteor/core/util/pattern_cache.rb +108 -0
- data/lib/meteor/element.rb +534 -0
- data/lib/meteor/element_factory.rb +68 -0
- data/lib/meteor/exception/no_such_element_exception.rb +84 -0
- data/lib/meteor/ml/html/parser_impl.rb +167 -0
- data/lib/meteor/ml/html4/parser_impl.rb +712 -0
- data/lib/meteor/ml/xhtml/parser_impl.rb +143 -0
- data/lib/meteor/ml/xhtml4/parser_impl.rb +406 -0
- data/lib/meteor/ml/xml/parser_impl.rb +170 -0
- data/lib/meteor/parser.rb +15 -0
- data/lib/meteor/parser_factory.rb +493 -0
- data/lib/meteor/root_element.rb +24 -0
- data/lib/meteor.rb +20 -5593
- data/meteor.gemspec +3 -3
- metadata +21 -6
data/demo/ml/sample_xhtml.html
CHANGED
|
@@ -1,33 +1,39 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
1
2
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
3
|
<html lang="ja">
|
|
3
4
|
<head>
|
|
4
|
-
<title>
|
|
5
|
-
<meta
|
|
5
|
+
<title>XHTMLテスト</title>
|
|
6
|
+
<meta charset="UTF-8"/>
|
|
6
7
|
</head>
|
|
7
8
|
|
|
8
9
|
<body>
|
|
10
|
+
<h1>XHTMLテスト</h1>
|
|
9
11
|
<div id="hello" class="black">Hello,World</div>
|
|
10
12
|
<div id="hello2">Hello,World</div>
|
|
11
13
|
<!-- @quark id="hello3" -->Hello,World<!-- /@quark -->
|
|
12
14
|
<form>
|
|
13
|
-
<
|
|
15
|
+
<label for="text1">text1</label>
|
|
16
|
+
<input id="text1" name="text1" type="text" />
|
|
14
17
|
|
|
15
|
-
<
|
|
18
|
+
<label for="radio1">radio1</label>
|
|
19
|
+
<input id="radio1" name="radio1" type="radio" />
|
|
16
20
|
|
|
17
|
-
<
|
|
21
|
+
<label for="select1">select1</label>
|
|
22
|
+
<select id="select1" name="select1">
|
|
18
23
|
<option id="option1">オプション</option>
|
|
19
24
|
</select>
|
|
20
25
|
|
|
21
|
-
<
|
|
26
|
+
<label for="select2">select2</label>
|
|
27
|
+
<select id="select2" name="select2">
|
|
22
28
|
<option id="option2">オプション</option>
|
|
23
29
|
</select>
|
|
24
30
|
</form>
|
|
25
31
|
|
|
26
32
|
<table>
|
|
33
|
+
<caption>table</caption>
|
|
27
34
|
<tr id="loop">
|
|
28
35
|
<td id="aa"></td><td id="bb"></td><td id="cc"></td>
|
|
29
36
|
</tr>
|
|
30
37
|
</table>
|
|
31
|
-
|
|
32
38
|
</body>
|
|
33
39
|
</html>
|
data/demo/ml/sample_xhtml4.html
CHANGED
|
@@ -1,33 +1,40 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
1
2
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
3
|
<html lang="ja">
|
|
3
4
|
<head>
|
|
4
|
-
<title>
|
|
5
|
+
<title>XHTML4テスト</title>
|
|
5
6
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
7
|
+
<meta charset="UTF-8"/>
|
|
6
8
|
</head>
|
|
7
9
|
|
|
8
10
|
<body>
|
|
11
|
+
<h1>XHTML4テスト</h1>
|
|
9
12
|
<div id="hello" class="black">Hello,World</div>
|
|
10
13
|
<div id="hello2">Hello,World</div>
|
|
11
14
|
<!-- @quark id="hello3" -->Hello,World<!-- /@quark -->
|
|
12
15
|
<form>
|
|
13
|
-
<
|
|
16
|
+
<label for="text1">text1</label>
|
|
17
|
+
<input id="text1" name="text1" type="text" />
|
|
14
18
|
|
|
15
|
-
<
|
|
19
|
+
<label for="radio1">radio1</label>
|
|
20
|
+
<input id="radio1" name="radio1" type="radio" />
|
|
16
21
|
|
|
17
|
-
<
|
|
22
|
+
<label for="select1">select1</label>
|
|
23
|
+
<select id="select1" name="select1">
|
|
18
24
|
<option id="option1">オプション</option>
|
|
19
25
|
</select>
|
|
20
26
|
|
|
21
|
-
<
|
|
27
|
+
<label for="select2">select2</label>
|
|
28
|
+
<select id="select2" name="select2">
|
|
22
29
|
<option id="option2">オプション</option>
|
|
23
30
|
</select>
|
|
24
31
|
</form>
|
|
25
32
|
|
|
26
33
|
<table>
|
|
34
|
+
<caption>table</caption>
|
|
27
35
|
<tr id="loop">
|
|
28
36
|
<td id="aa"></td><td id="bb"></td><td id="cc"></td>
|
|
29
37
|
</tr>
|
|
30
38
|
</table>
|
|
31
|
-
|
|
32
39
|
</body>
|
|
33
40
|
</html>
|
data/demo/xhtml.rb
CHANGED
|
@@ -2,77 +2,88 @@
|
|
|
2
2
|
# -* coding: UTF-8 -*-
|
|
3
3
|
# frozen_string_literal: true
|
|
4
4
|
|
|
5
|
-
#require 'rubygems'
|
|
6
|
-
require
|
|
5
|
+
# require 'rubygems'
|
|
6
|
+
require "meteor"
|
|
7
7
|
|
|
8
|
-
Meteor::ElementFactory.link(:xhtml,
|
|
9
|
-
root = Meteor::ElementFactory.element(
|
|
8
|
+
Meteor::ElementFactory.link(:xhtml, "ml/sample_xhtml.html", "UTF-8")
|
|
9
|
+
root = Meteor::ElementFactory.element("/ml/sample_xhtml")
|
|
10
10
|
|
|
11
11
|
startTime = Time.new.to_f
|
|
12
12
|
|
|
13
|
-
elm_hello = root.element(id:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
#elm_hello.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
elm_hello2
|
|
20
|
-
#elm_hello2.
|
|
21
|
-
|
|
22
|
-
#
|
|
23
|
-
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
elm_text1
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
#
|
|
33
|
-
|
|
34
|
-
#
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
|
|
40
|
-
#
|
|
41
|
-
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
|
|
49
|
-
|
|
13
|
+
elm_hello = root.element(id: "hello")
|
|
14
|
+
# elm_hello.attr(class: "red")
|
|
15
|
+
elm_hello["class"] = "red"
|
|
16
|
+
# elm_hello['class'] = nil # elm_hello.remove_attr('class')
|
|
17
|
+
# elm_hello.attr(class: nil)
|
|
18
|
+
|
|
19
|
+
elm_hello2 = root.element(id: "hello2")
|
|
20
|
+
# elm_hello2.content("Hello,Tester")
|
|
21
|
+
elm_hello2.content = "Hello,Tester"
|
|
22
|
+
# elm_hello2.remove
|
|
23
|
+
|
|
24
|
+
# elm_hello3 = root.cxtag("hello3")
|
|
25
|
+
# elm_hello3.content = "Hello,Hello\ntt" # elm_hello3.content("Hello,Hello\ntt")
|
|
26
|
+
# puts elm_hello3.content
|
|
27
|
+
# puts elm_hello3.mixed_content
|
|
28
|
+
|
|
29
|
+
elm_text1 = root.element(id: "text1")
|
|
30
|
+
# elm_text1.attr(value: 'めも')
|
|
31
|
+
elm_text1["value"] = "めも"
|
|
32
|
+
# elm_text1.attr(disabled: true)
|
|
33
|
+
elm_text1["disabled"] = true
|
|
34
|
+
# elm_text1.attr(required: true)
|
|
35
|
+
elm_text1["required"] = true
|
|
36
|
+
# map = elm_text1.attr_map
|
|
37
|
+
# map.names.each { |item|
|
|
38
|
+
# puts item
|
|
39
|
+
# puts map.fetch(item)
|
|
40
|
+
# }
|
|
41
|
+
|
|
42
|
+
# elm_radio1 = root.element("input",id: "radio1", type: "radio")
|
|
43
|
+
# elm_radio1['checked'] = true # elm_radio1.attr(checked: true)
|
|
44
|
+
|
|
45
|
+
# elm_select1 = root.element("select",id: "select1")
|
|
46
|
+
# elm_select1 = root.element("select")
|
|
47
|
+
# elm_select1['multiple'] = true # elm_select1.attr(multiple: true)
|
|
48
|
+
# puts elm_select1['multiple'] # puts elm_select1.attr("multiple")
|
|
49
|
+
# elm_option1 = root.element("option",id: "option1")
|
|
50
|
+
# elm_option1['selected'] = true # elm_option1.attr(selected: true)
|
|
51
|
+
# puts elm_option1['selected'] # puts elm_option1.attr("selected")
|
|
52
|
+
# puts elm_text1['readonly'] # puts elm_text1.attr("readonly")
|
|
53
|
+
|
|
54
|
+
elm_select2 = root.element("select", id: "select2")
|
|
50
55
|
elm_select2["multiple"] = true
|
|
51
|
-
elm_option2 = elm_select2.element("option",id: "option2")
|
|
52
|
-
co_elm = elm_option2.element
|
|
56
|
+
elm_option2 = elm_select2.element("option", id: "option2")
|
|
57
|
+
co_elm = elm_option2.element
|
|
53
58
|
10.times { |i|
|
|
54
|
-
if i == 1
|
|
55
|
-
|
|
59
|
+
if i == 1
|
|
60
|
+
# co_elm.attr(selected: true)
|
|
61
|
+
co_elm["selected"] = true
|
|
56
62
|
else
|
|
57
|
-
|
|
63
|
+
# co_elm.attr(selected: false)
|
|
64
|
+
co_elm["selected"] = false
|
|
58
65
|
end
|
|
59
|
-
|
|
60
|
-
co_elm[
|
|
61
|
-
|
|
66
|
+
# co_elm.attr(value: i)
|
|
67
|
+
co_elm["value"] = i
|
|
68
|
+
# co_elm.remove_attr("id")
|
|
69
|
+
co_elm["id"] = nil
|
|
70
|
+
# co_elm.content(i)
|
|
71
|
+
co_elm.content = i
|
|
62
72
|
co_elm.flash
|
|
63
73
|
}
|
|
64
74
|
|
|
65
|
-
elm_tr1 = root.element(
|
|
75
|
+
elm_tr1 = root.element("tr", id: "loop")
|
|
66
76
|
elm_ = elm_tr1.element
|
|
67
|
-
elm_dt1_ = elm_.element(id:
|
|
68
|
-
elm_dt2_ = elm_.element(id:
|
|
69
|
-
elm_dt3_ = elm_.element(id:
|
|
77
|
+
elm_dt1_ = elm_.element(id: "aa")
|
|
78
|
+
elm_dt2_ = elm_.element(id: "bb")
|
|
79
|
+
elm_dt3_ = elm_.element(id: "cc")
|
|
70
80
|
10.times { |i|
|
|
71
|
-
elm_[
|
|
81
|
+
elm_["loop"] = i
|
|
72
82
|
elm_dt1 = elm_dt1_.clone
|
|
73
83
|
elm_dt2 = elm_dt2_.clone
|
|
74
84
|
elm_dt3 = elm_dt3_.clone
|
|
75
|
-
|
|
85
|
+
# elm_dt1.content("<>\"' \n" << i.to_s)
|
|
86
|
+
elm_dt1.content = i
|
|
76
87
|
elm_dt2.content = i
|
|
77
88
|
elm_dt3.content = i
|
|
78
89
|
elm_.flash
|
|
@@ -82,6 +93,9 @@ root.flash
|
|
|
82
93
|
|
|
83
94
|
endTime = Time.new.to_f
|
|
84
95
|
|
|
85
|
-
puts
|
|
96
|
+
puts(root.document)
|
|
97
|
+
|
|
98
|
+
puts("charset:#{root.charset}")
|
|
99
|
+
puts("content-type:#{root.content_type}")
|
|
86
100
|
|
|
87
|
-
puts
|
|
101
|
+
puts("" + (endTime - startTime).to_s + " sec")
|
data/demo/xhtml4.rb
CHANGED
|
@@ -2,76 +2,85 @@
|
|
|
2
2
|
# -* coding: UTF-8 -*-
|
|
3
3
|
# frozen_string_literal: true
|
|
4
4
|
|
|
5
|
-
#require 'rubygems'
|
|
6
|
-
require
|
|
5
|
+
# require 'rubygems'
|
|
6
|
+
require "meteor"
|
|
7
7
|
|
|
8
|
-
Meteor::ElementFactory.link(:xhtml4,
|
|
9
|
-
root = Meteor::ElementFactory.element(
|
|
8
|
+
Meteor::ElementFactory.link(:xhtml4, "ml/sample_xhtml4.html", "UTF-8")
|
|
9
|
+
root = Meteor::ElementFactory.element("/ml/sample_xhtml4")
|
|
10
10
|
|
|
11
11
|
startTime = Time.new.to_f
|
|
12
12
|
|
|
13
|
-
elm_hello = root.element("id","hello")
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
elm_hello = root.element("id", "hello")
|
|
14
|
+
# elm_hello.attr(class: "red")
|
|
15
|
+
elm_hello["class"] = "red"
|
|
16
|
+
# elm_hello['class'] = nil # elm_hello.remove_attr('class')
|
|
16
17
|
|
|
17
18
|
elm_hello2 = root.element(id: "hello2")
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
#elm_hello3
|
|
23
|
-
#
|
|
24
|
-
#puts elm_hello3.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
#elm_text1
|
|
28
|
-
#elm_text1['
|
|
29
|
-
#
|
|
30
|
-
#map
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
#
|
|
19
|
+
# elm_hello2.content("Hello,Tester")
|
|
20
|
+
elm_hello2.content = "Hello,Tester"
|
|
21
|
+
# elm_hello2.remove
|
|
22
|
+
|
|
23
|
+
# elm_hello3 = root.cxtag("hello3")
|
|
24
|
+
# elm_hello3.content = "Hello,Hello\ntt" # elm_hello3.content("Hello,Hello\ntt")
|
|
25
|
+
# puts elm_hello3.content
|
|
26
|
+
# puts elm_hello3.mixed_content
|
|
27
|
+
|
|
28
|
+
# elm_text1 = root.element(id: "text1")
|
|
29
|
+
# elm_text1['value'] = 'めも' # elm_text1.attr(value: 'めも')
|
|
30
|
+
# elm_text1['disabled'] = true # elm_text1.attr(disabled: true)
|
|
31
|
+
# map = elm_text1.attr_map
|
|
32
|
+
# map.names.each { |item|
|
|
33
|
+
# puts item
|
|
34
|
+
# puts map.fetch(item)
|
|
35
|
+
# }
|
|
34
36
|
|
|
35
37
|
elm_radio1 = root.element("input", id: "radio1", type: "radio")
|
|
36
|
-
|
|
38
|
+
# elm_radio1.attribute(checked: true)
|
|
39
|
+
elm_radio1["checked"] = true
|
|
37
40
|
|
|
38
|
-
#elm_select1 = root.element("select",id: "select1")
|
|
39
|
-
#elm_select1 = root.element("select")
|
|
40
|
-
#elm_select1('multiple') = true #elm_select1.attr(multiple: true)
|
|
41
|
-
#puts elm_select1['multiple'] #puts elm_select1.attr("multiple")
|
|
41
|
+
# elm_select1 = root.element("select",id: "select1")
|
|
42
|
+
# elm_select1 = root.element("select")
|
|
43
|
+
# elm_select1('multiple') = true # elm_select1.attr(multiple: true)
|
|
44
|
+
# puts elm_select1['multiple'] # puts elm_select1.attr("multiple")
|
|
42
45
|
|
|
43
|
-
#elm_option1 = root.element("option",id: "option1")
|
|
44
|
-
#elm_option1['selected'] = true #elm_option1.attr(selected: true)
|
|
45
|
-
#puts elm_option1['selected'] #puts elm_option1.attr("selected")
|
|
46
|
-
#puts elm_option1['readonly'] #puts elm_text1.attr("readonly")
|
|
46
|
+
# elm_option1 = root.element("option",id: "option1")
|
|
47
|
+
# elm_option1['selected'] = true # elm_option1.attr(selected: true)
|
|
48
|
+
# puts elm_option1['selected'] # puts elm_option1.attr("selected")
|
|
49
|
+
# puts elm_option1['readonly'] # puts elm_text1.attr("readonly")
|
|
47
50
|
|
|
48
|
-
elm_select2 = root.element("select",id: "select2")
|
|
51
|
+
elm_select2 = root.element("select", id: "select2")
|
|
49
52
|
elm_select2["multiple"] = true
|
|
50
|
-
elm_option2 = elm_select2.element("option",id: "option2")
|
|
51
|
-
co_elm = elm_option2.element
|
|
53
|
+
elm_option2 = elm_select2.element("option", id: "option2")
|
|
54
|
+
co_elm = elm_option2.element
|
|
52
55
|
10.times { |i|
|
|
53
|
-
if i == 1
|
|
54
|
-
|
|
56
|
+
if i == 1
|
|
57
|
+
# co_elm.attr(selected: true)
|
|
58
|
+
co_elm["selected"] = true
|
|
55
59
|
else
|
|
56
|
-
|
|
60
|
+
# co_elm.attr(selected: false)
|
|
61
|
+
co_elm["selected"] = false
|
|
57
62
|
end
|
|
58
|
-
|
|
59
|
-
co_elm[
|
|
60
|
-
|
|
63
|
+
# co_elm.attr(value: i)
|
|
64
|
+
co_elm["value"] = i
|
|
65
|
+
# co_elm.remove_attr("id")
|
|
66
|
+
co_elm["id"] = nil
|
|
67
|
+
# co_elm.content(i)
|
|
68
|
+
co_elm.content = i
|
|
61
69
|
co_elm.flash
|
|
62
70
|
}
|
|
63
71
|
|
|
64
|
-
elm_tr1 = root.element(
|
|
72
|
+
elm_tr1 = root.element("tr", id: "loop")
|
|
65
73
|
elm_ = elm_tr1.element
|
|
66
|
-
elm_dt1_ = elm_.element(id:
|
|
67
|
-
elm_dt2_ = elm_.element(id:
|
|
68
|
-
elm_dt3_ = elm_.element(id:
|
|
74
|
+
elm_dt1_ = elm_.element(id: "aa")
|
|
75
|
+
elm_dt2_ = elm_.element(id: "bb")
|
|
76
|
+
elm_dt3_ = elm_.element(id: "cc")
|
|
69
77
|
10.times { |i|
|
|
70
|
-
elm_[
|
|
78
|
+
elm_["loop"] = i
|
|
71
79
|
elm_dt1 = elm_dt1_.clone
|
|
72
80
|
elm_dt2 = elm_dt2_.clone
|
|
73
81
|
elm_dt3 = elm_dt3_.clone
|
|
74
|
-
|
|
82
|
+
# elm_dt1.content("<>\"' \n" << i.to_s)
|
|
83
|
+
elm_dt1.content = i
|
|
75
84
|
elm_dt2.content = i
|
|
76
85
|
elm_dt3.content = i
|
|
77
86
|
elm_.flash
|
|
@@ -81,6 +90,9 @@ root.flash
|
|
|
81
90
|
|
|
82
91
|
endTime = Time.new.to_f
|
|
83
92
|
|
|
84
|
-
puts
|
|
93
|
+
puts(root.document)
|
|
85
94
|
|
|
86
|
-
puts
|
|
95
|
+
puts("charset:#{root.charset}")
|
|
96
|
+
puts("content-type:#{root.content_type}")
|
|
97
|
+
|
|
98
|
+
puts("" + (endTime - startTime).to_s + " sec")
|
data/demo/xml.rb
CHANGED
|
@@ -2,126 +2,131 @@
|
|
|
2
2
|
# -* coding: UTF-8 -*-
|
|
3
3
|
# frozen_string_literal: true
|
|
4
4
|
|
|
5
|
-
#require 'rubygems'
|
|
6
|
-
require
|
|
5
|
+
# require 'rubygems'
|
|
6
|
+
require "meteor"
|
|
7
7
|
|
|
8
|
-
Meteor::ElementFactory.link(Meteor::XML,
|
|
9
|
-
root = Meteor::ElementFactory.element(
|
|
8
|
+
Meteor::ElementFactory.link(Meteor::XML, "ml/sample.xml", "UTF-8")
|
|
9
|
+
root = Meteor::ElementFactory.element("/ml/sample")
|
|
10
10
|
|
|
11
11
|
start_time = Time.new.to_f
|
|
12
12
|
|
|
13
|
-
#elm_ = root.element('kobe')
|
|
14
|
-
#puts elm_.name
|
|
15
|
-
#puts elm_.attributes
|
|
16
|
-
#puts elm_.mixed_content
|
|
17
|
-
#puts elm_.text
|
|
13
|
+
# elm_ = root.element('kobe')
|
|
14
|
+
# puts elm_.name
|
|
15
|
+
# puts elm_.attributes
|
|
16
|
+
# puts elm_.mixed_content
|
|
17
|
+
# puts elm_.text
|
|
18
18
|
|
|
19
|
-
#elm_ = root.element('test')
|
|
20
|
-
#puts elm_.name
|
|
21
|
-
#puts elm_.attributes
|
|
22
|
-
#puts elm_.mixed_content
|
|
19
|
+
# elm_ = root.element('test')
|
|
20
|
+
# puts elm_.name
|
|
21
|
+
# puts elm_.attributes
|
|
22
|
+
# puts elm_.mixed_content
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
#
|
|
27
|
-
#
|
|
24
|
+
# elm1 = root.element(manbo: "manbo")
|
|
25
|
+
elm1 = root.element("test", manbo: "manbo")
|
|
26
|
+
# elm2 = root.element(id: "aa", id2: "bb") # elm2 = root.element(id: "aa")
|
|
27
|
+
# elm3 = root.element("potato", id: "aa")
|
|
28
|
+
# elm4 = root.element("potato", id: "aa", id2: "bb") # elm4 = root.element("potato", id2: "bb")
|
|
28
29
|
|
|
29
30
|
elm7 = root.element("kobe")
|
|
30
|
-
#elm7 = root.element(momo: "mono")
|
|
31
|
-
#elm8 = root.element(manbo: "mango")
|
|
32
|
-
#elm8 = root.element(momo: "momo")
|
|
31
|
+
# elm7 = root.element(momo: "mono")
|
|
32
|
+
# elm8 = root.element(manbo: "mango")
|
|
33
|
+
# elm8 = root.element(momo: "momo")
|
|
33
34
|
|
|
34
|
-
#elm9 = root.element("hamachi",id: "aa",id2: 'bb')
|
|
35
|
-
#elm_c1 = root.cxtag("cs")
|
|
35
|
+
# elm9 = root.element("hamachi",id: "aa",id2: 'bb')
|
|
36
|
+
# elm_c1 = root.cxtag("cs")
|
|
36
37
|
|
|
37
|
-
#puts elm8.name
|
|
38
|
-
#puts elm8.attributes
|
|
39
|
-
#puts elm8.mixed_content
|
|
38
|
+
# puts elm8.name
|
|
39
|
+
# puts elm8.attributes
|
|
40
|
+
# puts elm8.mixed_content
|
|
40
41
|
|
|
41
|
-
#elm1.attr(id2: "cc")
|
|
42
|
-
#elm1["id2"] = "cc"
|
|
42
|
+
# elm1.attr(id2: "cc")
|
|
43
|
+
# elm1["id2"] = "cc"
|
|
43
44
|
|
|
44
|
-
#elm8['mango'] = "mangoo" #elm8.attr(manbo: "mangoo")
|
|
45
|
-
#elm9.content = "\\1" #elm9.content("\\1")
|
|
45
|
+
# elm8['mango'] = "mangoo" # elm8.attr(manbo: "mangoo")
|
|
46
|
+
# elm9.content = "\\1" # elm9.content("\\1")
|
|
46
47
|
|
|
47
|
-
#elm2.attr(id3: 'cc')
|
|
48
|
+
# elm2.attr(id3: 'cc')
|
|
48
49
|
|
|
49
|
-
#elm3['id3'] = 'cc' #elm3.attr(id3: 'cc')
|
|
50
|
-
#elm3['id3'] = 'cc' #elm4.attr(id3: 'cc')
|
|
51
|
-
#elm9['id3'] = 'cc' #elm9.attr(id3: 'cc')
|
|
50
|
+
# elm3['id3'] = 'cc' # elm3.attr(id3: 'cc')
|
|
51
|
+
# elm3['id3'] = 'cc' # elm4.attr(id3: 'cc')
|
|
52
|
+
# elm9['id3'] = 'cc' # elm9.attr(id3: 'cc')
|
|
52
53
|
|
|
53
|
-
#co_elm = elm1.element()
|
|
54
|
-
#map = co_elm.attr_map
|
|
55
|
-
#map.names.each { |item|
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
#}
|
|
54
|
+
# co_elm = elm1.element()
|
|
55
|
+
# map = co_elm.attr_map
|
|
56
|
+
# map.names.each { |item|
|
|
57
|
+
# puts item
|
|
58
|
+
# puts map.fetch(item)
|
|
59
|
+
# }
|
|
59
60
|
|
|
60
61
|
elm_ = root.element(elm1)
|
|
61
|
-
elm5_ = elm_.element(
|
|
62
|
+
elm5_ = elm_.element("tech")
|
|
62
63
|
10.times do |i|
|
|
63
|
-
elm_[
|
|
64
|
+
elm_["manbo"] = i.to_s
|
|
64
65
|
elm5 = elm5_.clone
|
|
65
|
-
elm5[
|
|
66
|
+
elm5["mono"] = i.to_s
|
|
66
67
|
elm5.content = i.to_s
|
|
67
68
|
elm_.flash
|
|
68
69
|
end
|
|
69
70
|
|
|
70
|
-
#am3 = elm3.attr_map
|
|
71
|
-
#am3.names.each { |item|
|
|
72
|
-
#
|
|
73
|
-
#
|
|
74
|
-
#}
|
|
71
|
+
# am3 = elm3.attr_map
|
|
72
|
+
# am3.names.each { |item|
|
|
73
|
+
# puts item
|
|
74
|
+
# puts am3.fetch(item)
|
|
75
|
+
# }
|
|
75
76
|
|
|
76
77
|
elm_ = root.element(elm7)
|
|
77
78
|
|
|
78
79
|
10.times { |i|
|
|
79
|
-
elm_["momo"]= i
|
|
80
|
+
elm_["momo"] = i
|
|
80
81
|
elm_["eco"] = "えま"
|
|
81
|
-
|
|
82
|
+
# elm_["content"] = i.to_s
|
|
83
|
+
elm_.content = i
|
|
82
84
|
elm_.flash
|
|
83
85
|
}
|
|
84
86
|
|
|
85
|
-
#co_elm = root.element(elm_c1)
|
|
87
|
+
# co_elm = root.element(elm_c1)
|
|
86
88
|
#
|
|
87
|
-
#10.times { |i|
|
|
88
|
-
#
|
|
89
|
-
#
|
|
90
|
-
#}
|
|
89
|
+
# 10.times { |i|
|
|
90
|
+
# co_elm.content = i # co_elm.content(i)
|
|
91
|
+
# co_elm.flash
|
|
92
|
+
# }
|
|
91
93
|
|
|
92
|
-
#elm3['id3'] = 'dd' #elm3.attr(id3: 'dd')
|
|
94
|
+
# elm3['id3'] = 'dd' # elm3.attr(id3: 'dd')
|
|
93
95
|
|
|
94
96
|
root.flash
|
|
95
97
|
|
|
96
98
|
end_time = Time.new.to_f
|
|
97
99
|
|
|
98
|
-
puts
|
|
99
|
-
|
|
100
|
-
#elms = root.elements("potato2")
|
|
101
|
-
##elms = root.elements("kobe")
|
|
102
|
-
#elms = root.elements("potato")
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
elms.
|
|
106
|
-
|
|
107
|
-
puts
|
|
108
|
-
puts
|
|
109
|
-
puts
|
|
110
|
-
puts
|
|
111
|
-
puts
|
|
112
|
-
puts
|
|
100
|
+
puts(root.document)
|
|
101
|
+
|
|
102
|
+
# elms = root.elements("potato2")
|
|
103
|
+
## elms = root.elements("kobe")
|
|
104
|
+
# elms = root.elements("potato")
|
|
105
|
+
|
|
106
|
+
# elms = root.css('test')
|
|
107
|
+
elms = root.elements("test")
|
|
108
|
+
elms.each { |elm, i|
|
|
109
|
+
puts("-------")
|
|
110
|
+
puts("doc----")
|
|
111
|
+
puts(elm.document)
|
|
112
|
+
puts("attrs--")
|
|
113
|
+
puts(elm.attributes)
|
|
114
|
+
puts("mixed--")
|
|
115
|
+
puts(elm.mixed_content)
|
|
113
116
|
}
|
|
114
117
|
|
|
115
|
-
puts
|
|
118
|
+
puts("content-type:#{root.content_type}")
|
|
116
119
|
|
|
117
|
-
|
|
118
|
-
#obj = eval("\"#{elm3.name}\"")
|
|
119
|
-
#end_time = Time.new.to_f
|
|
120
|
-
#puts '' + (end_time - start_time).to_s + ' sec'
|
|
121
|
-
#puts obj
|
|
120
|
+
puts("" + (end_time - start_time).to_s + " sec")
|
|
122
121
|
|
|
123
|
-
#start_time = Time.new.to_f
|
|
124
|
-
#obj = elm3.name
|
|
125
|
-
#end_time = Time.new.to_f
|
|
126
|
-
#puts '' + (end_time - start_time).to_s + ' sec'
|
|
127
|
-
#puts obj
|
|
122
|
+
# start_time = Time.new.to_f
|
|
123
|
+
# obj = eval("\"#{elm3.name}\"")
|
|
124
|
+
# end_time = Time.new.to_f
|
|
125
|
+
# puts '' + (end_time - start_time).to_s + ' sec'
|
|
126
|
+
# puts obj
|
|
127
|
+
|
|
128
|
+
# start_time = Time.new.to_f
|
|
129
|
+
# obj = elm3.name
|
|
130
|
+
# end_time = Time.new.to_f
|
|
131
|
+
# puts '' + (end_time - start_time).to_s + ' sec'
|
|
132
|
+
# puts obj
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# -* coding: UTF-8 -*-
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Meteor
|
|
5
|
+
#
|
|
6
|
+
# Attribute class (属性クラス)
|
|
7
|
+
#
|
|
8
|
+
# @!attribute [rw] name
|
|
9
|
+
# @return [String,Symbol] attribute name (名前)
|
|
10
|
+
# @!attribute [rw] value
|
|
11
|
+
# @return [String] attribute value (値)
|
|
12
|
+
# @!attribute [rw] changed
|
|
13
|
+
# @return [true,false] update flag (更新フラグ)
|
|
14
|
+
# @!attribute [rw] removed
|
|
15
|
+
# @return [true,false] deletion flag (削除フラグ)
|
|
16
|
+
#
|
|
17
|
+
class Attribute
|
|
18
|
+
attr_accessor :name
|
|
19
|
+
attr_accessor :value
|
|
20
|
+
attr_accessor :changed
|
|
21
|
+
attr_accessor :removed
|
|
22
|
+
|
|
23
|
+
##
|
|
24
|
+
## initializer (イニシャライザ)
|
|
25
|
+
##
|
|
26
|
+
# def initialize
|
|
27
|
+
# @name = nil
|
|
28
|
+
# @value = nil
|
|
29
|
+
# @changed = false
|
|
30
|
+
# @removed = false
|
|
31
|
+
# end
|
|
32
|
+
end
|
|
33
|
+
end
|