meteor 0.9.8.1 → 0.9.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,104 +1,83 @@
1
1
  #!bin ruby
2
2
  # -* coding: UTF-8 -*-
3
3
 
4
- require 'rubygems'
4
+ #require 'rubygems'
5
5
  require 'meteor'
6
6
 
7
- #pf = Meteor::ParserFactory.new
8
- #pf.bind(:xhtml5,"sample_x5.html", "UTF-8")
9
-
10
- #root = pf.element('sample_x5')
11
-
12
- Meteor::ElementFactory.bind(:xhtml5,'sample_x5.html', 'UTF-8')
13
- root = Meteor::ElementFactory.element('sample_x5')
7
+ Meteor::ElementFactory.link(:xhtml5,'ml/sample_x5.html', 'UTF-8')
8
+ root = Meteor::ElementFactory.element('/ml/sample_x5')
14
9
 
15
10
  startTime = Time.new.to_f
16
11
 
17
- elm_hello = root.element("id","hello")
18
- #elm_hello.attr("color"=>"red")
19
- elm_hello['color'] = 'red'
20
- #elm_hello.remove_attr('color')
21
-
22
- elm_hello2 = root.element("id"=>"hello2")
23
- #elm_hello2.content("Hello,Tester")
24
- elm_hello2.content = "Hello,Tester"
12
+ elm_hello = root.element(id: 'hello')
13
+ elm_hello['color'] = 'red' #elm_hello.attr(color: "red")
14
+ #elm_hello['color'] = nil #elm_hello.remove_attr('color')
15
+ #elm_hello.attr(color: nil)
25
16
 
17
+ elm_hello2 = root.element(id: 'hello2')
18
+ elm_hello2.content = "Hello,Tester" #elm_hello2.content("Hello,Tester")
26
19
  #elm_hello2.remove
20
+
27
21
  #elm_hello3 = root.cxtag("hello3")
28
- ##elm_hello3.content("Hello,Hello\ntt")
29
- #elm_hello3.content = "Hello,Hello\ntt"
22
+ #elm_hello3.content = "Hello,Hello\ntt" #elm_hello3.content("Hello,Hello\ntt")
30
23
  #puts elm_hello3.content
31
24
  #puts elm_hello3.mixed_content
32
25
 
33
- elm_text1 = root.element('id'=>'text1')
34
- #elm_text1.attr("value","めも")
35
- elm_text1['value'] = 'めも'
36
- #elm_text1.attr("disabled"=>true)
37
- elm_text1['disabled'] = true
38
- #elm_text1.attr('required'=>true)
39
- elm_text1['required'] = true
26
+ elm_text1 = root.element(id: 'text1')
27
+ elm_text1['value'] = 'めも' #elm_text1.attr(value: 'めも')
28
+ elm_text1['disabled'] = true #elm_text1.attr(disabled: true)
29
+ elm_text1['required'] = true #elm_text1.attr(required: true)
40
30
  #map = elm_text1.attr_map
41
31
  #map.names.each { |item|
42
32
  # puts item
43
33
  # puts map.fetch(item)
44
34
  #}
45
35
 
46
- #elm_radio1 = root.element("input","id"=>"radio1","type"=>"radio")
47
- ##elm_radio1.attr("checked"=>"true")
48
- #elm_radio1['checked'] = true
36
+ #elm_radio1 = root.element("input",id: "radio1", type: "radio")
37
+ #elm_radio1['checked'] = true #elm_radio1.attr(checked: true)
49
38
 
50
- #elm_select1 = root.element("select","id"=>"select1")
39
+ #elm_select1 = root.element("select",id: "select1")
51
40
  #elm_select1 = root.element("select")
52
- ##elm_select1.attr("multiple"=>true)
53
- #elm_select1['multiple'] = true
54
- ##puts elm_select1.attr("multiple")
55
- #puts elm_select1['multiple']
56
- #elm_option1 = root.element("option","id"=>"option1")
57
- ##elm_option1.attr("selected"=>"true")
58
- #elm_option1['selected'] = true
59
- ##puts elm_option1.attr("selected")
60
- #puts elm_option1['selected']
61
- ##puts elm_text1.attr("readonly")
62
- #puts elm_text1['readonly']
63
-
64
- #elm_select2 = root.element("select","id"=>"select2")
65
- #elm_select2["multiple"] = "true"
66
- #elm_option2 = root.element("option","id"=>"option2")
67
- #co_ps = elm_option2.element()
68
- #10.times { |i|
69
- # if i == 1 then
70
- # #co_ps.attr("selected"=>"true")
71
- # co_ps['selected'] = true
72
- # else
73
- # #co_ps.attr("selected"=>"false")
74
- # co_ps['selected'] = false
75
- # end
76
- # #co_ps.attr("value"=>i.to_s)
77
- # co_ps['value'] = i.to_s
78
- # co_ps.remove_attr("id")
79
- # #co_ps.content(i.to_s)
80
- # co_ps.content = i.to_s
81
- # co_ps.flush
82
- #}
41
+ #elm_select1['multiple'] = true #elm_select1.attr(multiple: true)
42
+ #puts elm_select1['multiple'] #puts elm_select1.attr("multiple")
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_text1['readonly'] #puts elm_text1.attr("readonly")
47
+
48
+ elm_select2 = root.element("select",id: "select2")
49
+ elm_select2["multiple"] = true
50
+ elm_option2 = elm_select2.element("option",id: "option2")
51
+ co_elm = elm_option2.element()
52
+ 10.times { |i|
53
+ if i == 1 then
54
+ co_elm['selected'] = true #co_elm.attr(selected: true)
55
+ else
56
+ co_elm['selected'] = false #co_elm.attr(selected: false)
57
+ end
58
+ co_elm['value'] = i #co_elm.attr(value: i)
59
+ co_elm['id'] = nil #co_elm.remove_attr("id")
60
+ co_elm.content = i #co_elm.content(i)
61
+ co_elm.flash
62
+ }
83
63
 
84
- elm_tr1 = root.element('tr','id'=>'loop')
64
+ elm_tr1 = root.element('tr',id: 'loop')
85
65
  elm_ = elm_tr1.element
86
- elm_dt1_ = elm_.element('id'=>'aa')
87
- elm_dt2_ = elm_.element('id'=>'bb')
88
- elm_dt3_ = elm_.element('id'=>'cc')
66
+ elm_dt1_ = elm_.element(id: 'aa')
67
+ elm_dt2_ = elm_.element(id: 'bb')
68
+ elm_dt3_ = elm_.element(id: 'cc')
89
69
  10.times { |i|
90
- elm_['loop'] = i.to_s
70
+ elm_['loop'] = i
91
71
  elm_dt1 = elm_dt1_.clone
92
72
  elm_dt2 = elm_dt2_.clone
93
73
  elm_dt3 = elm_dt3_.clone
94
- #elm_dt1.content("<>\"' \n" << i.to_s)
95
- elm_dt1.content=i.to_s
96
- elm_dt2.content=i.to_s
97
- elm_dt3.content=i.to_s
98
- elm_.flush
74
+ elm_dt1.content = i #elm_dt1.content("<>\"' \n" << i.to_s)
75
+ elm_dt2.content = i
76
+ elm_dt3.content = i
77
+ elm_.flash
99
78
  }
100
79
 
101
- root.flush
80
+ root.flash
102
81
 
103
82
  endTime = Time.new.to_f
104
83
 
@@ -1,66 +1,56 @@
1
1
  #!bin ruby
2
2
  # -* coding: UTF-8 -*-
3
3
 
4
- require 'rubygems'
4
+ #require 'rubygems'
5
5
  require 'meteor'
6
6
 
7
- #pf = Meteor::ParserFactory.new
8
- #pf.parser(Meteor::Parser::XML,'sample.xml', 'UTF-8')
9
- #pf.bind(Meteor::Parser::XML,'sample.xml')
10
-
11
- #root = pf.element('sample')
12
-
13
- Meteor::ElementFactory.bind(Meteor::XML,'sample.xml', 'UTF-8')
14
- root = Meteor::ElementFactory.element('sample')
7
+ Meteor::ElementFactory.link(Meteor::XML,'ml/sample.xml', 'UTF-8')
8
+ root = Meteor::ElementFactory.element('/ml/sample')
15
9
 
16
10
  start_time = Time.new.to_f
17
11
 
18
- #elm_ = root.element('test1')
12
+ #elm_ = root.element('kobe')
19
13
  #puts elm_.name
20
14
  #puts elm_.attributes
21
15
  #puts elm_.mixed_content
16
+ #puts elm_.text
22
17
 
23
18
  #elm_ = root.element('test')
24
19
  #puts elm_.name
25
20
  #puts elm_.attributes
26
21
  #puts elm_.mixed_content
27
22
 
28
- elm1 = root.element('test','manbo'=>'manbo')
29
- #elm1 = root.element("manbo"=>"manbo")
30
- #elm2 = root.element("id"=>"aa","id2"=>"bb")
31
- #elm2 = root.element("id"=>"aa")
32
- #elm3 = root.element("potato","id"=>"aa")
33
- #elm4 = root.element("potato","id"=>"aa","id2"=>"bb")
34
- #elm4 = root.element("potato","id2"=>"bb")
23
+ elm1 = root.element('test', manbo: 'manbo') #elm1 = root.element(manbo: "manbo")
24
+ #elm2 = root.element(id: "aa", id2: "bb") #elm2 = root.element(id: "aa")
25
+ #elm3 = root.element("potato", id: "aa")
26
+ #elm4 = root.element("potato", id: "aa", id2: "bb") #elm4 = root.element("potato", id2: "bb")
27
+
35
28
  elm7 = root.element("kobe")
36
- #elm7 = root.element("momo"=>"mono")
37
- #elm8 = root.element("manbo"=>"mango")
38
- #elm8 = root.element("momo"=>"momo")
29
+ #elm7 = root.element(momo: "mono")
30
+ #elm8 = root.element(manbo: "mango")
31
+ #elm8 = root.element(momo: "momo")
39
32
 
40
- #elm9 = root.element("hamachi","id"=>"aa",'id2'=>'bb')
33
+ #elm9 = root.element("hamachi",id: "aa",id2: 'bb')
41
34
  #elm_c1 = root.cxtag("cs")
42
35
 
43
- #elm8.attr("manbo"=>"mangoo")
44
-
45
36
  #puts elm8.name
46
37
  #puts elm8.attributes
47
38
  #puts elm8.mixed_content
48
39
 
49
- #elm1.attr("id2"=>"cc")
50
- #elm1["id2"]="cc"
40
+ #elm1.attr(id2: "cc")
41
+ #elm1["id2"] = "cc"
51
42
 
52
- #elm8.attr("manbo"=>"mangoo")
53
- ##elm9.content("\\1")
54
- #elm9.content = "\\1"
43
+ #elm8['mango'] = "mangoo" #elm8.attr(manbo: "mangoo")
44
+ #elm9.content = "\\1" #elm9.content("\\1")
55
45
 
56
- #elm2.attr('id3'=>'cc')
57
- #elm3.attr('id3'=>'cc')
58
- #elm3['id3'] = 'cc'
59
- #elm4.attr('id3'=>'cc')
60
- #elm9.attr('id3'=>'cc')
46
+ #elm2.attr(id3: 'cc')
61
47
 
62
- #co_ps = elm1.element()
63
- #map = co_ps.attr_map
48
+ #elm3['id3'] = 'cc' #elm3.attr(id3: 'cc')
49
+ #elm3['id3'] = 'cc' #elm4.attr(id3: 'cc')
50
+ #elm9['id3'] = 'cc' #elm9.attr(id3: 'cc')
51
+
52
+ #co_elm = elm1.element()
53
+ #map = co_elm.attr_map
64
54
  #map.names.each { |item|
65
55
  # puts item
66
56
  # puts map.fetch(item)
@@ -73,7 +63,7 @@ elm5_ = elm_.element('tech')
73
63
  elm5 = elm5_.clone
74
64
  elm5['mono'] = i.to_s
75
65
  elm5.content = i.to_s
76
- elm_.flush
66
+ elm_.flash
77
67
  end
78
68
 
79
69
  #am3 = elm3.attr_map
@@ -85,29 +75,42 @@ end
85
75
  elm_ = root.element(elm7)
86
76
 
87
77
  10.times { |i|
88
- elm_["momo"]= i.to_s
78
+ elm_["momo"]= i
89
79
  elm_["eco"] = "えま"
90
- elm_.content = i.to_s
91
- #elm_["content"] = i.to_s
92
- elm_.flush
80
+ elm_.content = i #elm_["content"] = i.to_s
81
+ elm_.flash
93
82
  }
94
83
 
95
- #co_ps = root.element(elm_c1)
84
+ #co_elm = root.element(elm_c1)
96
85
  #
97
86
  #10.times { |i|
98
- # #co_ps.content(i.to_s)
99
- # co_ps[":content"]=i.to_s
100
- # co_ps.flush
87
+ # co_elm.content = i #co_elm.content(i)
88
+ # co_elm.flash
101
89
  #}
102
90
 
103
- root.flush
91
+ #elm3['id3'] = 'dd' #elm3.attr(id3: 'dd')
104
92
 
105
- #elm3.attr('id3'=>'dd')
93
+ root.flash
106
94
 
107
95
  end_time = Time.new.to_f
108
96
 
109
97
  puts root.document
110
98
 
99
+ #elms = root.elements("potato2")
100
+ ##elms = root.elements("kobe")
101
+ #elms = root.elements("potato")
102
+
103
+ elms = root.elements("test") #elms = root.css('test')
104
+ elms.each{|elm, i|
105
+ puts '-------'
106
+ puts 'doc----'
107
+ puts elm.document
108
+ puts 'attrs--'
109
+ puts elm.attributes
110
+ puts 'mixed--'
111
+ puts elm.mixed_content
112
+ }
113
+
111
114
  puts '' + (end_time - start_time).to_s + ' sec'
112
115
 
113
116
  #start_time = Time.new.to_f
@@ -29,7 +29,7 @@
29
29
  <mink>komaneti</mink>
30
30
 
31
31
  <potato id="aa" lc="/cc">
32
- <potato id="/bb"><test></test></potato>
32
+ <potato id="/bb"></potato>
33
33
  </potato>
34
34
 
35
35
  <potato id="aa" id2="bb" lc="/cc">
File without changes
File without changes
@@ -1,7 +1,7 @@
1
1
  # -* coding: UTF-8 -*-
2
2
  # Meteor - A lightweight (X)HTML(5) & XML parser
3
3
  #
4
- # Copyright (C) 2008-2014 Yasumasa Ashida.
4
+ # Copyright (C) 2008-2021 Yasumasa Ashida.
5
5
  #
6
6
  # This program is free software; you can redistribute it and/or modify
7
7
  # it under the terms of the GNU Lesser General Public License as published by
@@ -18,12 +18,12 @@
18
18
  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
19
  #
20
20
  # @author Yasumasa Ashida
21
- # @version 0.9.8.1
21
+ # @version 0.9.9.0
22
22
  #
23
23
 
24
24
  module Meteor
25
25
 
26
- VERSION = '0.9.8.1'.freeze
26
+ VERSION = '0.9.9.0'.freeze
27
27
 
28
28
  #require 'fileutils'
29
29
 
@@ -37,10 +37,11 @@ module Meteor
37
37
  SEVEN = 7
38
38
 
39
39
  HTML = ZERO
40
- XHTML = ONE
41
- HTML5 = TWO
42
- XHTML5 = THREE
43
- XML = FOUR
40
+ HTML5 = ONE
41
+ XHTML5 = TWO
42
+ HTML4 = THREE
43
+ XHTML4 = FOUR
44
+ XML = FIVE
44
45
 
45
46
  #
46
47
  # Element Class (要素クラス)
@@ -78,7 +79,7 @@ module Meteor
78
79
  #
79
80
  class Element
80
81
 
81
- attr_accessor :tag
82
+ attr_accessor :name
82
83
  attr_accessor :attributes
83
84
  attr_accessor :mixed_content
84
85
  attr_accessor :raw_content
@@ -94,13 +95,13 @@ module Meteor
94
95
  attr_accessor :copy
95
96
  attr_accessor :removed
96
97
 
97
- alias :name :tag
98
- alias :name= :tag=
98
+ alias :tag :name
99
+ alias :tag= :name=
99
100
 
100
101
  #
101
102
  # initializer (イニシャライザ)
102
- # @overload initialize(tag)
103
- # @param [String] tag tag name (タグ名)
103
+ # @overload initialize(name)
104
+ # @param [String,Symbol] name tag name (タグ名)
104
105
  # @overload initialize(elm)
105
106
  # @param [Meteor::Element] elm element (要素)
106
107
  # @overload initialize(elm,ps)
@@ -118,7 +119,7 @@ module Meteor
118
119
  raise ArgumentError
119
120
  end
120
121
  when TWO
121
- @tag = args[0].tag
122
+ @name = args[0].name
122
123
  @attributes = String.new(args[0].attributes)
123
124
  @mixed_content = String.new(args[0].mixed_content)
124
125
  #@pattern = String.new(args[0].pattern)
@@ -139,10 +140,10 @@ module Meteor
139
140
 
140
141
  #
141
142
  # initializer (イニシャライザ)
142
- # @param [String] tag tag name (タグ名)
143
+ # @param [String] name tag name (タグ名)
143
144
  #
144
- def initialize_s(tag)
145
- @tag = tag
145
+ def initialize_s(name)
146
+ @name = name
146
147
  #@attributes = nil
147
148
  #@mixed_content = nil
148
149
  #@pattern = nil
@@ -162,7 +163,7 @@ module Meteor
162
163
  # @param [Meteor::Element] elm element (要素)
163
164
  #
164
165
  def initialize_e(elm)
165
- @tag = elm.tag
166
+ @name = elm.name
166
167
  @attributes = String.new(elm.attributes)
167
168
  #@pattern = String.new(elm.pattern)
168
169
  @pattern = elm.pattern
@@ -241,29 +242,29 @@ module Meteor
241
242
  if @document_sync
242
243
  @document_sync = false
243
244
  case @parser.doc_type
244
- when Parser::HTML, Parser::HTML5
245
+ when Parser::HTML, Parser::HTML5, Parser::HTML4
245
246
  if @cx
246
- #@pattern_cc = '' << SET_CX_1 << elm.tag << SPACE << elm.attributes << SET_CX_2 << elm.mixed_content << SET_CX_3 << elm.tag << SET_CX_4
247
- @document = "<!-- @#{@tag} #{@attributes} -->#{@mixed_content}<!-- /@#{@tag} -->"
247
+ #@pattern_cc = '' << SET_CX_1 << elm.name << SPACE << elm.attributes << SET_CX_2 << elm.mixed_content << SET_CX_3 << elm.name << SET_CX_4
248
+ @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
248
249
  else
249
250
  if @empty
250
- #@pattern_cc = '' << TAG_OPEN << elm.tag << elm.attributes << TAG_CLOSE << elm.mixed_content << TAG_OPEN3 << elm.tag << TAG_CLOSE
251
- @document = "<#{@tag}#{@attributes}>#{@mixed_content}</#{@tag}>"
251
+ #@pattern_cc = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE << elm.mixed_content << TAG_OPEN3 << elm.name << TAG_CLOSE
252
+ @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
252
253
  else
253
- @document = '' << Meteor::Core::Kernel::TAG_OPEN << @tag << @attributes << Meteor::Core::Kernel::TAG_CLOSE
254
+ @document = '' << Meteor::Core::Kernel::TAG_OPEN << @name << @attributes << Meteor::Core::Kernel::TAG_CLOSE
254
255
  #@document = "<#{@name}#{@attributes}>"
255
256
  end
256
257
  end
257
- when Parser::XHTML, Parser::XHTML5, Parser::XML
258
+ when Parser::XHTML4, Parser::XHTML5, Parser::XML
258
259
  if @cx
259
- #@pattern_cc = '' << SET_CX_1 << elm.tag << SPACE << elm.attributes << SET_CX_2 << elm.mixed_content << SET_CX_3 << elm.tag << SET_CX_4
260
- @document = "<!-- @#{@tag} #{@attributes} -->#{@mixed_content}<!-- /@#{@tag} -->"
260
+ #@pattern_cc = '' << SET_CX_1 << elm.name << SPACE << elm.attributes << SET_CX_2 << elm.mixed_content << SET_CX_3 << elm.name << SET_CX_4
261
+ @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
261
262
  else
262
263
  if @empty
263
- #@pattern_cc = '' << TAG_OPEN << elm.tag << elm.attributes << TAG_CLOSE << elm.mixed_content << TAG_OPEN3 << elm.tag << TAG_CLOSE
264
- @document = "<#{@tag}#{@attributes}>#{@mixed_content}</#{@tag}>"
264
+ #@pattern_cc = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE << elm.mixed_content << TAG_OPEN3 << elm.name << TAG_CLOSE
265
+ @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
265
266
  else
266
- @document = '' << Meteor::Core::Kernel::TAG_OPEN << @tag << @attributes << Meteor::Core::Kernel::TAG_CLOSE3
267
+ @document = '' << Meteor::Core::Kernel::TAG_OPEN << @name << @attributes << Meteor::Core::Kernel::TAG_CLOSE3
267
268
  #@document = "<#{@name}#{@attributes}/>"
268
269
  end
269
270
  end
@@ -278,43 +279,43 @@ module Meteor
278
279
  # @overload element()
279
280
  # get element (要素を取得する)
280
281
  # @return [Meteor::Element] element (要素)
281
- # @overload element(tag)
282
+ # @overload element(name)
282
283
  # get element using tag name (要素のタグ名で要素を取得する)
283
- # @param [String] tag tag name (タグ名)
284
+ # @param [String,Symbol] name tag name (タグ名)
284
285
  # @return [Meteor::Element] element (要素)
285
- # @overload element(tag,attrs)
286
+ # @overload element(name,attrs)
286
287
  # get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
287
- # @param [String] tag tag name (タグ名)
288
- # @param [Hash<String,String>] attrs attribute map (属性マップ)
288
+ # @param [String,Symbol] name tag name (タグ名)
289
+ # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
289
290
  # @return [Meteor::Element] element (要素)
290
291
  # @overload element(attrs)
291
292
  # get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
292
- # @param [Hash<String,String>] attrs attribute map (属性マップ)
293
+ # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
293
294
  # @return [Meteor::Element] element(要素)
294
- # @overload element(tag,attr_name,attr_value)
295
+ # @overload element(name,attr_name,attr_value)
295
296
  # get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
296
- # @param [String] tag tag name (タグ名)
297
- # @param [String] attr_name attribute name (属性名)
297
+ # @param [String,Symbol] name tag name (タグ名)
298
+ # @param [String,Symbol] attr_name attribute name (属性名)
298
299
  # @param [String] attr_value attribute value (属性値)
299
300
  # @return [Meteor::Element] element (要素)
300
301
  # @overload element(attr_name,attr_value)
301
302
  # get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
302
- # @param [String] attr_name 属性名
303
+ # @param [String,Symbol] attr_name 属性名
303
304
  # @param [String] attr_value 属性値
304
305
  # @return [Meteor::Element] element (要素)
305
- # @overload element(tag,attr_name1,attr_value1,attr_name2,attr_value2)
306
+ # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
306
307
  # get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
307
- # @param [String] tag tag name (タグ名)
308
- # @param [String] attr_name1 attribute name1 (属性名1)
308
+ # @param [String,Symbol] name tag name (タグ名)
309
+ # @param [String,Symbol] attr_name1 attribute name1 (属性名1)
309
310
  # @param [String] attr_value1 attribute value1 (属性値1)
310
- # @param [String] attr_name2 attribute name2 (属性名2)
311
+ # @param [String,Symbol] attr_name2 attribute name2 (属性名2)
311
312
  # @param [String] attr_value2 attribute value2 (属性値2)
312
313
  # @return [Meteor::Element] element (要素)
313
314
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
314
315
  # get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
315
- # @param [String] attr_name1 属性名1
316
+ # @param [String,Symbol] attr_name1 属性名1
316
317
  # @param [String] attr_value1 属性値1
317
- # @param [String] attr_name2 属性名2
318
+ # @param [String,Symbol] attr_name2 属性名2
318
319
  # @param [String] attr_value2 属性値2
319
320
  # @return [Meteor::Element] element(要素)
320
321
  # @overload element(elm)
@@ -336,43 +337,43 @@ module Meteor
336
337
 
337
338
  #
338
339
  # get elements (要素を取得する)
339
- # @overload elements(tag)
340
+ # @overload elements(name)
340
341
  # get elements using tag name (要素のタグ名で要素を取得する)
341
- # @param [String] tag tag name (タグ名)
342
+ # @param [String,Symbol] name tag name (タグ名)
342
343
  # @return [Array<Meteor::Element>] element array(要素配列)
343
- # @overload elements(tag,attrs)
344
+ # @overload elements(name,attrs)
344
345
  # get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
345
- # @param [String] tag tag name (タグ名)
346
- # @param [Hash<String,String>] attrs attribute map (属性マップ)
346
+ # @param [String,Symbol] name tag name (タグ名)
347
+ # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
347
348
  # @return [Array<Meteor::Element>] element array (要素配列)
348
349
  # @overload elements(attrs)
349
350
  # get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
350
- # @param [Hash<String,String>] attrs attribute map (属性マップ)
351
+ # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
351
352
  # @return [Array<Meteor::Element>] element array (要素配列)
352
- # @overload elements(tag,attr_name,attr_value)
353
+ # @overload elements(name,attr_name,attr_value)
353
354
  # get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
354
- # @param [String] tag tag name (タグ名)
355
- # @param [String] attr_name attribute name (属性名)
355
+ # @param [String,Symbol] name tag name (タグ名)
356
+ # @param [String,Symbol] attr_name attribute name (属性名)
356
357
  # @param [String] attr_value attribute value (属性値)
357
358
  # @return [Array<Meteor::Element>] element array (要素配列)
358
359
  # @overload elements(attr_name,attr_value)
359
360
  # get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
360
- # @param [String] attr_name attribute name (属性名)
361
+ # @param [String,Symbol] attr_name attribute name (属性名)
361
362
  # @param [String] attr_value attribute value (属性値)
362
363
  # @return [Array<Meteor::Element>] element array (要素配列)
363
- # @overload elements(tag,attr_name1,attr_value1,attr_name2,attr_value2)
364
+ # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
364
365
  # get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
365
- # @param [String] tag tag name (タグ名)
366
- # @param [String] attr_name1 attribute name1 (属性名1)
366
+ # @param [String,Symbol] name tag name (タグ名)
367
+ # @param [String,Symbol] attr_name1 attribute name1 (属性名1)
367
368
  # @param [String] attr_value1 attribute value1 (属性値1)
368
- # @param [String] attr_name2 attribute name2 (属性名2)
369
+ # @param [String,Symbol] attr_name2 attribute name2 (属性名2)
369
370
  # @param [String] attr_value2 attribute value2 (属性値2)
370
371
  # @return [Array<Meteor::Element>] element array (要素配列)
371
372
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
372
373
  # get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
373
- # @param [String] attr_name1 attribute name1 (属性名1)
374
+ # @param [String,Symbol] attr_name1 attribute name1 (属性名1)
374
375
  # @param [String] attr_value1 attribute value1 (属性値1)
375
- # @param [String] attr_name2 attribute name2 (属性名2)
376
+ # @param [String,Symbol] attr_name2 attribute name2 (属性名2)
376
377
  # @param [String] attr_value2 attribute value2 (属性値2)
377
378
  # @return [Array<Meteor::Element>] element array (要素配列)
378
379
  #
@@ -394,9 +395,9 @@ module Meteor
394
395
 
395
396
  #
396
397
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
397
- # @overload cxtag(tag,id)
398
+ # @overload cxtag(name,id)
398
399
  # get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
399
- # @param [String] tag tag name (タグ名)
400
+ # @param [String,Symbol] name tag name (タグ名)
400
401
  # @param [String] id id attribute value (ID属性値)
401
402
  # @return [Meteor::Element] element(要素)
402
403
  # @overload cxtag(id)
@@ -411,17 +412,17 @@ module Meteor
411
412
  #
412
413
  # @overload attr(attr)
413
414
  # set attribute of element (要素の属性をセットする)
414
- # @param [Hash<String,String>] attr attribute (属性)
415
+ # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
415
416
  # @return [Meteor::Element] element (要素)
416
417
  # @deprecated
417
418
  # @overload attr(attr_name,attr_value)
418
419
  # set attribute of element (要素の属性をセットする)
419
- # @param [String] attr_name attribute name (属性名)
420
+ # @param [String,Symbol] attr_name attribute name (属性名)
420
421
  # @param [String,true,false] attr_value attribute value (属性値)
421
422
  # @return [Meteor::Element] element (要素)
422
423
  # @overload attr(attr_name)
423
424
  # get attribute value of element (要素の属性値を取得する)
424
- # @param [String] attr_name attribute name (属性名)
425
+ # @param [String,Symbol] attr_name attribute name (属性名)
425
426
  # @return [String] attribute value (属性値)
426
427
  #
427
428
  def attr(attrs,*args)
@@ -430,7 +431,7 @@ module Meteor
430
431
 
431
432
  #
432
433
  # set attribute of element (要素の属性をセットする)
433
- # @param [Hash] attr attribute (属性)
434
+ # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
434
435
  # @return [Meteor::Element] element (要素)
435
436
  #
436
437
  def attr=(attr)
@@ -439,7 +440,7 @@ module Meteor
439
440
 
440
441
  #
441
442
  # set attribute map (要素マップをセットする)
442
- # @param [Hash<String,String>] attrs attribute map (属性マップ)
443
+ # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
443
444
  # @return [Meteor::Element] element (要素)
444
445
  def attrs=(attrs)
445
446
  @parser.attrs(self,attrs)
@@ -447,7 +448,7 @@ module Meteor
447
448
 
448
449
  #
449
450
  # get attribute map (属性マップを取得する)
450
- # @return [Hash<String,String>] attribute map (属性マップ)
451
+ # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
451
452
  #
452
453
  def attrs
453
454
  @parser.attrs(self)
@@ -496,6 +497,8 @@ module Meteor
496
497
  @parser.content(self, *args)
497
498
  end
498
499
 
500
+ alias :text :content
501
+
499
502
  #
500
503
  # set content of element (要素の内容をセットする)
501
504
  # @param [String] value content (要素の内容)
@@ -505,19 +508,25 @@ module Meteor
505
508
  @parser.content(self, value)
506
509
  end
507
510
 
511
+ alias :text= :content=
512
+
508
513
  #
509
514
  # set attribute (属性をセットする)
510
- # @param [String] name attribute name (属性の名前)
515
+ # @param [String,Symbol] name attribute name (属性の名前)
511
516
  # @param [String] value attribute value (属性の値)
512
517
  # @return [Meteor::Element] element (要素)
513
518
  #
514
519
  def []=(name, value)
515
- @parser.attr(self, name, value)
520
+ if value != nil
521
+ @parser.attr(self, name, value)
522
+ else
523
+ @parser.remove_attr(self, name)
524
+ end
516
525
  end
517
526
 
518
527
  #
519
528
  # get attribute value (属性の値を取得する)
520
- # @param [String] name attribute name (属性の名前)
529
+ # @param [String,Symbol] name attribute name (属性の名前)
521
530
  # @return [String] attribute value (属性の値)
522
531
  #
523
532
  def [](name)
@@ -526,7 +535,7 @@ module Meteor
526
535
 
527
536
  #
528
537
  # remove attribute of element (要素の属性を消す)
529
- # @param [String] attr_name attribute name (属性名)
538
+ # @param [String,Symbol] attr_name attribute name (属性名)
530
539
  # @return [Meteor::Element] element (要素)
531
540
  #
532
541
  def remove_attr(attr_name)
@@ -543,10 +552,12 @@ module Meteor
543
552
  #
544
553
  # reflect (反映する)
545
554
  #
546
- def flush
547
- @parser.flush
555
+ def flash
556
+ @parser.flash
548
557
  end
549
558
 
559
+ alias :flush :flash
560
+
550
561
  #
551
562
  # @overload execute(hook)
552
563
  # run action of Hooker (Hookerクラスの処理を実行する)
@@ -632,7 +643,7 @@ module Meteor
632
643
 
633
644
  #
634
645
  # set a couple of attribute name and attribute value (属性名と属性値を対としてセットする)
635
- # @param [String] name attribute name (属性名)
646
+ # @param [String,Symbol] name attribute name (属性名)
636
647
  # @param [String] value attribute value (属性値)
637
648
  #
638
649
  def store(name, value)
@@ -666,7 +677,7 @@ module Meteor
666
677
 
667
678
  #
668
679
  # get attribute value using attribute name (属性名で属性値を取得する)
669
- # @param [String] name attribute name (属性名)
680
+ # @param [String,Symbol] name attribute name (属性名)
670
681
  # @return [String] attribute value (属性値)
671
682
  #
672
683
  def fetch(name)
@@ -712,7 +723,7 @@ module Meteor
712
723
  #
713
724
  # set a couple of attribute name and attribute value (属性名と属性値を対としてセットする)
714
725
  #
715
- # @param [String] name attribute name (属性名)
726
+ # @param [String,Symbol] name attribute name (属性名)
716
727
  # @param [String] value attribute value (属性値)
717
728
  #
718
729
  def []=(name, value)
@@ -722,7 +733,7 @@ module Meteor
722
733
  #
723
734
  # get attribute value using attribute name (属性名で属性値を取得する)
724
735
  #
725
- # @param [String] name attribute name (属性名)
736
+ # @param [String,Symbol] name attribute name (属性名)
726
737
  # @return [String] attribute value (属性値)
727
738
  #
728
739
  def [](name)
@@ -734,7 +745,7 @@ module Meteor
734
745
  # Attribute class (属性クラス)
735
746
  #
736
747
  # @!attribute [rw] name
737
- # @return [String] attribute name (名前)
748
+ # @return [String,Symbol] attribute name (名前)
738
749
  # @!attribute [rw] value
739
750
  # @return [String] attribute value (値)
740
751
  # @!attribute [rw] changed
@@ -766,10 +777,11 @@ module Meteor
766
777
  #
767
778
  class Parser
768
779
  HTML = ZERO
769
- XHTML = ONE
770
- HTML5 = TWO
771
- XHTML5 = THREE
772
- XML = FOUR
780
+ HTML5 = ONE
781
+ XHTML5 = TWO
782
+ HTML4 = THREE
783
+ XHTML4 = FOUR
784
+ XML = FIVE
773
785
  end
774
786
 
775
787
  #
@@ -917,41 +929,41 @@ module Meteor
917
929
  end
918
930
 
919
931
  #
920
- #@overload bind(relative_path,enc)
932
+ #@overload link(relative_path,enc)
921
933
  # generate parser (パーサを作成する)
922
934
  # @param [String] relative_path relative file path (相対ファイルパス)
923
935
  # @param [String] enc character encoding (文字エンコーディング)
924
936
  # @return [Meteor::Parser] parser (パーサ)
925
- #@overload bind(relative_path)
937
+ #@overload link(relative_path)
926
938
  # generate parser (パーサを作成する)
927
939
  # @param [String] relative_path relative file path (相対ファイルパス)
928
940
  # @return [Meteor::Parser] parser (パーサ)
929
- #@overload bind(type,relative_path,enc)
941
+ #@overload link(type,relative_path,enc)
930
942
  # generate parser (パーサを作成する)
931
943
  # @param [Fixnum,Symbol] type type of parser (パーサ・タイプ)
932
944
  # @param [String] relative_path relative file path (相対ファイルパス)
933
945
  # @param [String] enc character encoding (文字エンコーディング)
934
946
  # @return [Meteor::Parser] parser (パーサ)
935
- #@overload bind(type,relative_path)
947
+ #@overload link(type,relative_path)
936
948
  # generate parser (パーサを作成する)
937
949
  # @param [Fixnum,Symbol] type type of parser (パーサ・タイプ)
938
950
  # @param [String] relative_path relative file path (相対ファイルパス)
939
951
  # @return [Meteor::Parser] parser (パーサ)
940
952
  #
941
- def bind(*args)
953
+ def link(*args)
942
954
  case args.length
943
955
  when 1
944
- bind_1(args[0])
956
+ link_1(args[0])
945
957
  when 2
946
958
  if args[0].kind_of?(Fixnum) || args[0].kind_of?(Symbol)
947
- bind_2_n(args[0], args[1])
959
+ link_2_n(args[0], args[1])
948
960
  elsif args[0].kind_of?(String)
949
- bind_2_s(args[0], args[1])
961
+ link_2_s(args[0], args[1])
950
962
  else
951
963
  raise ArgumentError
952
964
  end
953
965
  when 3
954
- bind_3(args[0], args[1], args[2])
966
+ link_3(args[0], args[1], args[2])
955
967
  else
956
968
  raise ArgumentError
957
969
  end
@@ -971,10 +983,10 @@ module Meteor
971
983
  if CURRENT_DIR.eql?(paths[0])
972
984
  paths.delete_at 0
973
985
  paths[paths.length - 1] = File.basename(paths[paths.length - 1], ABST_EXT_NAME)
974
- return paths.join(SLASH)
986
+ return '' << SLASH << paths.join(SLASH)
975
987
  else
976
988
  paths[paths.length - 1] = File.basename(paths[paths.length - 1], ABST_EXT_NAME)
977
- return paths.join(SLASH)
989
+ return '' << SLASH << paths.join(SLASH)
978
990
  end
979
991
  end
980
992
  end
@@ -988,20 +1000,20 @@ module Meteor
988
1000
  # @param [String] enc character encoding (文字エンコーディング)
989
1001
  # @return [Meteor::Parser] parser(パーサ)
990
1002
  #
991
- def bind_3(type, relative_path, enc)
1003
+ def link_3(type, relative_path, enc)
992
1004
 
993
1005
  relative_url = path_to_url(relative_path)
994
1006
 
995
1007
  case type
996
- when Parser::HTML, :html
997
- html = Meteor::Ml::Html::ParserImpl.new
1008
+ when Parser::HTML4, :html4
1009
+ html4 = Meteor::Ml::Html4::ParserImpl.new
998
1010
  html.read(File.expand_path(relative_path, @root), enc)
999
- @cache[relative_url] = html
1000
- when Parser::XHTML
1001
- xhtml = Meteor::Ml::Xhtml::ParserImpl.new
1002
- xhtml.read(File.expand_path(relative_path, @root), enc)
1003
- @cache[relative_url] = xhtml
1004
- when Parser::HTML5, :html5
1011
+ @cache[relative_url] = html4
1012
+ when Parser::XHTML4, :xhtml4
1013
+ xhtml4 = Meteor::Ml::Xhtml4::ParserImpl.new
1014
+ xhtml4.read(File.expand_path(relative_path, @root), enc)
1015
+ @cache[relative_url] = xhtml4
1016
+ when Parser::HTML, :html, Parser::HTML5, :html5
1005
1017
  html5 = Meteor::Ml::Html5::ParserImpl.new
1006
1018
  html5.read(File.expand_path(relative_path, @root), enc)
1007
1019
  @cache[relative_url] = html5
@@ -1016,7 +1028,7 @@ module Meteor
1016
1028
  end
1017
1029
  end
1018
1030
 
1019
- private :bind_3
1031
+ private :link_3
1020
1032
 
1021
1033
  #
1022
1034
  # generate parser (パーサを作成する)
@@ -1024,16 +1036,16 @@ module Meteor
1024
1036
  # @param [String] relative_path relative file path (相対ファイルパス)
1025
1037
  # @return [Meteor::Parser] parser (パーサ)
1026
1038
  #
1027
- def bind_2_n(type, relative_path)
1039
+ def link_2_n(type, relative_path)
1028
1040
 
1029
1041
  relative_url = path_to_url(relative_path)
1030
1042
 
1031
1043
  case type
1032
- when Parser::HTML, :html
1033
- ps = Meteor::Ml::Html::ParserImpl.new
1044
+ when Parser::HTML4, :html4
1045
+ ps = Meteor::Ml::Html4::ParserImpl.new
1034
1046
  when Parser::XHTML, :xhtml
1035
- ps = Meteor::Ml::Xhtml::ParserImpl.new
1036
- when Parser::HTML5, :html5
1047
+ ps = Meteor::Ml::Xhtml4::ParserImpl.new
1048
+ when Parser::HTML, :html, Parser::HTML5, :html5
1037
1049
  ps = Meteor::Ml::Html5::ParserImpl.new
1038
1050
  when Parser::XHTML5, :xhtml5
1039
1051
  ps = Meteor::Ml::Xhtml5::ParserImpl.new
@@ -1046,7 +1058,7 @@ module Meteor
1046
1058
 
1047
1059
  end
1048
1060
 
1049
- private :bind_2_n
1061
+ private :link_2_n
1050
1062
 
1051
1063
  #
1052
1064
  # generate parser (パーサを作成する)
@@ -1054,16 +1066,16 @@ module Meteor
1054
1066
  # @param [String] enc character encoding (文字エンコーディング)
1055
1067
  # @return [Meteor::Parser] parser (パーサ)
1056
1068
  #
1057
- def bind_2_s(relative_path,enc)
1069
+ def link_2_s(relative_path,enc)
1058
1070
 
1059
1071
  relative_url = path_to_url(relative_path)
1060
1072
 
1061
1073
  case @type
1062
- when Parser::HTML, :html
1063
- ps = Meteor::Ml::Html::ParserImpl.new
1074
+ when Parser::HTML4, :html4
1075
+ ps = Meteor::Ml::Html4::ParserImpl.new
1064
1076
  when Parser::XHTML, :xhtml
1065
- ps = Meteor::Ml::Xhtml::ParserImpl.new
1066
- when Parser::HTML5, :html5
1077
+ ps = Meteor::Ml::Xhtml4::ParserImpl.new
1078
+ when Parser::HTML, :html, Parser::HTML5, :html5
1067
1079
  ps = Meteor::Ml::Html5::ParserImpl.new
1068
1080
  when Parser::XHTML5, :xhtml5
1069
1081
  ps = Meteor::Ml::Xhtml5::ParserImpl.new
@@ -1076,23 +1088,23 @@ module Meteor
1076
1088
 
1077
1089
  end
1078
1090
 
1079
- private :bind_2_s
1091
+ private :link_2_s
1080
1092
 
1081
1093
  #
1082
1094
  # generate parser (パーサを作成する)
1083
1095
  # @param [String] relative_path relative file path (相対ファイルパス)
1084
1096
  # @return [Meteor::Parser] parser (パーサ)
1085
1097
  #
1086
- def bind_1(relative_path)
1098
+ def link_1(relative_path)
1087
1099
 
1088
1100
  relative_url = path_to_url(relative_path)
1089
1101
 
1090
1102
  case @type
1091
- when Parser::HTML, :html
1092
- ps = Meteor::Ml::Html::ParserImpl.new
1103
+ when Parser::HTML4, :html4
1104
+ ps = Meteor::Ml::Html4::ParserImpl.new
1093
1105
  when Parser::XHTML, :xhtml
1094
- ps = Meteor::Ml::Xhtml::ParserImpl.new
1095
- when Parser::HTML5, :html5
1106
+ ps = Meteor::Ml::Xhtml4::ParserImpl.new
1107
+ when Parser::HTML, :html, Parser::HTML5, :html5
1096
1108
  ps = Meteor::Ml::Html5::ParserImpl.new
1097
1109
  when Parser::XHTML5, :xhtml5
1098
1110
  ps = Meteor::Ml::Xhtml5::ParserImpl.new
@@ -1107,12 +1119,12 @@ module Meteor
1107
1119
 
1108
1120
  end
1109
1121
 
1110
- private :bind_1
1122
+ private :link_1
1111
1123
 
1112
1124
  #
1113
1125
  #@overload parser(key)
1114
1126
  # get parser (パーサを取得する)
1115
- # @param [String] key identifier (キー)
1127
+ # @param [String,Symbol] key identifier (キー)
1116
1128
  # @return [Meteor::Parser] parser (パーサ)
1117
1129
  #@overload parser(type,relative_path,enc)
1118
1130
  # generate parser (パーサを作成する)
@@ -1132,7 +1144,7 @@ module Meteor
1132
1144
  when 1
1133
1145
  parser_1(args[0])
1134
1146
  when 2,3
1135
- bind(args)
1147
+ link(args)
1136
1148
  end
1137
1149
  #parser_1(key)
1138
1150
  end
@@ -1143,13 +1155,13 @@ module Meteor
1143
1155
  # @return [Meteor::Parser] parser (パーサ)
1144
1156
  #
1145
1157
  def parser_1(key)
1146
- @pif = @cache[key]
1158
+ @pif = @cache[key.to_s]
1147
1159
  case @pif.doc_type
1148
- when Meteor::Parser::HTML
1149
- Meteor::Ml::Html::ParserImpl.new(@pif)
1150
- when Meteor::Parser::XHTML
1151
- Meteor::Ml::Xhtml::ParserImpl.new(@pif)
1152
- when Meteor::Parser::HTML5
1160
+ when Meteor::Parser::HTML4
1161
+ Meteor::Ml::Html4::ParserImpl.new(@pif)
1162
+ when Meteor::Parser::XHTML4
1163
+ Meteor::Ml::Xhtml4::ParserImpl.new(@pif)
1164
+ when Meteor::Parser::HTML, Meteor::Parser::HTML5
1153
1165
  Meteor::Ml::Html5::ParserImpl.new(@pif)
1154
1166
  when Meteor::Parser::XHTML5
1155
1167
  Meteor::Ml::Xhtml5::ParserImpl.new(@pif)
@@ -1162,7 +1174,7 @@ module Meteor
1162
1174
 
1163
1175
  #
1164
1176
  # get root element (ルート要素を取得する)
1165
- # @param [String] key identifier (キー)
1177
+ # @param [String,Symbol] key identifier (キー)
1166
1178
  # @return [Meteor::RootElement] root element (ルート要素)
1167
1179
  #
1168
1180
  def element(key)
@@ -1170,24 +1182,24 @@ module Meteor
1170
1182
  end
1171
1183
 
1172
1184
  #
1173
- # @overload bind_str(type, relative_url, doc)
1185
+ # @overload link_str(type, relative_url, doc)
1174
1186
  # generate parser (パーサを作成する)
1175
1187
  # @param [Fixnum] type type of parser (パーサ・タイプ)
1176
1188
  # @param [String] relative_url relative URL (相対URL)
1177
1189
  # @param [String] doc document (ドキュメント)
1178
1190
  # @return [Meteor::Parser] parser (パーサ)
1179
- # @overload bind_str(relative_url, doc)
1191
+ # @overload link_str(relative_url, doc)
1180
1192
  # generate parser (パーサを作成する)
1181
1193
  # @param [String] relative_url relative URL (相対URL)
1182
1194
  # @param [String] doc document (ドキュメント)
1183
1195
  # @return [Meteor::Parser] parser (パーサ)
1184
1196
  #
1185
- def bind_str(*args)
1197
+ def link_str(*args)
1186
1198
  case args.length
1187
1199
  when 2
1188
- bind_str_2(args[0],args[1])
1200
+ link_str_2(args[0],args[1])
1189
1201
  when 3
1190
- bind_str_3(args[0],args[1],args[2])
1202
+ link_str_3(args[0],args[1],args[2])
1191
1203
  else
1192
1204
  raise ArgumentError
1193
1205
  end
@@ -1200,13 +1212,13 @@ module Meteor
1200
1212
  # @param [String] doc document (ドキュメント)
1201
1213
  # @return [Meteor::Parser] parser (パーサ)
1202
1214
  #
1203
- def bind_str_3(type, relative_url, doc)
1215
+ def link_str_3(type, relative_url, doc)
1204
1216
  case type
1205
- when Parser::HTML, :html
1206
- ps = Meteor::Ml::Html::ParserImpl.new
1217
+ when Parser::HTML4, :html
1218
+ ps = Meteor::Ml::Html4::ParserImpl.new
1207
1219
  when Parser::XHTML, :xhtml
1208
- ps = Meteor::Ml::Xhtml::ParserImpl.new
1209
- when Parser::HTML5, :html5
1220
+ ps = Meteor::Ml::Xhtml4::ParserImpl.new
1221
+ when Parser::HTML, :html, Parser::HTML5, :html5
1210
1222
  ps = Meteor::Ml::Html5::ParserImpl.new
1211
1223
  when Parser::XHTML5, :xhtml5
1212
1224
  ps = Meteor::Ml::Xhtml5::ParserImpl.new
@@ -1219,7 +1231,7 @@ module Meteor
1219
1231
  @cache[relative_url] = ps
1220
1232
  end
1221
1233
 
1222
- private :bind_str_3
1234
+ private :link_str_3
1223
1235
 
1224
1236
  #
1225
1237
  # generate parser (パーサを作成する)
@@ -1227,13 +1239,13 @@ module Meteor
1227
1239
  # @param [String] doc document (ドキュメント)
1228
1240
  # @return [Meteor::Parser] parser (パーサ)
1229
1241
  #
1230
- def bind_str_2(relative_url, doc)
1242
+ def link_str_2(relative_url, doc)
1231
1243
  case @type
1232
- when Parser::HTML, :html
1233
- ps = Meteor::Ml::Html::ParserImpl.new
1244
+ when Parser::HTML4, :html4
1245
+ ps = Meteor::Ml::Html4::ParserImpl.new
1234
1246
  when Parser::XHTML, :xhtml
1235
- ps = Meteor::Ml::Xhtml::ParserImpl.new
1236
- when Parser::HTML5, :html5
1247
+ ps = Meteor::Ml::Xhtml4::ParserImpl.new
1248
+ when Parser::HTML, :html, Parser::HTML5, :html5
1237
1249
  ps = Meteor::Ml::Html5::ParserImpl.new
1238
1250
  when Parser::XHTML5, :xhtml5
1239
1251
  ps = Meteor::Ml::Xhtml5::ParserImpl.new
@@ -1247,13 +1259,13 @@ module Meteor
1247
1259
 
1248
1260
  end
1249
1261
 
1250
- private :bind_str_2
1262
+ private :link_str_2
1251
1263
 
1252
- alias :paraser_str :bind_str
1264
+ alias :paraser_str :link_str
1253
1265
 
1254
1266
  #
1255
1267
  # set parser (パーサをセットする)
1256
- # @param [String] key identifier (キー)
1268
+ # @param [String,Symbol] key identifier (キー)
1257
1269
  # @param [Meteor::Parser] ps parser (パーサ)
1258
1270
  #
1259
1271
  def []=(key, ps)
@@ -1262,7 +1274,7 @@ module Meteor
1262
1274
 
1263
1275
  #
1264
1276
  # get parser (パーサを取得する)
1265
- # @param [String] key identifier (キー)
1277
+ # @param [String,Symbol] key identifier (キー)
1266
1278
  # @return [Meteor::Parser] parser (パーサ)
1267
1279
  #
1268
1280
  def [](key)
@@ -1281,51 +1293,54 @@ module Meteor
1281
1293
  #
1282
1294
  # set options (オプションをセットする)
1283
1295
  # @param [Hash] opts option (オプション)
1284
- # @option opts [String] :base_dir base directory (基準ディレクトリ)
1285
- # @option opts [String] :base_enc default character encoding (デフォルト文字エンコーディング)
1286
- # @option opts [FixNum] :base_type default type of parser (デフォルトのパーサ・タイプ)
1296
+ # @option opts [String] :root root directory (基準ディレクトリ)
1297
+ # @option @deprecated opts [String] :base_dir root directory (基準ディレクトリ)
1298
+ # @option opts [String] :enc default character encoding (デフォルト文字エンコーディング)
1299
+ # @option @deprecated opts [String] :base_enc default character encoding (デフォルト文字エンコーディング)
1300
+ # @option opts [FixNum,Symbol] :type default type of parser (デフォルトのパーサ・タイプ)
1301
+ # @option @deprecated opts [FixNum | Symbol] :base_type default type of parser (デフォルトのパーサ・タイプ)
1287
1302
  #
1288
1303
  def self.options=(opts)
1289
1304
  @@pf.options = opts
1290
1305
  end
1291
1306
 
1292
1307
  #
1293
- #@overload bind(type,relative_path,enc)
1308
+ #@overload link(type,relative_path,enc)
1294
1309
  # generate parser (パーサを作成する)
1295
1310
  # @param [Fixnum] type type of parser (パーサ・タイプ)
1296
1311
  # @param [String] relative_path relative file path (相対ファイルパス)
1297
1312
  # @param [String] enc character encoding (エンコーディング)
1298
1313
  # @return [Meteor::Parser] parser (パーサ)
1299
- #@overload bind(type,relative_path)
1314
+ #@overload link(type,relative_path)
1300
1315
  # generate parser (パーサを作成する)
1301
1316
  # @param [Fixnum] type type of parser (パーサ・タイプ)
1302
1317
  # @param [String] relative_path relative file path (相対ファイルパス)
1303
1318
  # @return [Meteor::Parser] parser (パーサ)
1304
1319
  #
1305
- def self.bind(*args)
1306
- @@pf.bind(*args)
1320
+ def self.link(*args)
1321
+ @@pf.link(*args)
1307
1322
  end
1308
1323
 
1309
1324
  #
1310
- # @overload bind_str(type, relative_url, doc)
1325
+ # @overload link_str(type, relative_url, doc)
1311
1326
  # generate parser (パーサを作成する)
1312
1327
  # @param [Fixnum] type type of parser (パーサ・タイプ)
1313
1328
  # @param [String] relative_url relative URL (相対URL)
1314
1329
  # @param [String] doc document (ドキュメント)
1315
1330
  # @return [Meteor::Parser] parser (パーサ)
1316
- # @overload bind_str(relative_url, doc)
1331
+ # @overload link_str(relative_url, doc)
1317
1332
  # generate parser (パーサを作成する)
1318
1333
  # @param [String] relative_url relative URL (相対URL)
1319
1334
  # @param [String] doc document (ドキュメント)
1320
1335
  # @return [Meteor::Parser] parser (パーサ)
1321
1336
  #
1322
- def self.bind_str(*args)
1323
- @@pf.bind_str(args)
1337
+ def self.link_str(*args)
1338
+ @@pf.link_str(args)
1324
1339
  end
1325
1340
 
1326
1341
  #
1327
1342
  # get root element (ルート要素を取得する)
1328
- # @param [String] key identifier (キー)
1343
+ # @param [String,Symbol] key identifier (キー)
1329
1344
  # @return [Meteor::RootElement] root element (ルート要素)
1330
1345
  #
1331
1346
  def self.element(key)
@@ -1348,25 +1363,25 @@ module Meteor
1348
1363
 
1349
1364
  #
1350
1365
  # initializer (イニシャライザ)
1351
- # @overload initialize(tag)
1352
- # @param [String] tag tag name (タグ名)
1366
+ # @overload initialize(name)
1367
+ # @param [String,Symbol] name tag name (タグ名)
1353
1368
  # @overload initialize(attr_name,attr_value)
1354
- # @param [String] attr_name attribute name (属性名)
1369
+ # @param [String,Symbol] attr_name attribute name (属性名)
1355
1370
  # @param [String] attr_value attribute value (属性値)
1356
- # @overload initialize(tag,attr_name,attr_value)
1357
- # @param [String] tag tag name (タグ名)
1358
- # @param [String] attr_name attribute name (属性名)
1371
+ # @overload initialize(name,attr_name,attr_value)
1372
+ # @param [String,Symbol] name tag name (タグ名)
1373
+ # @param [String,Symbol] attr_name attribute name (属性名)
1359
1374
  # @param [String] attr_value attribute value (属性値)
1360
1375
  # @overload initialize(attr_name1,attr_value1,attr_name2,attr_value2)
1361
- # @param [String] attr_name1 attribute name1 (属性名1)
1376
+ # @param [String,Symbol] attr_name1 attribute name1 (属性名1)
1362
1377
  # @param [String] attr_value1 attribute value1 (属性値1)
1363
- # @param [String] attr_name2 attribute name2 (属性名2)
1378
+ # @param [String,Symbol] attr_name2 attribute name2 (属性名2)
1364
1379
  # @param [String] attr_value2 attribute value2 (属性値2)
1365
- # @overload initialize(tag,attr_name1,attr_value1,attr_name2,attr_value2)
1366
- # @param [String] tag tag name (タグ名)
1367
- # @param [String] attr_name1 attribute name1 (属性名1)
1380
+ # @overload initialize(name,attr_name1,attr_value1,attr_name2,attr_value2)
1381
+ # @param [String,Symbol] name tag name (タグ名)
1382
+ # @param [String,Symbol] attr_name1 attribute name1 (属性名1)
1368
1383
  # @param [String] attr_value1 attribute value1 (属性値1)
1369
- # @param [String] attr_name2 attribute name2 (属性名2)
1384
+ # @param [String,Symbol] attr_name2 attribute name2 (属性名2)
1370
1385
  # @param [String] attr_value2 attribute value2 (属性値2)
1371
1386
  #
1372
1387
  def initialize(*args)
@@ -1384,8 +1399,8 @@ module Meteor
1384
1399
  end
1385
1400
  end
1386
1401
 
1387
- def initialize_1(tag)
1388
- self.message="element not found : #{tag}"
1402
+ def initialize_1(name)
1403
+ self.message="element not found : #{name}"
1389
1404
  end
1390
1405
 
1391
1406
  private :initialize_1
@@ -1396,8 +1411,8 @@ module Meteor
1396
1411
 
1397
1412
  private :initialize_2
1398
1413
 
1399
- def initialize_3(tag, attr_name, attr_value)
1400
- self.message="element not found : #{tag}[#{attr_name}=#{attr_value}]"
1414
+ def initialize_3(name, attr_name, attr_value)
1415
+ self.message="element not found : #{name}[#{attr_name}=#{attr_value}]"
1401
1416
  end
1402
1417
 
1403
1418
  private :initialize_3
@@ -1408,8 +1423,8 @@ module Meteor
1408
1423
 
1409
1424
  private :initialize_4
1410
1425
 
1411
- def initialize_5(tag, attr_name1, attr_value1, attr_name2, attr_value2)
1412
- self.message="element not found : #{tag}[#{attr_name1}=#{attr_value1}][#{attr_name2}=#{attr_value2}]"
1426
+ def initialize_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
1427
+ self.message="element not found : #{name}[#{attr_name1}=#{attr_value1}][#{attr_name2}=#{attr_value2}]"
1413
1428
  end
1414
1429
 
1415
1430
  private :initialize_5
@@ -1738,6 +1753,8 @@ module Meteor
1738
1753
  @element_cache = Hash.new
1739
1754
  #フックドキュメント
1740
1755
  @document_hook = ''
1756
+
1757
+ @error_check = true
1741
1758
  end
1742
1759
 
1743
1760
  #
@@ -1777,43 +1794,43 @@ module Meteor
1777
1794
 
1778
1795
  #
1779
1796
  # get element (要素を取得する)
1780
- # @overload element(tag)
1797
+ # @overload element(name)
1781
1798
  # get element using tag name (要素のタグ名で要素を取得する)
1782
- # @param [String] tag tag name (タグ名)
1799
+ # @param [String,Symbol] name tag name (タグ名)
1783
1800
  # @return [Meteor::Element] element(要素)
1784
- # @overload element(tag,attrs)
1801
+ # @overload element(name,attrs)
1785
1802
  # get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
1786
- # @param [String] tag tag name (タグ名)
1787
- # @param [Hash<String,String>] attrs attribute map (属性マップ)
1803
+ # @param [String,Symbol] name tag name (タグ名)
1804
+ # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
1788
1805
  # @return [Meteor::Element] element (要素)
1789
1806
  # @overload element(attrs)
1790
1807
  # get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
1791
- # @param [Hash<String,String>] attrs attribute map (属性マップ)
1808
+ # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
1792
1809
  # @return [Meteor::Element] element (要素)
1793
- # @overload element(tag,attr_name,attr_value)
1810
+ # @overload element(name,attr_name,attr_value)
1794
1811
  # get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
1795
- # @param [String] tag tag name (タグ名)
1796
- # @param [String] attr_name attribute name (属性名)
1812
+ # @param [String,Symbol] name tag name (タグ名)
1813
+ # @param [String,Symbol] attr_name attribute name (属性名)
1797
1814
  # @param [String] attr_value attribute value (属性値)
1798
1815
  # @return [Meteor::Element] element (要素)
1799
1816
  # @overload element(attr_name,attr_value)
1800
1817
  # get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
1801
- # @param [String] attr_name attribute name (属性名)
1818
+ # @param [String,Symbol] attr_name attribute name (属性名)
1802
1819
  # @param [String] attr_value attribute value (属性値)
1803
1820
  # @return [Meteor::Element] element (要素)
1804
- # @overload element(tag,attr_name1,attr_value1,attr_name2,attr_value2)
1821
+ # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
1805
1822
  # get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
1806
- # @param [String] tag tag name (タグ名)
1807
- # @param [String] attr_name1 attribute name1 (属性名1)
1823
+ # @param [String,Symbol] name tag name (タグ名)
1824
+ # @param [String,Symbol] attr_name1 attribute name1 (属性名1)
1808
1825
  # @param [String] attr_value1 attribute value1 (属性値1)
1809
- # @param [String] attr_name2 attribute name2 (属性名2)
1826
+ # @param [String,Symbol] attr_name2 attribute name2 (属性名2)
1810
1827
  # @param [String] attr_value2 attribute value2 (属性値2)
1811
1828
  # @return [Meteor::Element] element (要素)
1812
1829
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
1813
1830
  # get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
1814
- # @param [String] attr_name1 attribute name1 (属性名1)
1831
+ # @param [String,Symbol] attr_name1 attribute name1 (属性名1)
1815
1832
  # @param [String] attr_value1 attribute value1 (属性値1)
1816
- # @param [String] attr_name2 attribute name2 (属性名2)
1833
+ # @param [String,Symbol] attr_name2 attribute name2 (属性名2)
1817
1834
  # @param [String] attr_value2 attribute value2 (属性値2)
1818
1835
  # @return [Meteor::Element] element (要素)
1819
1836
  # @overload element(elm)
@@ -1823,8 +1840,8 @@ module Meteor
1823
1840
  #
1824
1841
  def element(elm, attrs = nil,*args)
1825
1842
  if !attrs
1826
- if elm.kind_of?(String)
1827
- element_1(elm)
1843
+ if elm.kind_of?(String) || elm.kind_of?(Symbol)
1844
+ element_1(elm.to_s)
1828
1845
  if @elm_
1829
1846
  @element_cache.store(@elm_.object_id, @elm_)
1830
1847
  end
@@ -1832,12 +1849,12 @@ module Meteor
1832
1849
  shadow(elm)
1833
1850
  elsif elm.kind_of?(Hash)
1834
1851
  if elm.size == ONE
1835
- element_2(elm.keys[0], elm.values[0])
1852
+ element_2(elm.keys[0].to_s, elm.values[0])
1836
1853
  if @elm_
1837
1854
  @element_cache.store(@elm_.object_id, @elm_)
1838
1855
  end
1839
1856
  elsif elm.size == TWO
1840
- element_4(elm.keys[0], elm.values[0], elm.keys[1], elm.values[1])
1857
+ element_4(elm.keys[0].to_s, elm.values[0], elm.keys[1].to_s, elm.values[1])
1841
1858
  if @elm_
1842
1859
  @element_cache.store(@elm_.object_id, @elm_)
1843
1860
  end
@@ -1849,12 +1866,12 @@ module Meteor
1849
1866
  end
1850
1867
  elsif attrs.kind_of?(Hash)
1851
1868
  if attrs.size == ONE
1852
- element_3(elm, attrs.keys[0], attrs.values[0])
1869
+ element_3(elm.to_s, attrs.keys[0].to_s, attrs.values[0])
1853
1870
  if @elm_
1854
1871
  @element_cache.store(@elm_.object_id, @elm_)
1855
1872
  end
1856
1873
  elsif attrs.size == TWO
1857
- element_5(elm, attrs.keys[0], attrs.values[0], attrs.keys[1], attrs.values[1])
1874
+ element_5(elm.to_s, attrs.keys[0].to_s, attrs.values[0], attrs.keys[1].to_s, attrs.values[1])
1858
1875
  if @elm_
1859
1876
  @element_cache.store(@elm_.object_id, @elm_)
1860
1877
  end
@@ -1862,25 +1879,25 @@ module Meteor
1862
1879
  @elm_ = nil
1863
1880
  raise ArgumentError
1864
1881
  end
1865
- elsif attrs.kind_of?(String)
1882
+ elsif attrs.kind_of?(String) || attrs.kind_of?(Symbol)
1866
1883
  case args.length
1867
1884
  when ZERO
1868
- element_2(elm,attrs)
1885
+ element_2(elm.to_s,attrs.to_s)
1869
1886
  if @elm_
1870
1887
  @element_cache.store(@elm_.object_id, @elm_)
1871
1888
  end
1872
1889
  when ONE
1873
- element_3(elm, attrs, args[0])
1890
+ element_3(elm.to_s, attrs.to_s, args[0])
1874
1891
  if @elm_
1875
1892
  @element_cache.store(@elm_.object_id, @elm_)
1876
1893
  end
1877
1894
  when TWO
1878
- element_4(elm, attrs, args[0],args[1])
1895
+ element_4(elm.to_s, attrs.to_s, args[0].to_s,args[1])
1879
1896
  if @elm_
1880
1897
  @element_cache.store(@elm_.object_id, @elm_)
1881
1898
  end
1882
1899
  when THREE
1883
- element_5(elm, attrs, args[0],args[1],args[2])
1900
+ element_5(elm.to_s, attrs.to_s, args[0],args[1].to_s,args[2])
1884
1901
  if @elm_
1885
1902
  @element_cache.store(@elm_.object_id, @elm_)
1886
1903
  end
@@ -1896,15 +1913,15 @@ module Meteor
1896
1913
 
1897
1914
  #
1898
1915
  # get element using tag name (タグ名で検索し、要素を取得する)
1899
- # @param [String] tag tag name (タグ名)
1916
+ # @param [String,Symbol] name tag name (タグ名)
1900
1917
  # @return [Meteor::Element] element(要素)
1901
1918
  #
1902
- def element_1(tag)
1919
+ def element_1(name)
1903
1920
 
1904
- @_tag = Regexp.quote(tag)
1921
+ @_name = Regexp.quote(name)
1905
1922
 
1906
1923
  #要素検索用パターン
1907
- @pattern_cc = "<#{@_tag}(|\\s[^<>]*)\\/>|<#{@_tag}((?:|\\s[^<>]*))>(((?!(#{@_tag}[^<>]*>)).)*)<\\/#{@_tag}>"
1924
+ @pattern_cc = "<#{@_name}(|\\s[^<>]*)\\/>|<#{@_name}((?:|\\s[^<>]*))>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
1908
1925
 
1909
1926
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
1910
1927
  #内容あり要素検索
@@ -1912,9 +1929,10 @@ module Meteor
1912
1929
 
1913
1930
  if @res
1914
1931
  if @res[1]
1915
- element_without_1(tag)
1932
+ element_without_1(name)
1916
1933
  else
1917
- element_with_1(tag)
1934
+ #puts '---element_with_1'
1935
+ element_with_1(name)
1918
1936
  end
1919
1937
  #else
1920
1938
  end
@@ -1924,21 +1942,33 @@ module Meteor
1924
1942
 
1925
1943
  private :element_1
1926
1944
 
1927
- def element_with_1(tag)
1945
+ def element_with_1(name)
1928
1946
 
1929
- @elm_ = Meteor::Element.new(tag)
1930
- #属性
1931
- @elm_.attributes = @res[2]
1932
- #内容
1933
- @elm_.mixed_content = @res[3]
1934
- #全体
1935
- @elm_.document = @res[0]
1936
-
1937
- #@pattern_cc = '' << TAG_OPEN << @_tag << TAG_SEARCH_NC_1_1 << @_tag
1938
- #@pattern_cc << TAG_SEARCH_NC_1_2 << @_tag << TAG_CLOSE
1939
- @pattern_cc = "<#{@_tag}(?:|\\s[^<>]*)>((?!(#{@_tag}[^<>]*>)).)*<\\/#{@_tag}>"
1947
+ @elm_ = Meteor::Element.new(name)
1940
1948
 
1949
+ unless @on_search
1950
+ #puts '--on_search=false'
1951
+ #puts @res.to_a
1952
+ #属性
1953
+ @elm_.attributes = @res[2]
1954
+ #内容
1955
+ @elm_.mixed_content = @res[3]
1956
+ #全体
1957
+ @elm_.document = @res[0]
1958
+ else
1959
+ #puts '--on_search=true'
1960
+ #属性
1961
+ @elm_.attributes = @res[1]
1962
+ #内容
1963
+ @elm_.mixed_content = @res[2]
1964
+ #全体
1965
+ @elm_.document = @res[0]
1966
+ end
1941
1967
  #内容あり要素検索用パターン
1968
+ #@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_NC_1_1 << @_name
1969
+ #@pattern_cc << TAG_SEARCH_NC_1_2 << @_name << TAG_CLOSE
1970
+ @pattern_cc = "<#{@_name}(|\\s[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
1971
+
1942
1972
  @elm_.pattern = @pattern_cc
1943
1973
 
1944
1974
  @elm_.empty = true
@@ -1950,16 +1980,16 @@ module Meteor
1950
1980
 
1951
1981
  private :element_with_1
1952
1982
 
1953
- def element_without_1(tag)
1983
+ def element_without_1(name)
1954
1984
  #要素
1955
- @elm_ = Meteor::Element.new(tag)
1985
+ @elm_ = Meteor::Element.new(name)
1956
1986
  #属性
1957
1987
  @elm_.attributes = @res[1]
1958
1988
  #全体
1959
1989
  @elm_.document = @res[0]
1960
1990
  #空要素検索用パターン
1961
- @pattern_cc = '' << TAG_OPEN << @_tag << TAG_SEARCH_NC_1_3
1962
- #@pattern_cc = "<#{@_tag}(?:|\\s[^<>]*)\\/>"
1991
+ @pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_1_3
1992
+ #@pattern_cc = "<#{@_name}(|\\s[^<>]*)\\/>"
1963
1993
  @elm_.pattern = @pattern_cc
1964
1994
 
1965
1995
  @elm_.empty = false
@@ -1973,13 +2003,13 @@ module Meteor
1973
2003
 
1974
2004
  #
1975
2005
  # get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で検索し、要素を取得する)
1976
- # @param [String] tag tag name (タグ名)
2006
+ # @param [String] name tag name (タグ名)
1977
2007
  # @param [String] attr_name attribute name (属性名)
1978
2008
  # @param [String] attr_value attribute value (属性値)
1979
2009
  # @return [Meteor::Element] element (要素)
1980
- def element_3(tag, attr_name, attr_value)
2010
+ def element_3(name, attr_name, attr_value)
1981
2011
 
1982
- element_quote_3(tag,attr_name,attr_value)
2012
+ element_quote_3(name,attr_name,attr_value)
1983
2013
 
1984
2014
  @pattern_cc_1 = element_pattern_3
1985
2015
 
@@ -1999,29 +2029,31 @@ module Meteor
1999
2029
  @res = @res1
2000
2030
  #@pattern_cc = @pattern_cc_1
2001
2031
  if @res[1]
2002
- element_without_3(tag)
2032
+ element_without_3(name)
2003
2033
  else
2004
- element_with_3_1(tag)
2034
+ element_with_3_1(name)
2005
2035
  end
2006
2036
  elsif @res1.begin(0) > @res2.begin(0)
2007
2037
  @res = @res2
2008
2038
  #@pattern_cc = @pattern_cc_2
2009
- element_with_3_1(tag)
2039
+ element_with_3_1(name)
2010
2040
  end
2011
2041
  elsif @res1 && !@res2
2012
2042
  @res = @res1
2013
2043
  #@pattern_cc = @pattern_cc_1
2014
2044
  if @res[1]
2015
- element_without_3(tag)
2045
+ element_without_3(name)
2016
2046
  else
2017
- element_with_3_1(tag)
2047
+ element_with_3_1(name)
2018
2048
  end
2019
2049
  elsif @res2 && !@res1
2020
2050
  @res = @res2
2021
2051
  #@pattern_cc = @pattern_cc_2
2022
- element_with_3_1(tag)
2052
+ element_with_3_1(name)
2023
2053
  else
2024
- puts Meteor::Exception::NoSuchElementException.new(tag, attr_name, attr_value).message
2054
+ if @error_check
2055
+ puts Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message
2056
+ end
2025
2057
  @elm_ = nil
2026
2058
  end
2027
2059
 
@@ -2031,25 +2063,25 @@ module Meteor
2031
2063
  private :element_3
2032
2064
 
2033
2065
  def element_pattern_3
2034
-
2035
- "<#{@_tag}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)\\/>|<#{@_tag}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_tag}[^<>]*>)).)*)<\\/#{@_tag}>"
2066
+ "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)\\/>|<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
2036
2067
  end
2037
2068
 
2038
2069
  private :element_pattern_3
2039
2070
 
2040
- def element_quote_3(tag,attr_name,attr_value)
2041
- @_tag = Regexp.quote(tag)
2071
+ def element_quote_3(name,attr_name,attr_value)
2072
+ @_name = Regexp.quote(name)
2042
2073
  @_attr_name = Regexp.quote(attr_name)
2043
2074
  @_attr_value = Regexp.quote(attr_value)
2044
2075
  end
2045
2076
 
2046
2077
  private :element_quote_3
2047
2078
 
2048
- def element_with_3_1(tag)
2079
+ def element_with_3_1(name)
2080
+ #puts @res.captures.length
2049
2081
  case @res.captures.length
2050
2082
  when FOUR
2051
2083
  #要素
2052
- @elm_ = Meteor::Element.new(tag)
2084
+ @elm_ = Meteor::Element.new(name)
2053
2085
  #属性
2054
2086
  @elm_.attributes = @res[1]
2055
2087
  #内容
@@ -2057,10 +2089,10 @@ module Meteor
2057
2089
  #全体
2058
2090
  @elm_.document = @res[0]
2059
2091
  #内容あり要素検索用パターン
2060
- #@pattern_cc = ''<< TAG_OPEN << @_tag << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ
2061
- #@pattern_cc << @_attr_value << TAG_SEARCH_NC_2_2 << @_tag
2062
- #@pattern_cc << TAG_SEARCH_NC_1_2 << @_tag << TAG_CLOSE
2063
- @pattern_cc = "<#{@_tag}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_tag}[^<>]*>)).)*<\\/#{@_tag}>"
2092
+ #@pattern_cc = ''<< TAG_OPEN << @_name << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ
2093
+ #@pattern_cc << @_attr_value << TAG_SEARCH_NC_2_2 << @_name
2094
+ #@pattern_cc << TAG_SEARCH_NC_1_2 << @_name << TAG_CLOSE
2095
+ @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
2064
2096
 
2065
2097
  @elm_.pattern = @pattern_cc
2066
2098
 
@@ -2070,7 +2102,7 @@ module Meteor
2070
2102
 
2071
2103
  when FIVE
2072
2104
  #要素
2073
- @elm_ = Meteor::Element.new(tag)
2105
+ @elm_ = Meteor::Element.new(name)
2074
2106
  #属性
2075
2107
  @elm_.attributes = @res[2]
2076
2108
  #内容
@@ -2078,10 +2110,10 @@ module Meteor
2078
2110
  #全体
2079
2111
  @elm_.document = @res[0]
2080
2112
  #内容あり要素検索用パターン
2081
- #@pattern_cc = ''<< TAG_OPEN << @_tag << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ
2082
- #@pattern_cc << @_attr_value << TAG_SEARCH_NC_2_2 << @_tag
2083
- #@pattern_cc << TAG_SEARCH_NC_1_2 << @_tag << TAG_CLOSE
2084
- @pattern_cc = "<#{@_tag}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_tag}[^<>]*>)).)*<\\/#{@_tag}>"
2113
+ #@pattern_cc = ''<< TAG_OPEN << @_name << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ
2114
+ #@pattern_cc << @_attr_value << TAG_SEARCH_NC_2_2 << @_name
2115
+ #@pattern_cc << TAG_SEARCH_NC_1_2 << @_name << TAG_CLOSE
2116
+ @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>"
2085
2117
 
2086
2118
  @elm_.pattern = @pattern_cc
2087
2119
 
@@ -2091,11 +2123,18 @@ module Meteor
2091
2123
 
2092
2124
  when THREE,SIX
2093
2125
  #内容
2094
- @elm_ = Meteor::Element.new(tag)
2095
- #属性
2096
- @elm_.attributes = @res[1].chop
2097
- #内容
2098
- @elm_.mixed_content = @res[3]
2126
+ @elm_ = Meteor::Element.new(name)
2127
+ unless @on_search
2128
+ #属性
2129
+ @elm_.attributes = @res[1].chop
2130
+ #内容
2131
+ @elm_.mixed_content = @res[3]
2132
+ else
2133
+ #属性
2134
+ @elm_.attributes = @res[1].chop
2135
+ #内容
2136
+ @elm_.mixed_content = @res[3]
2137
+ end
2099
2138
  #全体
2100
2139
  @elm_.document = @res[0]
2101
2140
  #内容あり要素検索用パターン
@@ -2128,29 +2167,29 @@ module Meteor
2128
2167
 
2129
2168
  def element_pattern_with_3_2
2130
2169
 
2131
- #@pattern_cc_1 = '' << TAG_OPEN << @_tag << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
2170
+ #@pattern_cc_1 = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
2132
2171
  #@pattern_cc_1 << @_attr_value << TAG_SEARCH_2_4_2
2133
- @pattern_cc_1 = "<#{@_tag}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))"
2172
+ @pattern_cc_1 = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))"
2134
2173
 
2135
- @pattern_cc_1b = '' << TAG_OPEN << @_tag << TAG_SEARCH_1_4
2136
- #@pattern_cc_1b = "<#{@_tag}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
2174
+ @pattern_cc_1b = '' << TAG_OPEN << @_name << TAG_SEARCH_1_4
2175
+ #@pattern_cc_1b = "<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
2137
2176
 
2138
- #@pattern_cc_1_1 = '' << TAG_OPEN << @_tag << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
2177
+ #@pattern_cc_1_1 = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
2139
2178
  #@pattern_cc_1_1 << @_attr_value << TAG_SEARCH_4_7
2140
- @pattern_cc_1_1 = "<#{@_tag}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
2179
+ @pattern_cc_1_1 = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
2141
2180
 
2142
- @pattern_cc_1_2 = '' << TAG_SEARCH_4_2 << @_tag << TAG_SEARCH_4_3
2143
- #@pattern_cc_1_2 = ".*?<#{@_tag}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
2181
+ @pattern_cc_1_2 = '' << TAG_SEARCH_4_2 << @_name << TAG_SEARCH_4_3
2182
+ #@pattern_cc_1_2 = ".*?<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
2144
2183
 
2145
2184
 
2146
- @pattern_cc_2 = '' << TAG_SEARCH_4_4 << @_tag << TAG_CLOSE
2147
- #@pattern_cc_2 = '' << "<\\/#{@_tag}>"
2185
+ @pattern_cc_2 = '' << TAG_SEARCH_4_4 << @_name << TAG_CLOSE
2186
+ #@pattern_cc_2 = '' << "<\\/#{@_name}>"
2148
2187
 
2149
- @pattern_cc_2_1 = '' << TAG_SEARCH_4_5 << @_tag << TAG_CLOSE
2150
- #@pattern_cc_2_1 = ".*?<\\/#{@_tag}>"
2188
+ @pattern_cc_2_1 = '' << TAG_SEARCH_4_5 << @_name << TAG_CLOSE
2189
+ #@pattern_cc_2_1 = ".*?<\\/#{@_name}>"
2151
2190
 
2152
- @pattern_cc_2_2 = '' << TAG_SEARCH_4_6 << @_tag << TAG_CLOSE
2153
- #@pattern_cc_2_2 = ".*?)<\\/#{@_tag}>"
2191
+ @pattern_cc_2_2 = '' << TAG_SEARCH_4_6 << @_name << TAG_CLOSE
2192
+ #@pattern_cc_2_2 = ".*?)<\\/#{@_name}>"
2154
2193
 
2155
2194
  #内容あり要素検索
2156
2195
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
@@ -2170,23 +2209,23 @@ module Meteor
2170
2209
 
2171
2210
  private :element_pattern_with_3_2
2172
2211
 
2173
- def element_without_3(tag)
2174
- element_without_3_1(tag, TAG_SEARCH_NC_2_3_2)
2212
+ def element_without_3(name)
2213
+ element_without_3_1(name, TAG_SEARCH_2_3_2)
2175
2214
  end
2176
2215
 
2177
2216
  private :element_without_3
2178
2217
 
2179
- def element_without_3_1(tag, closer)
2218
+ def element_without_3_1(name, closer)
2180
2219
 
2181
2220
  #要素
2182
- @elm_ = Meteor::Element.new(tag)
2221
+ @elm_ = Meteor::Element.new(name)
2183
2222
  #属性
2184
2223
  @elm_.attributes = @res[1]
2185
2224
  #全体
2186
2225
  @elm_.document = @res[0]
2187
2226
  #空要素検索用パターン
2188
- @pattern_cc = '' << TAG_OPEN << @_tag << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ << @_attr_value << closer
2189
- #@pattern_cc = "<#{@_tag}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}#{closer}"
2227
+ @pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ << @_attr_value << closer
2228
+ #@pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}#{closer}"
2190
2229
  @elm_.pattern = @pattern_cc
2191
2230
 
2192
2231
  @elm_.parser = self
@@ -2214,7 +2253,9 @@ module Meteor
2214
2253
  if @res
2215
2254
  element_3(@res[1], attr_name, attr_value)
2216
2255
  else
2217
- puts Meteor::Exception::NoSuchElementException.new(attr_name, attr_value).message
2256
+ if @error_check
2257
+ puts Meteor::Exception::NoSuchElementException.new(attr_name, attr_value).message
2258
+ end
2218
2259
  @elm_ = nil
2219
2260
  end
2220
2261
  #=end
@@ -2261,7 +2302,9 @@ module Meteor
2261
2302
  #@pattern_cc = @pattern_cc_2
2262
2303
  element_with_2_1
2263
2304
  else
2264
- puts Meteor::Exception::NoSuchElementException.new(attr_name, attr_value).message
2305
+ if @error_check
2306
+ puts Meteor::Exception::NoSuchElementException.new(attr_name, attr_value).message
2307
+ end
2265
2308
  @elm_ = nil
2266
2309
  end
2267
2310
  =end
@@ -2292,9 +2335,9 @@ module Meteor
2292
2335
  #puts @res.captures.length
2293
2336
  case @res.captures.length
2294
2337
  when FOUR
2295
- @_tag = @res[1]
2338
+ @_name = @res[1]
2296
2339
  #要素
2297
- @elm_ = Element.new(@_tag)
2340
+ @elm_ = Element.new(@_name)
2298
2341
  #属性
2299
2342
  @elm_.attributes = @res[2]
2300
2343
  #内容
@@ -2302,10 +2345,10 @@ module Meteor
2302
2345
  #全体
2303
2346
  @elm_.document = @res[0]
2304
2347
  #内容あり要素検索用パターン
2305
- #@pattern_cc = ''<< TAG_OPEN << @_tag << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ
2306
- #@pattern_cc << @_attr_value << TAG_SEARCH_NC_2_2 << @_tag
2307
- #@pattern_cc << TAG_SEARCH_NC_1_2 << @_tag << TAG_CLOSE
2308
- @pattern_cc = "<#{@_tag}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_tag}[^<>]*>)).)*<\\/#{@_tag}>"
2348
+ #@pattern_cc = ''<< TAG_OPEN << @_name << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ
2349
+ #@pattern_cc << @_attr_value << TAG_SEARCH_NC_2_2 << @_name
2350
+ #@pattern_cc << TAG_SEARCH_NC_1_2 << @_name << TAG_CLOSE
2351
+ @pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>"
2309
2352
 
2310
2353
  @elm_.pattern = @pattern_cc
2311
2354
 
@@ -2314,9 +2357,9 @@ module Meteor
2314
2357
  @elm_.parser = self
2315
2358
 
2316
2359
  when FIVE,SEVEN
2317
- @_tag = @res[3]
2360
+ @_name = @res[3]
2318
2361
  #要素
2319
- @elm_ = Element.new(@_tag)
2362
+ @elm_ = Element.new(@_name)
2320
2363
  #属性
2321
2364
  @elm_.attributes = @res[4]
2322
2365
  #内容
@@ -2324,10 +2367,10 @@ module Meteor
2324
2367
  #全体
2325
2368
  @elm_.document = @res[0]
2326
2369
  #内容あり要素検索用パターン
2327
- #@pattern_cc = ''<< TAG_OPEN << @_tag << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ
2328
- #@pattern_cc << @_attr_value << TAG_SEARCH_NC_2_2 << @_tag
2329
- #@pattern_cc << TAG_SEARCH_NC_1_2 << @_tag << TAG_CLOSE
2330
- @pattern_cc = "<#{@_tag}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_tag}[^<>]*>)).)*<\\/#{@_tag}>"
2370
+ #@pattern_cc = ''<< TAG_OPEN << @_name << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ
2371
+ #@pattern_cc << @_attr_value << TAG_SEARCH_NC_2_2 << @_name
2372
+ #@pattern_cc << TAG_SEARCH_NC_1_2 << @_name << TAG_CLOSE
2373
+ @pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>"
2331
2374
 
2332
2375
  @elm_.pattern = @pattern_cc
2333
2376
 
@@ -2338,9 +2381,9 @@ module Meteor
2338
2381
  when THREE,SIX
2339
2382
  #puts @res[1]
2340
2383
  #puts @res[3]
2341
- #@_tag = @res[1]
2384
+ #@_name = @res[1]
2342
2385
  #内容
2343
- @elm_ = Element.new(@_tag)
2386
+ @elm_ = Element.new(@_name)
2344
2387
  #属性
2345
2388
  @elm_.attributes = @res[1].chop
2346
2389
  #内容
@@ -2361,7 +2404,7 @@ module Meteor
2361
2404
 
2362
2405
  def element_with_2_2
2363
2406
 
2364
- #@pattern_cc_1 = '' << TAG_OPEN << @_tag << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
2407
+ #@pattern_cc_1 = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
2365
2408
  #@pattern_cc_1 << @_attr_value << TAG_SEARCH_2_4_2
2366
2409
  @pattern_cc_1 = "<([^<>\"]*)(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))"
2367
2410
 
@@ -2390,21 +2433,21 @@ module Meteor
2390
2433
 
2391
2434
  def create_pattern_2(args_cnt)
2392
2435
 
2393
- #puts @_tag
2436
+ #puts @_name
2394
2437
 
2395
- @pattern_cc_1b = '' << TAG_OPEN << @_tag << TAG_SEARCH_1_4
2438
+ @pattern_cc_1b = '' << TAG_OPEN << @_name << TAG_SEARCH_1_4
2396
2439
 
2397
- #@pattern_cc_1_1 = '' << TAG_OPEN << @_tag << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
2440
+ #@pattern_cc_1_1 = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
2398
2441
  #@pattern_cc_1_1 << @_attr_value << TAG_SEARCH_4_7
2399
- @pattern_cc_1_1 = "<#{@_tag}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
2442
+ @pattern_cc_1_1 = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
2400
2443
 
2401
- @pattern_cc_1_2 = '' << TAG_SEARCH_4_2 << @_tag << TAG_SEARCH_4_3
2444
+ @pattern_cc_1_2 = '' << TAG_SEARCH_4_2 << @_name << TAG_SEARCH_4_3
2402
2445
 
2403
- @pattern_cc_2 = '' << TAG_SEARCH_4_4 << @_tag << TAG_CLOSE
2446
+ @pattern_cc_2 = '' << TAG_SEARCH_4_4 << @_name << TAG_CLOSE
2404
2447
 
2405
- @pattern_cc_2_1 = '' << TAG_SEARCH_4_5 << @_tag << TAG_CLOSE
2448
+ @pattern_cc_2_1 = '' << TAG_SEARCH_4_5 << @_name << TAG_CLOSE
2406
2449
 
2407
- @pattern_cc_2_2 = '' << TAG_SEARCH_4_6 << @_tag << TAG_CLOSE
2450
+ @pattern_cc_2_2 = '' << TAG_SEARCH_4_6 << @_name << TAG_CLOSE
2408
2451
 
2409
2452
  @pattern_2 = Meteor::Core::Util::PatternCache.get(@pattern_cc_2)
2410
2453
  @pattern_1b = Meteor::Core::Util::PatternCache.get(@pattern_cc_1b)
@@ -2426,7 +2469,7 @@ module Meteor
2426
2469
  #全体
2427
2470
  @elm_.document = @res[0]
2428
2471
  #空要素検索用パターン
2429
- @pattern_cc = '' << TAG_OPEN << @_tag << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ << @_attr_value << closer
2472
+ @pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_NC_2_1 << @_attr_name << ATTR_EQ << @_attr_value << closer
2430
2473
  @elm_.pattern = @pattern_cc
2431
2474
 
2432
2475
  @elm_.parser = self
@@ -2439,18 +2482,18 @@ module Meteor
2439
2482
 
2440
2483
  #
2441
2484
  # get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で検索し、要素を取得する)
2442
- # @param [String] tag tag name (タグ名)
2485
+ # @param [String] name tag name (タグ名)
2443
2486
  # @param [String] attr_name1 attribute name1 (属性名1)
2444
2487
  # @param [String] attr_value1 attribute value1 (属性値1)
2445
2488
  # @param [String] attr_name2 attribute name2 (属性名2)
2446
2489
  # @param [String] attr_value2 attribute value2 (属性値2)
2447
2490
  # @return [Meteor::Element] element (要素)
2448
2491
  #
2449
- def element_5(tag, attr_name1, attr_value1, attr_name2, attr_value2)
2492
+ def element_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
2450
2493
 
2451
- element_quote_5(tag, attr_name1, attr_value1, attr_name2, attr_value2)
2494
+ element_quote_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
2452
2495
 
2453
- @pattern_cc_1 = "<#{@_tag}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)\\/>|<#{@_tag}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_tag}[^<>]*>)).)*)<\\/#{@_tag}>"
2496
+ @pattern_cc_1 = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)\\/>|<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
2454
2497
 
2455
2498
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
2456
2499
  @res1 = @pattern.match(@root.document)
@@ -2468,29 +2511,31 @@ module Meteor
2468
2511
  @res = @res1
2469
2512
  #@pattern_cc = @pattern_cc_1
2470
2513
  if @res[1]
2471
- element_without_5(tag)
2514
+ element_without_5(name)
2472
2515
  else
2473
- element_with_5_1(tag)
2516
+ element_with_5_1(name)
2474
2517
  end
2475
2518
  elsif @res1.begin(0) > @res2.begin(0)
2476
2519
  @res = @res2
2477
2520
  #@pattern_cc = @pattern_cc_2
2478
- element_with_5_1(tag)
2521
+ element_with_5_1(name)
2479
2522
  end
2480
2523
  elsif @res1 && !@res2
2481
2524
  @res = @res1
2482
2525
  #@pattern_cc = @pattern_cc_1
2483
2526
  if @res[1]
2484
- element_without_5(tag)
2527
+ element_without_5(name)
2485
2528
  else
2486
- element_with_5_1(tag)
2529
+ element_with_5_1(name)
2487
2530
  end
2488
2531
  elsif @res2 && !@res1
2489
2532
  @res = @res2
2490
2533
  #@pattern_cc = @pattern_cc_2
2491
- element_with_5_1(tag)
2534
+ element_with_5_1(name)
2492
2535
  else
2493
- puts Meteor::Exception::NoSuchElementException.new(tag, attr_name, attr_value).message
2536
+ if @error_check
2537
+ puts Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message
2538
+ end
2494
2539
  @elm_ = nil
2495
2540
  end
2496
2541
 
@@ -2499,8 +2544,8 @@ module Meteor
2499
2544
 
2500
2545
  private :element_5
2501
2546
 
2502
- def element_quote_5(tag, attr_name1, attr_value1, attr_name2, attr_value2)
2503
- @_tag = Regexp.quote(tag)
2547
+ def element_quote_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
2548
+ @_name = Regexp.quote(name)
2504
2549
  @_attr_name1 = Regexp.quote(attr_name1)
2505
2550
  @_attr_name2 = Regexp.quote(attr_name2)
2506
2551
  @_attr_value1 = Regexp.quote(attr_value1)
@@ -2509,13 +2554,13 @@ module Meteor
2509
2554
 
2510
2555
  private :element_quote_5
2511
2556
 
2512
- def element_with_5_1(tag)
2557
+ def element_with_5_1(name)
2513
2558
 
2514
2559
  #puts @res.captures.length
2515
2560
  case @res.captures.length
2516
2561
  when FOUR
2517
2562
  #要素
2518
- @elm_ = Meteor::Element.new(tag)
2563
+ @elm_ = Meteor::Element.new(name)
2519
2564
  #属性
2520
2565
  @elm_.attributes = @res[1]
2521
2566
  #内容
@@ -2523,13 +2568,13 @@ module Meteor
2523
2568
  #全体
2524
2569
  @elm_.document = @res[0]
2525
2570
  #内容あり要素検索用パターン
2526
- #@pattern_cc = '' << TAG_OPEN << @_tag << TAG_SEARCH_NC_2_1_2 << @_attr_name1 << ATTR_EQ
2571
+ #@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_NC_2_1_2 << @_attr_name1 << ATTR_EQ
2527
2572
  #@pattern_cc << @_attr_value1 << TAG_SEARCH_NC_2_6 << @_attr_name2 << ATTR_EQ
2528
2573
  #@pattern_cc << @_attr_value2 << TAG_SEARCH_NC_2_7 << @_attr_name2 << ATTR_EQ
2529
2574
  #@pattern_cc << @_attr_value2 << TAG_SEARCH_NC_2_6 << @_attr_name1 << ATTR_EQ
2530
- #@pattern_cc << @_attr_value1 << TAG_SEARCH_NC_2_2_2 << @_tag
2531
- #@pattern_cc << TAG_SEARCH_NC_1_2 << @_tag << TAG_CLOSE
2532
- @pattern_cc = "<#{@_tag}\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*>((?!(#{@_tag}[^<>]*>)).)*<\\/#{@_tag}>"
2575
+ #@pattern_cc << @_attr_value1 << TAG_SEARCH_NC_2_2_2 << @_name
2576
+ #@pattern_cc << TAG_SEARCH_NC_1_2 << @_name << TAG_CLOSE
2577
+ @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
2533
2578
 
2534
2579
  @elm_.pattern = @pattern_cc
2535
2580
  #
@@ -2538,7 +2583,7 @@ module Meteor
2538
2583
  @elm_.parser = self
2539
2584
  when FIVE
2540
2585
  #要素
2541
- @elm_ = Meteor::Element.new(tag)
2586
+ @elm_ = Meteor::Element.new(name)
2542
2587
  #属性
2543
2588
  @elm_.attributes = @res[2]
2544
2589
  #内容
@@ -2546,13 +2591,13 @@ module Meteor
2546
2591
  #全体
2547
2592
  @elm_.document = @res[0]
2548
2593
  #内容あり要素検索用パターン
2549
- #@pattern_cc = '' << TAG_OPEN << @_tag << TAG_SEARCH_NC_2_1_2 << @_attr_name1 << ATTR_EQ
2594
+ #@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_NC_2_1_2 << @_attr_name1 << ATTR_EQ
2550
2595
  #@pattern_cc << @_attr_value1 << TAG_SEARCH_NC_2_6 << @_attr_name2 << ATTR_EQ
2551
2596
  #@pattern_cc << @_attr_value2 << TAG_SEARCH_NC_2_7 << @_attr_name2 << ATTR_EQ
2552
2597
  #@pattern_cc << @_attr_value2 << TAG_SEARCH_NC_2_6 << @_attr_name1 << ATTR_EQ
2553
- #@pattern_cc << @_attr_value1 << TAG_SEARCH_NC_2_2_2 << @_tag
2554
- #@pattern_cc << TAG_SEARCH_NC_1_2 << @_tag << TAG_CLOSE
2555
- @pattern_cc = "<#{@_tag}\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*>((?!(#{@_tag}[^<>]*>)).)*<\\/#{@_tag}>"
2598
+ #@pattern_cc << @_attr_value1 << TAG_SEARCH_NC_2_2_2 << @_name
2599
+ #@pattern_cc << TAG_SEARCH_NC_1_2 << @_name << TAG_CLOSE
2600
+ @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
2556
2601
 
2557
2602
  @elm_.pattern = @pattern_cc
2558
2603
  #
@@ -2562,7 +2607,7 @@ module Meteor
2562
2607
 
2563
2608
  when THREE,SIX
2564
2609
  #要素
2565
- @elm_ = Meteor::Element.new(tag)
2610
+ @elm_ = Meteor::Element.new(name)
2566
2611
  #属性
2567
2612
  @elm_.attributes = @res[1].chop
2568
2613
  #要素
@@ -2599,38 +2644,38 @@ module Meteor
2599
2644
 
2600
2645
  def element_pattern_with_5_2
2601
2646
 
2602
- #@pattern_cc_1 = '' << TAG_OPEN << @_tag << TAG_SEARCH_2_1_2 << @_attr_name1 << ATTR_EQ
2647
+ #@pattern_cc_1 = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1_2 << @_attr_name1 << ATTR_EQ
2603
2648
  #@pattern_cc_1 << @_attr_value1 << TAG_SEARCH_2_6 << @_attr_name2 << ATTR_EQ
2604
2649
  #@pattern_cc_1 << @_attr_value2 << TAG_SEARCH_2_7 << @_attr_name2 << ATTR_EQ
2605
2650
  #@pattern_cc_1 << @_attr_value2 << TAG_SEARCH_2_6 << @_attr_name1 << ATTR_EQ
2606
2651
  #@pattern_cc_1 << @_attr_value1 << TAG_SEARCH_2_4_2_2
2607
- @pattern_cc_1 = "<#{@_tag}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")([^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>)))"
2652
+ @pattern_cc_1 = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")([^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>)))"
2608
2653
 
2609
- @pattern_cc_1b = '' << TAG_OPEN << @_tag << TAG_SEARCH_1_4
2610
- #@pattern_cc_1b = "<#{@_tag}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
2654
+ @pattern_cc_1b = '' << TAG_OPEN << @_name << TAG_SEARCH_1_4
2655
+ #@pattern_cc_1b = "<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
2611
2656
 
2612
- #@pattern_cc_1_1 = '' << TAG_OPEN << @_tag << TAG_SEARCH_2_1_2 << @_attr_name1 << ATTR_EQ
2657
+ #@pattern_cc_1_1 = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1_2 << @_attr_name1 << ATTR_EQ
2613
2658
  #@pattern_cc_1_1 << @_attr_value1 << TAG_SEARCH_2_6 << @_attr_name2 << ATTR_EQ
2614
2659
  #@pattern_cc_1_1 << @_attr_value2 << TAG_SEARCH_2_7 << @_attr_name2 << ATTR_EQ
2615
2660
  #@pattern_cc_1_1 << @_attr_value2 << TAG_SEARCH_2_6 << @_attr_name1 << ATTR_EQ
2616
2661
  #@pattern_cc_1_1 << @_attr_value1 << TAG_SEARCH_4_7_2
2617
- @pattern_cc_1_1 = "<#{@_tag}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
2662
+ @pattern_cc_1_1 = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))("
2618
2663
 
2619
- @pattern_cc_1_2 = '' << TAG_SEARCH_4_2 << @_tag << TAG_SEARCH_4_3
2664
+ @pattern_cc_1_2 = '' << TAG_SEARCH_4_2 << @_name << TAG_SEARCH_4_3
2620
2665
 
2621
- @pattern_cc_2 = '' << TAG_SEARCH_4_4 << @_tag << TAG_CLOSE
2666
+ @pattern_cc_2 = '' << TAG_SEARCH_4_4 << @_name << TAG_CLOSE
2622
2667
 
2623
- @pattern_cc_2_1 = '' << TAG_SEARCH_4_5 << @_tag << TAG_CLOSE
2668
+ @pattern_cc_2_1 = '' << TAG_SEARCH_4_5 << @_name << TAG_CLOSE
2624
2669
 
2625
- @pattern_cc_2_2 = '' << TAG_SEARCH_4_6 << @_tag << TAG_CLOSE
2670
+ @pattern_cc_2_2 = '' << TAG_SEARCH_4_6 << @_name << TAG_CLOSE
2626
2671
 
2627
- #@pattern_cc_1_2 = ".*?<#{@_tag}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
2672
+ #@pattern_cc_1_2 = ".*?<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
2628
2673
  #
2629
- #@pattern_cc_2 = '' << "<\\/#{@_tag}>"
2674
+ #@pattern_cc_2 = '' << "<\\/#{@_name}>"
2630
2675
  #
2631
- #@pattern_cc_2_1 = ".*?<\\/#{@_tag}>"
2676
+ #@pattern_cc_2_1 = ".*?<\\/#{@_name}>"
2632
2677
  #
2633
- #@pattern_cc_2_2 = ".*?)<\\/#{@_tag}>"
2678
+ #@pattern_cc_2_2 = ".*?)<\\/#{@_name}>"
2634
2679
 
2635
2680
  #内容あり要素検索
2636
2681
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc_1)
@@ -2650,27 +2695,27 @@ module Meteor
2650
2695
 
2651
2696
  private :element_pattern_with_5_2
2652
2697
 
2653
- def element_without_5(tag)
2654
- element_without_5_1(tag, TAG_SEARCH_NC_2_3_2_2)
2698
+ def element_without_5(name)
2699
+ element_without_5_1(name, TAG_SEARCH_2_3_2_2)
2655
2700
  end
2656
2701
 
2657
2702
  private :element_without_5
2658
2703
 
2659
- def element_without_5_1(tag, closer)
2704
+ def element_without_5_1(name, closer)
2660
2705
 
2661
2706
  #要素
2662
- @elm_ = Meteor::Element.new(tag)
2707
+ @elm_ = Meteor::Element.new(name)
2663
2708
  #属性
2664
2709
  @elm_.attributes = @res[1]
2665
2710
  #全体
2666
2711
  @elm_.document = @res[0]
2667
2712
  #空要素検索用パターン
2668
- #@pattern_cc = '' << TAG_OPEN << @_tag << TAG_SEARCH_NC_2_1_2 << @_attr_name1 << ATTR_EQ
2713
+ #@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_NC_2_1_2 << @_attr_name1 << ATTR_EQ
2669
2714
  #@pattern_cc << @_attr_value1 << TAG_SEARCH_NC_2_6 << @_attr_name2 << ATTR_EQ
2670
2715
  #@pattern_cc << @_attr_value2 << TAG_SEARCH_NC_2_7 << @_attr_name2 << ATTR_EQ
2671
2716
  #@pattern_cc << @_attr_value2 << TAG_SEARCH_NC_2_6 << @_attr_name1 << ATTR_EQ
2672
2717
  #@pattern_cc << @_attr_value1 << closer
2673
- @pattern_cc = "<#{@_tag}\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}#{closer}"
2718
+ @pattern_cc = "<#{@_name}(\\s[^<>]*(#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}#{closer}"
2674
2719
 
2675
2720
  @elm_.pattern = @pattern_cc
2676
2721
 
@@ -2702,7 +2747,9 @@ module Meteor
2702
2747
  #@elm_ = element_5(@res[1], attr_name1, attr_value1,attr_name2, attr_value2)
2703
2748
  element_5(@res[1], attr_name1, attr_value1, attr_name2, attr_value2)
2704
2749
  else
2705
- puts Meteor::Exception::NoSuchElementException.new(attr_name1, attr_value1, attr_name2, attr_value2).message
2750
+ if @error_check
2751
+ puts Meteor::Exception::NoSuchElementException.new(attr_name1, attr_value1, attr_name2, attr_value2).message
2752
+ end
2706
2753
  @elm_ = nil
2707
2754
  end
2708
2755
 
@@ -2864,7 +2911,7 @@ module Meteor
2864
2911
  else
2865
2912
  @position = @res.end(0)
2866
2913
 
2867
- @_tag = @res[1]
2914
+ @_name = @res[1]
2868
2915
 
2869
2916
  create_pattern_2(args_cnt)
2870
2917
 
@@ -2912,43 +2959,43 @@ module Meteor
2912
2959
  =end
2913
2960
 
2914
2961
  # get elements (要素を取得する)
2915
- # @overload elements(tag)
2962
+ # @overload elements(name)
2916
2963
  # get elements using tag name (要素のタグ名で要素を取得する)
2917
- # @param [String] tag tag name (タグ名)
2964
+ # @param [String,Symbol] name tag name (タグ名)
2918
2965
  # @return [Array<Meteor::Element>] element array(要素配列)
2919
- # @overload elements(tag,attrs)
2966
+ # @overload elements(name,attrs)
2920
2967
  # get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
2921
- # @param [String] tag tag name (タグ名)
2922
- # @param [Hash<String,String>] attrs attribute map (属性マップ)
2968
+ # @param [String,Symbol] name tag name (タグ名)
2969
+ # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
2923
2970
  # @return [Array<Meteor::Element>] element array (要素配列)
2924
2971
  # @overload elements(attrs)
2925
2972
  # get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
2926
- # @param [Hash<String,String>] attrs attribute map (属性マップ)
2973
+ # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
2927
2974
  # @return [Array<Meteor::Element>] element array (要素配列)
2928
- # @overload elements(tag,attr_name,attr_value)
2975
+ # @overload elements(name,attr_name,attr_value)
2929
2976
  # get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
2930
- # @param [String] tag tag name (タグ名)
2931
- # @param [String] attr_name attribute name (属性名)
2977
+ # @param [String,Symbol] name tag name (タグ名)
2978
+ # @param [String,Symbol] attr_name attribute name (属性名)
2932
2979
  # @param [String] attr_value attribute value (属性値)
2933
2980
  # @return [Array<Meteor::Element>] element array (要素配列)
2934
2981
  # @overload elements(attr_name,attr_value)
2935
2982
  # get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
2936
- # @param [String] attr_name attribute name (属性名)
2983
+ # @param [String,Symbol] attr_name attribute name (属性名)
2937
2984
  # @param [String] attr_value attribute value (属性値)
2938
2985
  # @return [Array<Meteor::Element>] element array (要素配列)
2939
- # @overload elements(tag,attr_name1,attr_value1,attr_name2,attr_value2)
2986
+ # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
2940
2987
  # get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
2941
- # @param [String] tag tag name (タグ名)
2942
- # @param [String] attr_name1 attribute name1 (属性名1)
2988
+ # @param [String,Symbol] name tag name (タグ名)
2989
+ # @param [String,Symbol] attr_name1 attribute name1 (属性名1)
2943
2990
  # @param [String] attr_value1 attribute value1 (属性値1)
2944
- # @param [String] attr_name2 attribute name2 (属性名2)
2991
+ # @param [String,Symbol] attr_name2 attribute name2 (属性名2)
2945
2992
  # @param [String] attr_value2 attribute value2 (属性値2)
2946
2993
  # @return [Array<Meteor::Element>] element array (要素配列)
2947
2994
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
2948
2995
  # get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
2949
- # @param [String] attr_name1 attribute name1 (属性名1)
2996
+ # @param [String,Symbol] attr_name1 attribute name1 (属性名1)
2950
2997
  # @param [String] attr_value1 attribute value1 (属性値1)
2951
- # @param [String] attr_name2 attribute name2 (属性名2)
2998
+ # @param [String,Symbol] attr_name2 attribute name2 (属性名2)
2952
2999
  # @param [String] attr_value2 attribute value2 (属性値2)
2953
3000
  # @return [Array<Meteor::Element>] element array (要素配列)
2954
3001
  #
@@ -2999,6 +3046,8 @@ module Meteor
2999
3046
  def elements_(*args)
3000
3047
  elm_arr = Array.new
3001
3048
 
3049
+ @on_search = true
3050
+
3002
3051
  case args.size
3003
3052
  when ONE
3004
3053
  @elm_ = element_1(*args)
@@ -3016,33 +3065,36 @@ module Meteor
3016
3065
  return elm_arr
3017
3066
  end
3018
3067
 
3019
- @patten_cc = @elm_.pattern
3068
+ @pattern_cc = @elm_.pattern
3020
3069
 
3021
- @patten = Meteor::Core::Util::PatternCache.get(@pattern_cc)
3070
+ #puts @pattern_cc
3071
+
3072
+ @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
3022
3073
 
3023
3074
  @position = 0
3024
3075
 
3025
3076
  while (@res = @pattern.match(@root.document,@position))
3026
-
3027
- if @res
3077
+ @position = @res.end(0)
3078
+ #puts @res[0]
3079
+ #if @res
3028
3080
  case args.size
3029
3081
  when ONE
3030
3082
  if @elm_.empty
3031
- element_with_1(@elm_.tag)
3083
+ element_with_1(@elm_.name)
3032
3084
  else
3033
- element_without_1(@elm_.tag)
3085
+ element_without_1(@elm_.name)
3034
3086
  end
3035
3087
  when TWO,THREE
3036
3088
  if @elm_.empty
3037
- element_with_3_1(@elm_.tag)
3089
+ element_with_3_1(@elm_.name)
3038
3090
  else
3039
- element_without_3(@elm_.tag)
3091
+ element_without_3(@elm_.name)
3040
3092
  end
3041
3093
  when FOUR,FIVE
3042
3094
  if @elm_.empty
3043
- element_with_5_1(@elm_.tag)
3095
+ element_with_5_1(@elm_.name)
3044
3096
  else
3045
- element_without_5(@elm_.tag)
3097
+ element_without_5(@elm_.name)
3046
3098
  end
3047
3099
  end
3048
3100
 
@@ -3051,12 +3103,13 @@ module Meteor
3051
3103
 
3052
3104
  @element_cache.store(@elm_.object_id, @elm_)
3053
3105
 
3054
- @position = @res.end(0)
3055
- else
3056
- break
3057
- end
3106
+ #else
3107
+ # break
3108
+ #end
3058
3109
  end
3059
-
3110
+
3111
+ @on_search = false
3112
+
3060
3113
  elm_arr
3061
3114
  end
3062
3115
 
@@ -3143,18 +3196,18 @@ module Meteor
3143
3196
  # @overload attr(elm,attr)
3144
3197
  # set attribute of element (要素の属性をセットする)
3145
3198
  # @param [Meteor::Element] elm element (要素)
3146
- # @param [Hash<String,String>] attr attribute (属性)
3199
+ # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
3147
3200
  # @return [Meteor::Element] element (要素)
3148
3201
  # @overload attr(elm,attr_name,attr_value)
3149
3202
  # set attribute of element (要素の属性をセットする)
3150
3203
  # @param [Meteor::Element] elm element (要素)
3151
- # @param [String] attr_name attribute name (属性名)
3204
+ # @param [String,Symbol] attr_name attribute name (属性名)
3152
3205
  # @param [String,true,false] attr_value attribute value (属性値)
3153
3206
  # @return [Meteor::Element] element (要素)
3154
3207
  # @overload attr(elm,attr_name)
3155
3208
  # get attribute value of element (要素の属性値を取得する)
3156
3209
  # @param [Meteor::Element] elm element (要素)
3157
- # @param [String] attr_name attribute name (属性名)
3210
+ # @param [String,Symbol] attr_name attribute name (属性名)
3158
3211
  # @return [String] attribute value (属性値)
3159
3212
  #
3160
3213
  def attr(elm, attr,*args)
@@ -3163,13 +3216,21 @@ module Meteor
3163
3216
  when ZERO
3164
3217
  get_attr_value(elm, attr.to_s)
3165
3218
  when ONE
3166
- elm.document_sync = true
3167
- set_attribute_3(elm, attr.to_s,args[0])
3219
+ if args[0] != nil
3220
+ elm.document_sync = true
3221
+ set_attribute_3(elm, attr.to_s,args[0])
3222
+ else
3223
+ remove_attr(elm, attr.to_s)
3224
+ end
3168
3225
  end
3169
3226
 
3170
3227
  elsif attr.kind_of?(Hash) && attr.size == 1
3171
- elm.document_sync = true
3172
- set_attribute_3(elm, attr.keys[0].to_s, attr.values[0])
3228
+ if attr.values[0] != nil
3229
+ elm.document_sync = true
3230
+ set_attribute_3(elm, attr.keys[0].to_s, attr.values[0])
3231
+ else
3232
+ remove_attr(elm, attr.keys[0].to_s)
3233
+ end
3173
3234
  #elsif attrs.kind_of?(Hash) && attrs.size >= 1
3174
3235
  # elm.document_sync = true
3175
3236
  # attrs.each{|name,value|
@@ -3263,7 +3324,7 @@ module Meteor
3263
3324
  #
3264
3325
  # @overload attrs(elm,attrs)
3265
3326
  # @param [Meteor::element] elm element (要素)
3266
- # @param [Hash<String,String>] attrs attribute map (属性マップ)
3327
+ # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
3267
3328
  # @overload attrs(elm)
3268
3329
  # @param [Meteor::element] elm element (要素)
3269
3330
  # @return [Hash<String,String>] attribute map (要素マップ)
@@ -3418,13 +3479,13 @@ module Meteor
3418
3479
  when TWO
3419
3480
  #if args[0].kind_of?(Meteor::Element) && args[1].kind_of?(String)
3420
3481
  args[0].document_sync = true
3421
- set_content_2(args[0], args[1])
3482
+ set_content_2(args[0], args[1].to_s)
3422
3483
  #else
3423
3484
  # raise ArgumentError
3424
3485
  #end
3425
3486
  when THREE
3426
3487
  args[0].document_sync = true
3427
- set_content_3(args[0], args[1], args[2])
3488
+ set_content_3(args[0], args[1].to_s, args[2])
3428
3489
  else
3429
3490
  raise ArgumentError
3430
3491
  end
@@ -3499,8 +3560,6 @@ module Meteor
3499
3560
  elm
3500
3561
  end
3501
3562
 
3502
- private :remove_attr
3503
-
3504
3563
  def remove_attrs_(elm, attr_name)
3505
3564
  #属性検索用パターン
3506
3565
  @pattern = Meteor::Core::Util::PatternCache.get('' << attr_name << ERASE_ATTR_1)
@@ -3522,9 +3581,9 @@ module Meteor
3522
3581
 
3523
3582
  #
3524
3583
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
3525
- # @overload cxtag(tag,id)
3584
+ # @overload cxtag(name,id)
3526
3585
  # get cx(comment extension) tag using tag name and id attribute (要素のタグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
3527
- # @param [String] tag tag name (タグ名)
3586
+ # @param [String,Symbol] name tag name (タグ名)
3528
3587
  # @param [String] id id attribute value (ID属性値)
3529
3588
  # @return [Meteor::Element] element (要素)
3530
3589
  # @overload cxtag(id)
@@ -3551,20 +3610,20 @@ module Meteor
3551
3610
 
3552
3611
  #
3553
3612
  # get cx(comment extension) tag using tag name and id attribute (要素のタグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
3554
- # @param [String] tag tag name (タグ名)
3613
+ # @param [String] name tag name (タグ名)
3555
3614
  # @param [String] id id attribute value (ID属性値)
3556
3615
  # @return [Meteor::Element] element (要素)
3557
3616
  #
3558
- def cxtag_2(tag, id)
3617
+ def cxtag_2(name, id)
3559
3618
 
3560
- @_tag = Regexp.quote(tag)
3619
+ @_name = Regexp.quote(name)
3561
3620
  @_id = Regexp.quote(id)
3562
3621
 
3563
3622
  #CXタグ検索用パターン
3564
- #@pattern_cc = '' << SEARCH_CX_1 << @_tag << SEARCH_CX_2
3565
- #@pattern_cc << id << SEARCH_CX_3 << @_tag << SEARCH_CX_4 << @_tag << SEARCH_CX_5
3623
+ #@pattern_cc = '' << SEARCH_CX_1 << @_name << SEARCH_CX_2
3624
+ #@pattern_cc << id << SEARCH_CX_3 << @_name << SEARCH_CX_4 << @_name << SEARCH_CX_5
3566
3625
  #@pattern_cc = "<!--\\s@#{tag}\\s([^<>]*id=\"#{id}\"[^<>]*)-->(((?!(<!--\\s\\/@#{tag})).)*)<!--\\s\\/@#{tag}\\s-->"
3567
- @pattern_cc = "<!--\\s@#{@_tag}\\s([^<>]*id=\"#{@_id}\"[^<>]*)-->(((?!(<!--\\s/@#{@_tag})).)*)<!--\\s/@#{@_tag}\\s-->"
3626
+ @pattern_cc = "<!--\\s@#{@_name}\\s([^<>]*id=\"#{@_id}\"[^<>]*)-->(((?!(<!--\\s/@#{@_name})).)*)<!--\\s/@#{@_name}\\s-->"
3568
3627
 
3569
3628
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
3570
3629
  #CXタグ検索
@@ -3572,7 +3631,7 @@ module Meteor
3572
3631
 
3573
3632
  if @res
3574
3633
  #要素
3575
- @elm_ = Meteor::Element.new(tag)
3634
+ @elm_ = Meteor::Element.new(name)
3576
3635
 
3577
3636
  @elm_.cx = true
3578
3637
  #属性
@@ -3681,21 +3740,25 @@ module Meteor
3681
3740
  #
3682
3741
  # reflect (反映する)
3683
3742
  #
3684
- def flush
3743
+ def flash
3685
3744
 
3686
3745
  if self.element_hook
3687
3746
  if self.element_hook.origin.mono
3688
3747
  if self.element_hook.origin.cx
3689
- #@root.hookDocument << SET_CX_1 << @root.element.tag << SPACE
3748
+ #@root.hookDocument << SET_CX_1 << @root.element.name << SPACE
3690
3749
  #@root.hookDocument << @root.element.attributes << SET_CX_2
3691
3750
  #@root.hookDocument << @root.element.mixed_content << SET_CX_3
3692
- #@root.hookDocument << @root.element.tag << SET_CX_4
3693
- self.document_hook << "<!-- @#{self.element_hook.tag} #{self.element_hook.attributes}-->#{self.element_hook.mixed_content}<!-- /@#{self.element_hook.tag} -->"
3751
+ #@root.hookDocument << @root.element.name << SET_CX_4
3752
+ self.document_hook << "<!-- @#{self.element_hook.name} #{self.element_hook.attributes}-->#{self.element_hook.mixed_content}<!-- /@#{self.element_hook.name} -->"
3753
+
3754
+ #self.document_hook << @root.kaigyo_code << "<!-- @#{self.element_hook.name} #{self.element_hook.attributes}-->#{self.element_hook.mixed_content}<!-- /@#{self.element_hook.name} -->"
3694
3755
  else
3695
- #@root.hookDocument << TAG_OPEN << @root.element.tag
3756
+ #@root.hookDocument << TAG_OPEN << @root.element.name
3696
3757
  #@root.hookDocument << @root.element.attributes << TAG_CLOSE << @root.element.mixed_content
3697
- #@root.hookDocument << TAG_OPEN3 << @root.element.tag << TAG_CLOSE
3698
- self.document_hook << "<#{self.element_hook.tag}#{self.element_hook.attributes}>#{self.element_hook.mixed_content}</#{self.element_hook.tag}>"
3758
+ #@root.hookDocument << TAG_OPEN3 << @root.element.name << TAG_CLOSE
3759
+ self.document_hook << "<#{self.element_hook.name}#{self.element_hook.attributes}>#{self.element_hook.mixed_content}</#{self.element_hook.name}>"
3760
+
3761
+ #self.document_hook << @root.kaigyo_code << "<#{self.element_hook.name}#{self.element_hook.attributes}>#{self.element_hook.mixed_content}</#{self.element_hook.name}>"
3699
3762
  end
3700
3763
  self.element_hook = Element.new!(self.element_hook.origin, self)
3701
3764
  else
@@ -3703,16 +3766,20 @@ module Meteor
3703
3766
  @_attributes = self.element_hook.attributes
3704
3767
 
3705
3768
  if self.element_hook.origin.cx
3706
- #@root.hookDocument << SET_CX_1 << @root.element.tag << SPACE
3769
+ #@root.hookDocument << SET_CX_1 << @root.element.name << SPACE
3707
3770
  #@root.hookDocument << @_attributes << SET_CX_2
3708
3771
  #@root.hookDocument << @root.document << SET_CX_3
3709
- #@root.hookDocument << @root.element.tag << SET_CX_4
3710
- self.document_hook << "<!-- @#{self.element_hook.tag} #{@_attributes}-->#{@root.document}<!-- /@#{self.element_hook.tag} -->"
3772
+ #@root.hookDocument << @root.element.name << SET_CX_4
3773
+ self.document_hook << "<!-- @#{self.element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{self.element_hook.name} -->"
3774
+
3775
+ #self.document_hook << @root.kaigyo_code << "<!-- @#{self.element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{self.element_hook.name} -->"
3711
3776
  else
3712
- #@root.hookDocument << TAG_OPEN << @root.element.tag
3777
+ #@root.hookDocument << TAG_OPEN << @root.element.name
3713
3778
  #@root.hookDocument << @_attributes << TAG_CLOSE << @root.document
3714
- #@root.hookDocument << TAG_OPEN3 << @root.element.tag << TAG_CLOSE
3715
- self.document_hook << "<#{self.element_hook.tag}#{@_attributes}>#{@root.document}</#{self.element_hook.tag}>"
3779
+ #@root.hookDocument << TAG_OPEN3 << @root.element.name << TAG_CLOSE
3780
+ self.document_hook << "<#{self.element_hook.name}#{@_attributes}>#{@root.document}</#{self.element_hook.name}>"
3781
+
3782
+ #self.document_hook << @root.kaigyo_code << "<#{self.element_hook.name}#{@_attributes}>#{@root.document}</#{self.element_hook.name}>"
3716
3783
  end
3717
3784
  self.element_hook = Element.new!(self.element_hook.origin, self)
3718
3785
  end
@@ -3756,6 +3823,7 @@ module Meteor
3756
3823
  else
3757
3824
  pif2.root_element.document = String.new(elm.document)
3758
3825
  end
3826
+ pif2.root_element.kaigyo_code = elm.parser.root_element.kaigyo_code
3759
3827
 
3760
3828
  @elm_
3761
3829
  end
@@ -3826,11 +3894,11 @@ module Meteor
3826
3894
 
3827
3895
  def create(pif)
3828
3896
  case pif.doc_type
3829
- when Parser::HTML
3830
- Meteor::Ml::Html::ParserImpl.new
3831
- when Parser::XHTML
3832
- Meteor::Ml::Xhtml::ParserImpl.new
3833
- when Parser::HTML5
3897
+ when Parser::HTML4
3898
+ Meteor::Ml::Html4::ParserImpl.new
3899
+ when Parser::XHTML4
3900
+ Meteor::Ml::Xhtml4::ParserImpl.new
3901
+ when Parser::HTML, Parser::HTML5
3834
3902
  Meteor::Ml::Html5::ParserImpl.new
3835
3903
  when Parser::XHTML5
3836
3904
  Meteor::Ml::Xhtml5::ParserImpl.new
@@ -3952,10 +4020,10 @@ module Meteor
3952
4020
  end
3953
4021
 
3954
4022
  module Ml
3955
- module Html
4023
+ module Html4
3956
4024
 
3957
4025
  #
3958
- # HTML parser (HTMLパーサ)
4026
+ # HTML4 parser (HTMLパーサ)
3959
4027
  #
3960
4028
  class ParserImpl < Meteor::Core::Kernel
3961
4029
 
@@ -4091,7 +4159,7 @@ module Meteor
4091
4159
  #
4092
4160
  def initialize(*args)
4093
4161
  super()
4094
- @doc_type = Parser::HTML
4162
+ @doc_type = Parser::HTML4
4095
4163
  case args.length
4096
4164
  when ZERO
4097
4165
  #initialize_0
@@ -4156,12 +4224,16 @@ module Meteor
4156
4224
  # analyze document , set content type (ドキュメントをパースし、コンテントタイプをセットする)
4157
4225
  #
4158
4226
  def analyze_content_type
4227
+ @error_check = false
4228
+
4159
4229
  element_3(META_S, HTTP_EQUIV, CONTENT_TYPE)
4160
4230
 
4161
4231
  if !@elm_
4162
4232
  element_3(META, HTTP_EQUIV, CONTENT_TYPE)
4163
4233
  end
4164
4234
 
4235
+ @error_check = true
4236
+
4165
4237
  if @elm_
4166
4238
  @root.content_type = @elm_.attr(CONTENT)
4167
4239
  else
@@ -4180,6 +4252,7 @@ module Meteor
4180
4252
  for a in KAIGYO_CODE
4181
4253
  if @root.document.include?(a)
4182
4254
  @root.kaigyo_code = a
4255
+ #puts "kaigyo:" << @root.kaigyo_code
4183
4256
  end
4184
4257
  end
4185
4258
 
@@ -4189,39 +4262,43 @@ module Meteor
4189
4262
 
4190
4263
  #
4191
4264
  # get element using tag name (要素のタグ名で検索し、要素を取得する)
4192
- # @param [String] tag tag name (タグ名)
4265
+ # @param [String] name tag name (タグ名)
4193
4266
  # @return [Meteor::Element] element (要素)
4194
4267
  #
4195
- def element_1(tag)
4196
- @_tag = Regexp.quote(tag)
4268
+ def element_1(name)
4269
+ @_name = Regexp.quote(name)
4197
4270
 
4198
4271
  #空要素の場合(<->内容あり要素の場合)
4199
- if is_match(@@match_tag, tag)
4272
+ if is_match(@@match_tag, name)
4200
4273
  #空要素検索用パターン
4201
- @pattern_cc = '' << TAG_OPEN << @_tag << TAG_SEARCH_1_4_2
4202
- #@pattern_cc = "<#{@_tag}(|\\s[^<>]*)>"
4274
+ @pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_1_4_2
4275
+ #@pattern_cc = "<#{@_name}(|\\s[^<>]*)>"
4203
4276
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
4204
4277
  @res = @pattern.match(@root.document)
4205
4278
  if @res
4206
- element_without_1(tag)
4279
+ element_without_1(name)
4207
4280
  else
4208
- puts Meteor::Exception::NoSuchElementException.new(tag).message
4281
+ if @error_check
4282
+ puts Meteor::Exception::NoSuchElementException.new(name).message
4283
+ end
4209
4284
  @elm_ = nil
4210
4285
  end
4211
4286
  else
4212
4287
  #内容あり要素検索用パターン
4213
- #@pattern_cc = '' << TAG_OPEN << @_tag << TAG_SEARCH_1_1 << tag
4214
- #@pattern_cc << TAG_SEARCH_1_2 << @_tag << TAG_CLOSE
4215
- @pattern_cc = "<#{tag}(|\\s[^<>]*)>(((?!(#{tag}[^<>]*>)).)*)<\\/#{tag}>"
4288
+ #@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_1_1 << @_name
4289
+ #@pattern_cc << TAG_SEARCH_1_2 << @_name << TAG_CLOSE
4290
+ @pattern_cc = "<#{@_name}(|\\s[^<>]*)>(((?!(#{tag}[^<>]*>)).)*)<\\/#{@_name}>"
4216
4291
 
4217
4292
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
4218
4293
  #内容あり要素検索
4219
4294
  @res = @pattern.match(@root.document)
4220
4295
  #内容あり要素の場合
4221
4296
  if @res
4222
- element_with_1(tag)
4297
+ element_with_1(name)
4223
4298
  else
4224
- puts Meteor::Exception::NoSuchElementException.new(tag).message
4299
+ if @error_check
4300
+ puts Meteor::Exception::NoSuchElementException.new(name).message
4301
+ end
4225
4302
  @elm_ = nil
4226
4303
  end
4227
4304
  end
@@ -4231,8 +4308,8 @@ module Meteor
4231
4308
 
4232
4309
  private :element_1
4233
4310
 
4234
- def element_without_1(tag)
4235
- @elm_ = Meteor::Element.new(tag)
4311
+ def element_without_1(name)
4312
+ @elm_ = Meteor::Element.new(name)
4236
4313
  #属性
4237
4314
  @elm_.attributes = @res[1]
4238
4315
  #空要素検索用パターン
@@ -4247,50 +4324,54 @@ module Meteor
4247
4324
 
4248
4325
  #
4249
4326
  # get element using tag name and attribute(name="value") (要素のタグ名、属性(属性名="属性値")で検索し、要素を取得する)
4250
- # @param [String] tag tag name (タグ名)
4327
+ # @param [String] name tag name (タグ名)
4251
4328
  # @param [String] attr_name attribute name (属性名)
4252
4329
  # @param [String] attr_value attribute value (属性値)
4253
4330
  # @return [Meteor::Element] element (要素)
4254
4331
  #
4255
- def element_3(tag, attr_name, attr_value)
4332
+ def element_3(name, attr_name, attr_value)
4256
4333
 
4257
- element_quote_3(tag, attr_name, attr_value)
4334
+ element_quote_3(name, attr_name, attr_value)
4258
4335
 
4259
4336
  #空要素の場合(<->内容あり要素の場合)
4260
- if is_match(@@match_tag, tag)
4337
+ if is_match(@@match_tag, name)
4261
4338
  #空要素検索パターン
4262
- #@pattern_cc = '' << TAG_OPEN << @_tag << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
4339
+ #@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
4263
4340
  #@pattern_cc << @_attr_value << TAG_SEARCH_2_4_3
4264
- @pattern_cc = "<#{@_tag}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>"
4341
+ @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>"
4265
4342
 
4266
4343
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
4267
4344
  #空要素検索
4268
4345
  @res = @pattern.match(@root.document)
4269
4346
  if @res
4270
- element_without_3(tag)
4347
+ element_without_3(name)
4271
4348
  else
4272
- puts Meteor::Exception::NoSuchElementException.new(tag, attr_name, attr_value).message
4349
+ if @error_check
4350
+ puts Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message
4351
+ end
4273
4352
  @elm_ = nil
4274
4353
  end
4275
4354
  else
4276
4355
  #内容あり要素検索パターン
4277
- #@pattern_cc = '' << TAG_OPEN << @_tag << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
4278
- #@pattern_cc << @_attr_value << TAG_SEARCH_2_2 << @_tag
4279
- #@pattern_cc << TAG_SEARCH_1_2 << @_tag << TAG_CLOSE
4280
- @pattern_cc = "<#{@_tag}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_tag}[^<>]*>)).)*)<\\/#{@_tag}>"
4356
+ #@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1 << @_attr_name << ATTR_EQ
4357
+ #@pattern_cc << @_attr_value << TAG_SEARCH_2_2 << @_name
4358
+ #@pattern_cc << TAG_SEARCH_1_2 << @_name << TAG_CLOSE
4359
+ @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
4281
4360
 
4282
4361
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
4283
4362
  #内容あり要素検索
4284
4363
  @res = @pattern.match(@root.document)
4285
4364
 
4286
- if !@res && !is_match(@@match_tag_sng, tag)
4365
+ if !@res && !is_match(@@match_tag_sng, name)
4287
4366
  @res = element_with_3_2
4288
4367
  end
4289
4368
 
4290
4369
  if @res
4291
- element_with_3_1(tag)
4370
+ element_with_3_1(name)
4292
4371
  else
4293
- puts Meteor::Exception::NoSuchElementException.new(tag, attr_name, attr_value).message
4372
+ if @error_check
4373
+ puts Meteor::Exception::NoSuchElementException.new(name, attr_name, attr_value).message
4374
+ end
4294
4375
  @elm_ = nil
4295
4376
  end
4296
4377
  end
@@ -4300,8 +4381,8 @@ module Meteor
4300
4381
 
4301
4382
  private :element_3
4302
4383
 
4303
- def element_without_3(tag)
4304
- element_without_3_1(tag, TAG_SEARCH_NC_2_4_3)
4384
+ def element_without_3(name)
4385
+ element_without_3_1(name, TAG_SEARCH_2_4_3)
4305
4386
  end
4306
4387
 
4307
4388
  private :element_without_3
@@ -4326,7 +4407,9 @@ module Meteor
4326
4407
  if @res
4327
4408
  element_3(@res[1], attr_name, attr_value)
4328
4409
  else
4329
- puts Meteor::Exception::NoSuchElementException.new(attr_name, attr_value).message
4410
+ if @error_check
4411
+ puts Meteor::Exception::NoSuchElementException.new(attr_name, attr_value).message
4412
+ end
4330
4413
  @elm_ = nil
4331
4414
  end
4332
4415
 
@@ -4337,46 +4420,48 @@ module Meteor
4337
4420
 
4338
4421
  #
4339
4422
  # get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で検索し、要素を取得する)
4340
- # @param [String] tag tag name (タグ名)
4423
+ # @param [String] name tag name (タグ名)
4341
4424
  # @param [String] attr_name1 attribute name1 (属性名1)
4342
4425
  # @param [String] attr_value1 attribute value1 (属性値1)
4343
4426
  # @param [String] attr_name2 attribute name2 (属性名2)
4344
4427
  # @param [String] attr_value2 attribute value2 (属性値2)
4345
4428
  # @return [Meteor::Element] element (要素)
4346
4429
  #
4347
- def element_5(tag, attr_name1, attr_value1, attr_name2, attr_value2)
4430
+ def element_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
4348
4431
 
4349
- element_quote_5(tag, attr_name1, attr_value1, attr_name2, attr_value2)
4432
+ element_quote_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
4350
4433
 
4351
4434
  #空要素の場合(<->内容あり要素の場合)
4352
- if is_match(@@match_tag, tag)
4435
+ if is_match(@@match_tag, name)
4353
4436
  #空要素検索パターン
4354
- #@pattern_cc = '' << TAG_OPEN << @_tag << TAG_SEARCH_2_1_2 << @_attr_name1 << ATTR_EQ
4437
+ #@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1_2 << @_attr_name1 << ATTR_EQ
4355
4438
  #@pattern_cc << @_attr_value1 << TAG_SEARCH_2_6 << @_attr_name2 << ATTR_EQ
4356
4439
  #@pattern_cc << @_attr_value2 << TAG_SEARCH_2_7 << @_attr_name2 << ATTR_EQ
4357
4440
  #@pattern_cc << @_attr_value2 << TAG_SEARCH_2_6 << @_attr_name1 << ATTR_EQ
4358
4441
  #@pattern_cc << @_attr_value1 << TAG_SEARCH_2_4_3_2
4359
- @pattern_cc = "<#{@_tag}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>"
4442
+ @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>"
4360
4443
 
4361
4444
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
4362
4445
  #空要素検索
4363
4446
  @res = @pattern.match(@root.document)
4364
4447
 
4365
4448
  if @res
4366
- element_without_5(tag)
4449
+ element_without_5(name)
4367
4450
  else
4368
- puts Meteor::Exception::NoSuchElementException.new(tag, attr_name1, attr_value1, attr_name2, attr_value2).message
4451
+ if @error_check
4452
+ puts Meteor::Exception::NoSuchElementException.new(name, attr_name1, attr_value1, attr_name2, attr_value2).message
4453
+ end
4369
4454
  @elm_ = nil
4370
4455
  end
4371
4456
  else
4372
4457
  #内容あり要素検索パターン
4373
- #@pattern_cc = '' << TAG_OPEN << @_tag << TAG_SEARCH_2_1_2 << @_attr_name1 << ATTR_EQ
4458
+ #@pattern_cc = '' << TAG_OPEN << @_name << TAG_SEARCH_2_1_2 << @_attr_name1 << ATTR_EQ
4374
4459
  #@pattern_cc << @_attr_value1 << TAG_SEARCH_2_6 << @_attr_name2 << ATTR_EQ
4375
4460
  #@pattern_cc << @_attr_value2 << TAG_SEARCH_2_7 << @_attr_name2 << ATTR_EQ
4376
4461
  #@pattern_cc << @_attr_value2 << TAG_SEARCH_2_6 << @_attr_name1 << ATTR_EQ
4377
- #@pattern_cc << @_attr_value1 << TAG_SEARCH_2_2_2 << @_tag
4378
- #@pattern_cc << TAG_SEARCH_1_2 << @_tag << TAG_CLOSE
4379
- @pattern_cc = "<#{@_tag}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_tag}[^<>]*>)).)*)<\\/#{@_tag}>"
4462
+ #@pattern_cc << @_attr_value1 << TAG_SEARCH_2_2_2 << @_name
4463
+ #@pattern_cc << TAG_SEARCH_1_2 << @_name << TAG_CLOSE
4464
+ @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
4380
4465
 
4381
4466
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
4382
4467
  #内容あり要素検索
@@ -4387,9 +4472,11 @@ module Meteor
4387
4472
  end
4388
4473
 
4389
4474
  if @res
4390
- element_with_5_1(tag)
4475
+ element_with_5_1(name)
4391
4476
  else
4392
- puts Meteor::Exception::NoSuchElementException.new(tag, attr_name1, attr_value1, attr_name2, attr_value2).message
4477
+ if @error_check
4478
+ puts Meteor::Exception::NoSuchElementException.new(name, attr_name1, attr_value1, attr_name2, attr_value2).message
4479
+ end
4393
4480
  @elm_ = nil
4394
4481
  end
4395
4482
  end
@@ -4399,8 +4486,8 @@ module Meteor
4399
4486
 
4400
4487
  private :element_5
4401
4488
 
4402
- def element_without_5(tag)
4403
- element_without_5_1(tag, TAG_SEARCH_NC_2_4_3_2)
4489
+ def element_without_5(name)
4490
+ element_without_5_1(name, TAG_SEARCH_2_4_3_2)
4404
4491
  end
4405
4492
 
4406
4493
  private :element_without_5
@@ -4432,7 +4519,9 @@ module Meteor
4432
4519
  if @res
4433
4520
  element_5(@res[1], attr_name1, attr_value1, attr_name2, attr_value2)
4434
4521
  else
4435
- puts Meteor::Exception::NoSuchElementException.new(attr_name1, attr_value1, attr_name2, attr_value2).message
4522
+ if @error_check
4523
+ puts Meteor::Exception::NoSuchElementException.new(attr_name1, attr_value1, attr_name2, attr_value2).message
4524
+ end
4436
4525
  @elm_ = nil
4437
4526
  end
4438
4527
 
@@ -4442,15 +4531,15 @@ module Meteor
4442
4531
  private :element_4
4443
4532
 
4444
4533
  def edit_attrs_(elm, attr_name, attr_value)
4445
- if is_match(SELECTED, attr_name) && is_match(OPTION, elm.tag)
4534
+ if is_match(SELECTED, attr_name) && is_match(OPTION, elm.name)
4446
4535
  edit_attrs_5(elm, attr_name, attr_value, @@pattern_selected_m, @@pattern_selected_r)
4447
- elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.tag)
4536
+ elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.name)
4448
4537
  edit_attrs_5(elm, attr_name, attr_value, @@pattern_multiple_m, @@pattern_multiple_r)
4449
- elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.tag)
4538
+ elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name)
4450
4539
  edit_attrs_5(elm, attr_name, attr_value, @@pattern_disabled_m, @@pattern_disabled_r)
4451
- elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.tag) && is_match(RADIO, get_type(elm))
4540
+ elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.name) && is_match(RADIO, get_type(elm))
4452
4541
  edit_attrs_5(elm, attr_name, attr_value, @@pattern_checked_m, @@pattern_checked_r)
4453
- elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.tag) || (is_match(INPUT, elm.tag) && is_match(READONLY_TYPE, get_type(elm))))
4542
+ elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.name) || (is_match(INPUT, elm.name) && is_match(READONLY_TYPE, get_type(elm))))
4454
4543
  edit_attrs_5(elm, attr_name, attr_value, @@pattern_readonly_m, @@pattern_readonly_r)
4455
4544
  else
4456
4545
  super(elm, attr_name, attr_value)
@@ -4488,15 +4577,15 @@ module Meteor
4488
4577
  private :edit_document_1
4489
4578
 
4490
4579
  def get_attr_value_(elm, attr_name)
4491
- if is_match(SELECTED, attr_name) && is_match(OPTION, elm.tag)
4580
+ if is_match(SELECTED, attr_name) && is_match(OPTION, elm.name)
4492
4581
  get_attr_value_r(elm, @@pattern_selected_m)
4493
- elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.tag)
4582
+ elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.name)
4494
4583
  get_attr_value_r(elm, @@pattern_multiple_m)
4495
- elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.tag)
4584
+ elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name)
4496
4585
  get_attr_value_r(elm, @@pattern_disabled_m)
4497
- elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.tag) && is_match(RADIO, get_type(elm))
4586
+ elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.name) && is_match(RADIO, get_type(elm))
4498
4587
  get_attr_value_r(elm, @@pattern_checked_m)
4499
- elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.tag) || (is_match(INPUT, elm.tag) && is_match(READONLY_TYPE, get_type(elm))))
4588
+ elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.name) || (is_match(INPUT, elm.name) && is_match(READONLY_TYPE, get_type(elm))))
4500
4589
  get_attr_value_r(elm, @@pattern_readonly_m)
4501
4590
  else
4502
4591
  super(elm, attr_name)
@@ -4592,7 +4681,7 @@ module Meteor
4592
4681
 
4593
4682
  def escape(content)
4594
4683
  #特殊文字の置換
4595
- content.gsub!(@@pattern_escape, TABLE_FOR_ESCAPE_)
4684
+ content = content.gsub(@@pattern_escape, TABLE_FOR_ESCAPE_)
4596
4685
 
4597
4686
  content
4598
4687
  end
@@ -4638,7 +4727,7 @@ module Meteor
4638
4727
  def unescape_content(content, elm)
4639
4728
  content_ = unescape(content)
4640
4729
 
4641
- if elm.cx || !is_match(@@match_tag_2, elm.tag)
4730
+ if elm.cx || !is_match(@@match_tag_2, elm.name)
4642
4731
  if content.include?(BR_2)
4643
4732
  #「<br>」->「¥r?¥n」
4644
4733
  content_.gsub!(@@pattern_br_2, @root.kaigyo_code)
@@ -4654,10 +4743,10 @@ module Meteor
4654
4743
 
4655
4744
  end
4656
4745
 
4657
- module Xhtml
4746
+ module Xhtml4
4658
4747
 
4659
4748
  #
4660
- # XHTML parser (XHTMLパーサ)
4749
+ # XHTML4 parser (XHTML4パーサ)
4661
4750
  #
4662
4751
  class ParserImpl < Meteor::Core::Kernel
4663
4752
 
@@ -4794,7 +4883,7 @@ module Meteor
4794
4883
  #
4795
4884
  def initialize(*args)
4796
4885
  super()
4797
- @doc_type = Parser::XHTML
4886
+ @doc_type = Parser::XHTML4
4798
4887
  case args.length
4799
4888
  when ZERO
4800
4889
  #initialize_0
@@ -4858,12 +4947,16 @@ module Meteor
4858
4947
  # analyze document , set content type (ドキュメントをパースし、コンテントタイプをセットする)
4859
4948
  #
4860
4949
  def analyze_content_type
4950
+ @error_check = false
4951
+
4861
4952
  element_3(META_S, HTTP_EQUIV, CONTENT_TYPE)
4862
4953
 
4863
4954
  if !@elm_
4864
4955
  element_3(META, HTTP_EQUIV, CONTENT_TYPE)
4865
4956
  end
4866
4957
 
4958
+ @error_check = true
4959
+
4867
4960
  if @elm_
4868
4961
  @root.content_type = @elm_.attr(CONTENT)
4869
4962
  else
@@ -4890,15 +4983,15 @@ module Meteor
4890
4983
 
4891
4984
  def edit_attrs_(elm, attr_name, attr_value)
4892
4985
 
4893
- if is_match(SELECTED, attr_name) && is_match(OPTION, elm.tag)
4986
+ if is_match(SELECTED, attr_name) && is_match(OPTION, elm.name)
4894
4987
  edit_attrs_5(elm, attr_value, @@pattern_selected_m, @@pattern_selected_r, SELECTED_U)
4895
- elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.tag)
4988
+ elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.name)
4896
4989
  edit_attrs_5(elm, attr_value, @@pattern_multiple_m, @@pattern_multiple_r, MULTIPLE_U)
4897
- elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.tag)
4990
+ elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name)
4898
4991
  edit_attrs_5(elm, attr_value, @@pattern_disabled_m, @@pattern_disabled_r, DISABLED_U)
4899
- elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.tag) && is_match(RADIO, get_type(elm))
4992
+ elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.name) && is_match(RADIO, get_type(elm))
4900
4993
  edit_attrs_5(elm, attr_value, @@pattern_checked_m, @@pattern_checked_r, CHECKED_U)
4901
- elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.tag) || (is_match(INPUT, elm.tag) && is_match(READONLY_TYPE, get_type(elm))))
4994
+ elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.name) || (is_match(INPUT, elm.name) && is_match(READONLY_TYPE, get_type(elm))))
4902
4995
  edit_attrs_5(elm, attr_value, @@pattern_readonly_m, @@pattern_readonly_r, READONLY_U)
4903
4996
  else
4904
4997
  super(elm, attr_name, attr_value)
@@ -4938,15 +5031,15 @@ module Meteor
4938
5031
  private :edit_attrs_5
4939
5032
 
4940
5033
  def get_attr_value_(elm, attr_name)
4941
- if is_match(SELECTED, attr_name) && is_match(OPTION, elm.tag)
5034
+ if is_match(SELECTED, attr_name) && is_match(OPTION, elm.name)
4942
5035
  get_attr_value_r(elm, attr_name, @@pattern_selected_m1)
4943
- elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.tag)
5036
+ elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.name)
4944
5037
  get_attr_value_r(elm, attr_name, @@pattern_multiple_m1)
4945
- elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.tag)
5038
+ elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name)
4946
5039
  get_attr_value_r(elm, attr_name, @@pattern_disabled_m1)
4947
- elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.tag) && is_match(RADIO, get_type(elm))
5040
+ elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.name) && is_match(RADIO, get_type(elm))
4948
5041
  get_attr_value_r(elm, attr_name, @@pattern_checked_m1)
4949
- elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.tag) || (is_match(INPUT, elm.tag) && is_match(READONLY_TYPE, get_type(elm))))
5042
+ elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.name) || (is_match(INPUT, elm.name) && is_match(READONLY_TYPE, get_type(elm))))
4950
5043
  get_attr_value_r(elm, attr_name, @@pattern_readonly_m1)
4951
5044
  else
4952
5045
  super(elm, attr_name)
@@ -5028,7 +5121,7 @@ module Meteor
5028
5121
 
5029
5122
  def escape(content)
5030
5123
  #特殊文字の置換
5031
- content.gsub!(@@pattern_escape, TABLE_FOR_ESCAPE_)
5124
+ content = content.gsub(@@pattern_escape, TABLE_FOR_ESCAPE_)
5032
5125
 
5033
5126
  content
5034
5127
  end
@@ -5074,7 +5167,7 @@ module Meteor
5074
5167
  def unescape_content(content, elm)
5075
5168
  content_ = unescape(content)
5076
5169
 
5077
- if (elm.cx || !is_match(@@match_tag_2, elm.tag)) && content.include?(BR_2)
5170
+ if (elm.cx || !is_match(@@match_tag_2, elm.name)) && content.include?(BR_2)
5078
5171
  #「<br>」->「¥r?¥n」
5079
5172
  content_.gsub!(@@pattern_br_2, @root.kaigyo_code)
5080
5173
  end
@@ -5093,7 +5186,7 @@ module Meteor
5093
5186
  #
5094
5187
  # HTML5 parser (HTML5パーサ)
5095
5188
  #
5096
- class ParserImpl < Meteor::Ml::Html::ParserImpl
5189
+ class ParserImpl < Meteor::Ml::Html4::ParserImpl
5097
5190
 
5098
5191
  CHARSET = 'charset'.freeze
5099
5192
  UTF8 = 'utf-8'.freeze
@@ -5164,12 +5257,16 @@ module Meteor
5164
5257
  # analyze document , set content type (ドキュメントをパースし、コンテントタイプをセットする)
5165
5258
  #
5166
5259
  def analyze_content_type
5260
+ @error_check = false
5261
+
5167
5262
  element_3(META_S, HTTP_EQUIV, CONTENT_TYPE)
5168
5263
 
5169
5264
  if !@elm_
5170
5265
  element_3(META, HTTP_EQUIV, CONTENT_TYPE)
5171
5266
  end
5172
5267
 
5268
+ @error_check = true
5269
+
5173
5270
  if @elm_
5174
5271
  @root.content_type = @elm_.attr(CONTENT)
5175
5272
  @root.charset = @elm_.attr(CHARSET)
@@ -5185,17 +5282,17 @@ module Meteor
5185
5282
  private :analyze_content_type
5186
5283
 
5187
5284
  def edit_attrs_(elm, attr_name, attr_value)
5188
- if is_match(SELECTED, attr_name) && is_match(OPTION, elm.tag)
5285
+ if is_match(SELECTED, attr_name) && is_match(OPTION, elm.name)
5189
5286
  edit_attrs_5(elm, attr_name, attr_value, @@pattern_selected_m, @@pattern_selected_r)
5190
- elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.tag)
5287
+ elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.name)
5191
5288
  edit_attrs_5(elm, attr_name, attr_value, @@pattern_multiple_m, @@pattern_multiple_r)
5192
- elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.tag)
5289
+ elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name)
5193
5290
  edit_attrs_5(elm, attr_name, attr_value, @@pattern_disabled_m, @@pattern_disabled_r)
5194
- elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.tag) && is_match(RADIO, get_type(elm))
5291
+ elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.name) && is_match(RADIO, get_type(elm))
5195
5292
  edit_attrs_5(elm, attr_name, attr_value, @@pattern_checked_m, @@pattern_checked_r)
5196
- elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.tag) || (is_match(INPUT, elm.tag) && is_match(READONLY_TYPE, get_type(elm))))
5293
+ elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.name) || (is_match(INPUT, elm.name) && is_match(READONLY_TYPE, get_type(elm))))
5197
5294
  edit_attrs_5(elm, attr_name, attr_value, @@pattern_readonly_m, @@pattern_readonly_r)
5198
- elsif is_match(REQUIRED, attr_name) && is_match(REQUIRE_ELEMENT, elm.tag)
5295
+ elsif is_match(REQUIRED, attr_name) && is_match(REQUIRE_ELEMENT, elm.name)
5199
5296
  edit_attrs_5(elm, attr_name, attr_value, @@pattern_required_m, @@pattern_required_r)
5200
5297
  else
5201
5298
  super(elm, attr_name, attr_value)
@@ -5205,17 +5302,17 @@ module Meteor
5205
5302
  private :edit_attrs_
5206
5303
 
5207
5304
  def get_attr_value_(elm, attr_name)
5208
- if is_match(SELECTED, attr_name) && is_match(OPTION, elm.tag)
5305
+ if is_match(SELECTED, attr_name) && is_match(OPTION, elm.name)
5209
5306
  get_attr_value_r(elm, @@pattern_selected_m)
5210
- elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.tag)
5307
+ elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.name)
5211
5308
  get_attr_value_r(elm, @@pattern_multiple_m)
5212
- elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.tag)
5309
+ elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name)
5213
5310
  get_attr_value_r(elm, @@pattern_disabled_m)
5214
- elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.tag) && is_match(RADIO, get_type(elm))
5311
+ elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.name) && is_match(RADIO, get_type(elm))
5215
5312
  get_attr_value_r(elm, @@pattern_checked_m)
5216
- elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.tag) || (is_match(INPUT, elm.tag) && is_match(READONLY_TYPE, get_type(elm))))
5313
+ elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.name) || (is_match(INPUT, elm.name) && is_match(READONLY_TYPE, get_type(elm))))
5217
5314
  get_attr_value_r(elm, @@pattern_readonly_m)
5218
- elsif is_match(REQUIRED, attr_name) && is_match(REQUIRE_ELEMENT, elm.tag)
5315
+ elsif is_match(REQUIRED, attr_name) && is_match(REQUIRE_ELEMENT, elm.name)
5219
5316
  get_attr_value_r(elm, @@pattern_required_m)
5220
5317
  else
5221
5318
  super(elm, attr_name)
@@ -5233,7 +5330,7 @@ module Meteor
5233
5330
  #
5234
5331
  # XHTML5 parser (XHTML5パーサ)
5235
5332
  #
5236
- class ParserImpl < Meteor::Ml::Xhtml::ParserImpl
5333
+ class ParserImpl < Meteor::Ml::Xhtml4::ParserImpl
5237
5334
 
5238
5335
  CHARSET = 'charset'.freeze
5239
5336
  UTF8 = 'utf-8'.freeze
@@ -5300,12 +5397,16 @@ module Meteor
5300
5397
  # analyze document , set content type (ドキュメントをパースし、コンテントタイプをセットする)
5301
5398
  #
5302
5399
  def analyze_content_type
5400
+ @error_check = false
5401
+
5303
5402
  element_3(META_S, HTTP_EQUIV, CONTENT_TYPE)
5304
5403
 
5305
5404
  if !@elm_
5306
5405
  element_3(META, HTTP_EQUIV, CONTENT_TYPE)
5307
5406
  end
5308
5407
 
5408
+ @error_check = true
5409
+
5309
5410
  if @elm_
5310
5411
  @root.content_type = @elm_.attr(CONTENT)
5311
5412
  @root.charset = @elm_.attr(CHARSET)
@@ -5322,17 +5423,17 @@ module Meteor
5322
5423
 
5323
5424
  def edit_attrs_(elm, attr_name, attr_value)
5324
5425
 
5325
- if is_match(SELECTED, attr_name) && is_match(OPTION, elm.tag)
5426
+ if is_match(SELECTED, attr_name) && is_match(OPTION, elm.name)
5326
5427
  edit_attrs_5(elm, attr_value, @@pattern_selected_m, @@pattern_selected_r, SELECTED_U)
5327
- elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.tag)
5428
+ elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.name)
5328
5429
  edit_attrs_5(elm, attr_value, @@pattern_multiple_m, @@pattern_multiple_r, MULTIPLE_U)
5329
- elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.tag)
5430
+ elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name)
5330
5431
  edit_attrs_5(elm, attr_value, @@pattern_disabled_m, @@pattern_disabled_r, DISABLED_U)
5331
- elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.tag) && is_match(RADIO, get_type(elm))
5432
+ elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.name) && is_match(RADIO, get_type(elm))
5332
5433
  edit_attrs_5(elm, attr_value, @@pattern_checked_m, @@pattern_checked_r, CHECKED_U)
5333
- elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.tag) || (is_match(INPUT, elm.tag) && is_match(READONLY_TYPE, get_type(elm))))
5434
+ elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.name) || (is_match(INPUT, elm.name) && is_match(READONLY_TYPE, get_type(elm))))
5334
5435
  edit_attrs_5(elm, attr_value, @@pattern_readonly_m, @@pattern_readonly_r, READONLY_U)
5335
- elsif is_match(REQUIRED, attr_name) && is_match(REQUIRE_ELEMENT, elm.tag)
5436
+ elsif is_match(REQUIRED, attr_name) && is_match(REQUIRE_ELEMENT, elm.name)
5336
5437
  edit_attrs_5(elm, attr_value, @@pattern_required_m, @@pattern_required_r, REQUIRED_U)
5337
5438
  else
5338
5439
  super(elm, attr_name, attr_value)
@@ -5343,17 +5444,17 @@ module Meteor
5343
5444
  private :edit_attrs_
5344
5445
 
5345
5446
  def get_attr_value_(elm, attr_name)
5346
- if is_match(SELECTED, attr_name) && is_match(OPTION, elm.tag)
5447
+ if is_match(SELECTED, attr_name) && is_match(OPTION, elm.name)
5347
5448
  get_attr_value_r(elm, attr_name, @@pattern_selected_m1)
5348
- elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.tag)
5449
+ elsif is_match(MULTIPLE, attr_name) && is_match(SELECT, elm.name)
5349
5450
  get_attr_value_r(elm, attr_name, @@pattern_multiple_m1)
5350
- elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.tag)
5451
+ elsif is_match(DISABLED, attr_name) && is_match(DISABLE_ELEMENT, elm.name)
5351
5452
  get_attr_value_r(elm, attr_name, @@pattern_disabled_m1)
5352
- elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.tag) && is_match(RADIO, get_type(elm))
5453
+ elsif is_match(CHECKED, attr_name) && is_match(INPUT, elm.name) && is_match(RADIO, get_type(elm))
5353
5454
  get_attr_value_r(elm, attr_name, @@pattern_checked_m1)
5354
- elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.tag) || (is_match(INPUT, elm.tag) && is_match(READONLY_TYPE, get_type(elm))))
5455
+ elsif is_match(READONLY, attr_name) && (is_match(TEXTAREA, elm.name) || (is_match(INPUT, elm.name) && is_match(READONLY_TYPE, get_type(elm))))
5355
5456
  get_attr_value_r(elm, attr_name, @@pattern_readonly_m1)
5356
- elsif is_match(REQUIRED, attr_name) && is_match(REQUIRE_ELEMENT, elm.tag)
5457
+ elsif is_match(REQUIRED, attr_name) && is_match(REQUIRE_ELEMENT, elm.name)
5357
5458
  get_attr_value_r(elm, attr_name, @@pattern_required_m1)
5358
5459
  else
5359
5460
  super(elm, attr_name)
@@ -5373,6 +5474,9 @@ module Meteor
5373
5474
  #
5374
5475
  class ParserImpl < Meteor::Core::Kernel
5375
5476
 
5477
+ #KAIGYO_CODE = "\r?\n|\r".freeze
5478
+ KAIGYO_CODE = ["\r\n".freeze, "\n".freeze, "\r".freeze]
5479
+
5376
5480
  PATTERN_UNESCAPE = '&(amp|quot|apos|gt|lt);'.freeze
5377
5481
 
5378
5482
  @@pattern_unescape = Regexp.new(PATTERN_UNESCAPE)
@@ -5427,13 +5531,50 @@ module Meteor
5427
5531
 
5428
5532
  private :initialize_1
5429
5533
 
5534
+
5535
+ #
5536
+ # parse document (ドキュメントを解析する)
5537
+ #
5538
+ def parse
5539
+ analyze_ml
5540
+ end
5541
+
5542
+ #
5543
+ # analyze document (ドキュメントをパースする)
5544
+ #
5545
+ def analyze_ml
5546
+ #改行コードの取得
5547
+ analyze_kaigyo_code
5548
+
5549
+ @res = nil
5550
+ end
5551
+
5552
+ private :analyze_ml
5553
+
5554
+ #
5430
5555
  # get content type (コンテントタイプを取得する)
5431
- # @return [Streing] content type (コンテントタイプ)
5556
+ # @return [String] conent type (コンテントタイプ)
5432
5557
  #
5433
5558
  def content_type
5434
5559
  @root.content_type
5435
5560
  end
5436
5561
 
5562
+ #
5563
+ # analuze document , set newline (ドキュメントをパースし、改行コードをセットする)
5564
+ #
5565
+ def analyze_kaigyo_code
5566
+ #改行コード取得
5567
+
5568
+ for a in KAIGYO_CODE
5569
+ if @root.document.include?(a)
5570
+ @root.kaigyo_code = a
5571
+ #puts "kaigyo:" << @root.kaigyo_code
5572
+ end
5573
+ end
5574
+
5575
+ end
5576
+
5577
+ private :analyze_kaigyo_code
5437
5578
 
5438
5579
  def escape(content)
5439
5580
  #特殊文字の置換