active_cached_resource 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (316) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/LICENSE +21 -0
  4. data/lib/active_cached_resource/caching.rb +104 -1
  5. data/lib/active_cached_resource/configuration.rb +22 -1
  6. data/lib/active_cached_resource/logger.rb +14 -0
  7. data/lib/active_cached_resource/model.rb +18 -0
  8. data/lib/active_cached_resource/version.rb +1 -8
  9. metadata +2 -308
  10. data/.rspec +0 -3
  11. data/.rubocop.yml +0 -23
  12. data/.standard.yml +0 -2
  13. data/Rakefile +0 -29
  14. data/example/consumer/.dockerignore +0 -41
  15. data/example/consumer/.gitattributes +0 -9
  16. data/example/consumer/.gitignore +0 -36
  17. data/example/consumer/.kamal/hooks/docker-setup.sample +0 -3
  18. data/example/consumer/.kamal/hooks/post-deploy.sample +0 -14
  19. data/example/consumer/.kamal/hooks/post-proxy-reboot.sample +0 -3
  20. data/example/consumer/.kamal/hooks/pre-build.sample +0 -51
  21. data/example/consumer/.kamal/hooks/pre-connect.sample +0 -47
  22. data/example/consumer/.kamal/hooks/pre-deploy.sample +0 -109
  23. data/example/consumer/.kamal/hooks/pre-proxy-reboot.sample +0 -3
  24. data/example/consumer/.kamal/secrets +0 -17
  25. data/example/consumer/Dockerfile +0 -65
  26. data/example/consumer/Gemfile +0 -17
  27. data/example/consumer/Rakefile +0 -6
  28. data/example/consumer/app/controllers/application_controller.rb +0 -2
  29. data/example/consumer/app/controllers/concerns/.keep +0 -0
  30. data/example/consumer/app/jobs/application_job.rb +0 -7
  31. data/example/consumer/app/mailers/application_mailer.rb +0 -4
  32. data/example/consumer/app/models/application_record.rb +0 -3
  33. data/example/consumer/app/models/concerns/.keep +0 -0
  34. data/example/consumer/app/models/person.rb +0 -9
  35. data/example/consumer/app/views/layouts/mailer.html.erb +0 -13
  36. data/example/consumer/app/views/layouts/mailer.text.erb +0 -1
  37. data/example/consumer/bin/brakeman +0 -7
  38. data/example/consumer/bin/bundle +0 -109
  39. data/example/consumer/bin/dev +0 -2
  40. data/example/consumer/bin/docker-entrypoint +0 -14
  41. data/example/consumer/bin/jobs +0 -6
  42. data/example/consumer/bin/kamal +0 -27
  43. data/example/consumer/bin/rails +0 -4
  44. data/example/consumer/bin/rake +0 -4
  45. data/example/consumer/bin/rubocop +0 -8
  46. data/example/consumer/bin/setup +0 -34
  47. data/example/consumer/bin/thrust +0 -5
  48. data/example/consumer/config/application.rb +0 -20
  49. data/example/consumer/config/boot.rb +0 -3
  50. data/example/consumer/config/cache.yml +0 -16
  51. data/example/consumer/config/credentials.yml.enc +0 -1
  52. data/example/consumer/config/database.yml +0 -14
  53. data/example/consumer/config/deploy.yml +0 -116
  54. data/example/consumer/config/environment.rb +0 -5
  55. data/example/consumer/config/environments/development.rb +0 -64
  56. data/example/consumer/config/environments/production.rb +0 -85
  57. data/example/consumer/config/environments/test.rb +0 -50
  58. data/example/consumer/config/initializers/cors.rb +0 -16
  59. data/example/consumer/config/initializers/filter_parameter_logging.rb +0 -8
  60. data/example/consumer/config/initializers/inflections.rb +0 -16
  61. data/example/consumer/config/locales/en.yml +0 -31
  62. data/example/consumer/config/puma.rb +0 -41
  63. data/example/consumer/config/queue.yml +0 -18
  64. data/example/consumer/config/recurring.yml +0 -10
  65. data/example/consumer/config/routes.rb +0 -10
  66. data/example/consumer/config.ru +0 -6
  67. data/example/consumer/db/cache_schema.rb +0 -14
  68. data/example/consumer/db/queue_schema.rb +0 -129
  69. data/example/consumer/db/seeds.rb +0 -0
  70. data/example/consumer/lib/tasks/.keep +0 -0
  71. data/example/consumer/log/.keep +0 -0
  72. data/example/consumer/public/robots.txt +0 -1
  73. data/example/consumer/script/.keep +0 -0
  74. data/example/consumer/storage/.keep +0 -0
  75. data/example/consumer/tmp/.keep +0 -0
  76. data/example/consumer/tmp/cache/.keep +0 -0
  77. data/example/consumer/tmp/pids/.keep +0 -0
  78. data/example/consumer/tmp/storage/.keep +0 -0
  79. data/example/consumer/vendor/.keep +0 -0
  80. data/example/provider/.dockerignore +0 -41
  81. data/example/provider/.gitattributes +0 -9
  82. data/example/provider/.gitignore +0 -32
  83. data/example/provider/.kamal/hooks/docker-setup.sample +0 -3
  84. data/example/provider/.kamal/hooks/post-deploy.sample +0 -14
  85. data/example/provider/.kamal/hooks/post-proxy-reboot.sample +0 -3
  86. data/example/provider/.kamal/hooks/pre-build.sample +0 -51
  87. data/example/provider/.kamal/hooks/pre-connect.sample +0 -47
  88. data/example/provider/.kamal/hooks/pre-deploy.sample +0 -109
  89. data/example/provider/.kamal/hooks/pre-proxy-reboot.sample +0 -3
  90. data/example/provider/.kamal/secrets +0 -17
  91. data/example/provider/Dockerfile +0 -65
  92. data/example/provider/Gemfile +0 -14
  93. data/example/provider/Rakefile +0 -6
  94. data/example/provider/app/controllers/application_controller.rb +0 -2
  95. data/example/provider/app/controllers/concerns/.keep +0 -0
  96. data/example/provider/app/controllers/people_controller.rb +0 -68
  97. data/example/provider/app/jobs/application_job.rb +0 -7
  98. data/example/provider/app/mailers/application_mailer.rb +0 -4
  99. data/example/provider/app/models/address.rb +0 -3
  100. data/example/provider/app/models/application_record.rb +0 -3
  101. data/example/provider/app/models/company.rb +0 -3
  102. data/example/provider/app/models/concerns/.keep +0 -0
  103. data/example/provider/app/models/person.rb +0 -6
  104. data/example/provider/app/views/layouts/mailer.html.erb +0 -13
  105. data/example/provider/app/views/layouts/mailer.text.erb +0 -1
  106. data/example/provider/bin/brakeman +0 -7
  107. data/example/provider/bin/bundle +0 -109
  108. data/example/provider/bin/dev +0 -2
  109. data/example/provider/bin/docker-entrypoint +0 -14
  110. data/example/provider/bin/jobs +0 -6
  111. data/example/provider/bin/kamal +0 -27
  112. data/example/provider/bin/rails +0 -4
  113. data/example/provider/bin/rake +0 -4
  114. data/example/provider/bin/rubocop +0 -8
  115. data/example/provider/bin/setup +0 -34
  116. data/example/provider/bin/thrust +0 -5
  117. data/example/provider/config/application.rb +0 -44
  118. data/example/provider/config/boot.rb +0 -3
  119. data/example/provider/config/cache.yml +0 -16
  120. data/example/provider/config/credentials.yml.enc +0 -1
  121. data/example/provider/config/database.yml +0 -20
  122. data/example/provider/config/deploy.yml +0 -116
  123. data/example/provider/config/environment.rb +0 -5
  124. data/example/provider/config/environments/development.rb +0 -64
  125. data/example/provider/config/environments/production.rb +0 -85
  126. data/example/provider/config/environments/test.rb +0 -50
  127. data/example/provider/config/initializers/cors.rb +0 -16
  128. data/example/provider/config/initializers/filter_parameter_logging.rb +0 -8
  129. data/example/provider/config/initializers/inflections.rb +0 -16
  130. data/example/provider/config/locales/en.yml +0 -31
  131. data/example/provider/config/puma.rb +0 -41
  132. data/example/provider/config/queue.yml +0 -18
  133. data/example/provider/config/recurring.yml +0 -10
  134. data/example/provider/config/routes.rb +0 -4
  135. data/example/provider/config.ru +0 -6
  136. data/example/provider/db/cache_schema.rb +0 -14
  137. data/example/provider/db/migrate/20241202183937_create_people.rb +0 -11
  138. data/example/provider/db/migrate/20241202183955_create_addresses.rb +0 -13
  139. data/example/provider/db/migrate/20241202184017_create_companies.rb +0 -14
  140. data/example/provider/db/queue_schema.rb +0 -129
  141. data/example/provider/db/schema.rb +0 -47
  142. data/example/provider/db/seeds.rb +0 -18
  143. data/example/provider/lib/tasks/.keep +0 -0
  144. data/example/provider/log/.keep +0 -0
  145. data/example/provider/public/robots.txt +0 -1
  146. data/example/provider/script/.keep +0 -0
  147. data/example/provider/storage/.keep +0 -0
  148. data/example/provider/tmp/.keep +0 -0
  149. data/example/provider/tmp/pids/.keep +0 -0
  150. data/example/provider/tmp/storage/.keep +0 -0
  151. data/example/provider/vendor/.keep +0 -0
  152. data/lib/activeresource/.gitignore +0 -15
  153. data/lib/activeresource/examples/performance.rb +0 -72
  154. data/lib/activeresource/test/abstract_unit.rb +0 -154
  155. data/lib/activeresource/test/cases/active_job_serializer_test.rb +0 -53
  156. data/lib/activeresource/test/cases/association_test.rb +0 -104
  157. data/lib/activeresource/test/cases/associations/builder/belongs_to_test.rb +0 -42
  158. data/lib/activeresource/test/cases/associations/builder/has_many_test.rb +0 -28
  159. data/lib/activeresource/test/cases/associations/builder/has_one_test.rb +0 -28
  160. data/lib/activeresource/test/cases/authorization_test.rb +0 -276
  161. data/lib/activeresource/test/cases/base/custom_methods_test.rb +0 -155
  162. data/lib/activeresource/test/cases/base/equality_test.rb +0 -53
  163. data/lib/activeresource/test/cases/base/load_test.rb +0 -249
  164. data/lib/activeresource/test/cases/base/schema_test.rb +0 -428
  165. data/lib/activeresource/test/cases/base_errors_test.rb +0 -129
  166. data/lib/activeresource/test/cases/base_test.rb +0 -1622
  167. data/lib/activeresource/test/cases/callbacks_test.rb +0 -155
  168. data/lib/activeresource/test/cases/collection_test.rb +0 -196
  169. data/lib/activeresource/test/cases/connection_test.rb +0 -357
  170. data/lib/activeresource/test/cases/finder_test.rb +0 -217
  171. data/lib/activeresource/test/cases/format_test.rb +0 -137
  172. data/lib/activeresource/test/cases/http_mock_test.rb +0 -213
  173. data/lib/activeresource/test/cases/inheritence_test.rb +0 -19
  174. data/lib/activeresource/test/cases/inheriting_hash_test.rb +0 -25
  175. data/lib/activeresource/test/cases/log_subscriber_test.rb +0 -64
  176. data/lib/activeresource/test/cases/reflection_test.rb +0 -65
  177. data/lib/activeresource/test/cases/validations_test.rb +0 -78
  178. data/lib/activeresource/test/fixtures/address.rb +0 -20
  179. data/lib/activeresource/test/fixtures/beast.rb +0 -16
  180. data/lib/activeresource/test/fixtures/comment.rb +0 -5
  181. data/lib/activeresource/test/fixtures/customer.rb +0 -5
  182. data/lib/activeresource/test/fixtures/fixtures.rbi +0 -46
  183. data/lib/activeresource/test/fixtures/inventory.rb +0 -14
  184. data/lib/activeresource/test/fixtures/person.rb +0 -15
  185. data/lib/activeresource/test/fixtures/pet.rb +0 -6
  186. data/lib/activeresource/test/fixtures/post.rb +0 -5
  187. data/lib/activeresource/test/fixtures/product.rb +0 -11
  188. data/lib/activeresource/test/fixtures/project.rb +0 -19
  189. data/lib/activeresource/test/fixtures/proxy.rb +0 -6
  190. data/lib/activeresource/test/fixtures/sound.rb +0 -11
  191. data/lib/activeresource/test/fixtures/street_address.rb +0 -6
  192. data/lib/activeresource/test/fixtures/subscription_plan.rb +0 -7
  193. data/lib/activeresource/test/fixtures/weather.rb +0 -21
  194. data/lib/activeresource/test/setter_trap.rb +0 -28
  195. data/lib/activeresource/test/singleton_test.rb +0 -138
  196. data/lib/activeresource/test/threadsafe_attributes_test.rb +0 -91
  197. data/sorbet/config +0 -6
  198. data/sorbet/rbi/annotations/.gitattributes +0 -1
  199. data/sorbet/rbi/annotations/activemodel.rbi +0 -89
  200. data/sorbet/rbi/annotations/activesupport.rbi +0 -457
  201. data/sorbet/rbi/annotations/minitest.rbi +0 -119
  202. data/sorbet/rbi/annotations/rainbow.rbi +0 -269
  203. data/sorbet/rbi/dsl/.gitattributes +0 -1
  204. data/sorbet/rbi/dsl/active_support/callbacks.rbi +0 -21
  205. data/sorbet/rbi/gems/.gitattributes +0 -1
  206. data/sorbet/rbi/gems/actioncable@8.0.1.rbi +0 -252
  207. data/sorbet/rbi/gems/actionmailbox@8.0.1.rbi +0 -9
  208. data/sorbet/rbi/gems/actionmailer@8.0.1.rbi +0 -9
  209. data/sorbet/rbi/gems/actionpack@8.0.1.rbi +0 -21111
  210. data/sorbet/rbi/gems/actiontext@8.0.1.rbi +0 -9
  211. data/sorbet/rbi/gems/actionview@8.0.1.rbi +0 -16409
  212. data/sorbet/rbi/gems/activejob@8.0.1.rbi +0 -90
  213. data/sorbet/rbi/gems/activemodel-serializers-xml@1.0.3.rbi +0 -166
  214. data/sorbet/rbi/gems/activemodel@8.0.1.rbi +0 -6865
  215. data/sorbet/rbi/gems/activerecord@8.0.1.rbi +0 -43277
  216. data/sorbet/rbi/gems/activestorage@8.0.1.rbi +0 -9
  217. data/sorbet/rbi/gems/activesupport@8.0.1.rbi +0 -21426
  218. data/sorbet/rbi/gems/ast@2.4.2.rbi +0 -585
  219. data/sorbet/rbi/gems/base64@0.2.0.rbi +0 -509
  220. data/sorbet/rbi/gems/benchmark@0.4.0.rbi +0 -618
  221. data/sorbet/rbi/gems/bigdecimal@3.1.8.rbi +0 -78
  222. data/sorbet/rbi/gems/builder@3.3.0.rbi +0 -9
  223. data/sorbet/rbi/gems/bump@0.10.0.rbi +0 -169
  224. data/sorbet/rbi/gems/byebug@11.1.3.rbi +0 -3607
  225. data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -3427
  226. data/sorbet/rbi/gems/concurrent-ruby@1.3.4.rbi +0 -11645
  227. data/sorbet/rbi/gems/connection_pool@2.4.1.rbi +0 -9
  228. data/sorbet/rbi/gems/crass@1.0.6.rbi +0 -623
  229. data/sorbet/rbi/gems/date@3.4.1.rbi +0 -75
  230. data/sorbet/rbi/gems/diff-lcs@1.5.1.rbi +0 -1131
  231. data/sorbet/rbi/gems/docile@1.4.1.rbi +0 -377
  232. data/sorbet/rbi/gems/drb@2.2.1.rbi +0 -1347
  233. data/sorbet/rbi/gems/erubi@1.13.0.rbi +0 -150
  234. data/sorbet/rbi/gems/globalid@1.2.1.rbi +0 -9
  235. data/sorbet/rbi/gems/i18n@1.14.6.rbi +0 -2359
  236. data/sorbet/rbi/gems/io-console@0.8.0.rbi +0 -9
  237. data/sorbet/rbi/gems/json@2.9.0.rbi +0 -1944
  238. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +0 -14238
  239. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +0 -240
  240. data/sorbet/rbi/gems/logger@1.6.3.rbi +0 -940
  241. data/sorbet/rbi/gems/loofah@2.23.1.rbi +0 -1081
  242. data/sorbet/rbi/gems/mail@2.8.1.rbi +0 -9
  243. data/sorbet/rbi/gems/marcel@1.0.4.rbi +0 -9
  244. data/sorbet/rbi/gems/method_source@1.1.0.rbi +0 -304
  245. data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +0 -9
  246. data/sorbet/rbi/gems/minitest@5.25.4.rbi +0 -1547
  247. data/sorbet/rbi/gems/mocha@2.7.1.rbi +0 -12
  248. data/sorbet/rbi/gems/msgpack@1.7.5.rbi +0 -320
  249. data/sorbet/rbi/gems/net-imap@0.5.2.rbi +0 -9
  250. data/sorbet/rbi/gems/net-pop@0.1.2.rbi +0 -9
  251. data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +0 -292
  252. data/sorbet/rbi/gems/net-smtp@0.5.0.rbi +0 -9
  253. data/sorbet/rbi/gems/netrc@0.11.0.rbi +0 -159
  254. data/sorbet/rbi/gems/nio4r@2.7.4.rbi +0 -9
  255. data/sorbet/rbi/gems/nokogiri@1.17.2.rbi +0 -8201
  256. data/sorbet/rbi/gems/parallel@1.26.3.rbi +0 -291
  257. data/sorbet/rbi/gems/parser@3.3.6.0.rbi +0 -5519
  258. data/sorbet/rbi/gems/prism@1.2.0.rbi +0 -39085
  259. data/sorbet/rbi/gems/pry-byebug@3.10.1.rbi +0 -1151
  260. data/sorbet/rbi/gems/pry@0.14.2.rbi +0 -10076
  261. data/sorbet/rbi/gems/psych@5.2.1.rbi +0 -1785
  262. data/sorbet/rbi/gems/racc@1.8.1.rbi +0 -162
  263. data/sorbet/rbi/gems/rack-session@2.0.0.rbi +0 -727
  264. data/sorbet/rbi/gems/rack-test@2.1.0.rbi +0 -747
  265. data/sorbet/rbi/gems/rack@3.1.8.rbi +0 -4905
  266. data/sorbet/rbi/gems/rackup@2.2.1.rbi +0 -230
  267. data/sorbet/rbi/gems/rails-dom-testing@2.2.0.rbi +0 -758
  268. data/sorbet/rbi/gems/rails-html-sanitizer@1.6.2.rbi +0 -785
  269. data/sorbet/rbi/gems/rails@8.0.1.rbi +0 -9
  270. data/sorbet/rbi/gems/railties@8.0.1.rbi +0 -6347
  271. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +0 -403
  272. data/sorbet/rbi/gems/rake@13.2.1.rbi +0 -3028
  273. data/sorbet/rbi/gems/rbi@0.2.1.rbi +0 -4535
  274. data/sorbet/rbi/gems/rdoc@6.9.1.rbi +0 -12593
  275. data/sorbet/rbi/gems/regexp_parser@2.9.3.rbi +0 -3772
  276. data/sorbet/rbi/gems/reline@0.6.0.rbi +0 -2454
  277. data/sorbet/rbi/gems/rexml@3.4.0.rbi +0 -4871
  278. data/sorbet/rbi/gems/rspec-core@3.13.2.rbi +0 -11284
  279. data/sorbet/rbi/gems/rspec-expectations@3.13.3.rbi +0 -8183
  280. data/sorbet/rbi/gems/rspec-mocks@3.13.2.rbi +0 -5341
  281. data/sorbet/rbi/gems/rspec-support@3.13.2.rbi +0 -1630
  282. data/sorbet/rbi/gems/rspec@3.13.0.rbi +0 -83
  283. data/sorbet/rbi/gems/rubocop-ast@1.37.0.rbi +0 -7713
  284. data/sorbet/rbi/gems/rubocop-md@1.2.4.rbi +0 -123
  285. data/sorbet/rbi/gems/rubocop-minitest@0.36.0.rbi +0 -2613
  286. data/sorbet/rbi/gems/rubocop-packaging@0.5.2.rbi +0 -388
  287. data/sorbet/rbi/gems/rubocop-performance@1.23.0.rbi +0 -9
  288. data/sorbet/rbi/gems/rubocop-rails@2.27.0.rbi +0 -9535
  289. data/sorbet/rbi/gems/rubocop@1.69.2.rbi +0 -59600
  290. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +0 -1318
  291. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +0 -9
  292. data/sorbet/rbi/gems/securerandom@0.4.1.rbi +0 -78
  293. data/sorbet/rbi/gems/simplecov-html@0.13.1.rbi +0 -225
  294. data/sorbet/rbi/gems/simplecov@0.22.0.rbi +0 -2149
  295. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +0 -9
  296. data/sorbet/rbi/gems/spoom@1.5.0.rbi +0 -4932
  297. data/sorbet/rbi/gems/sqlite3@2.3.1.rbi +0 -1824
  298. data/sorbet/rbi/gems/standard-custom@1.0.2.rbi +0 -9
  299. data/sorbet/rbi/gems/standard-performance@1.6.0.rbi +0 -9
  300. data/sorbet/rbi/gems/standard@1.43.0.rbi +0 -926
  301. data/sorbet/rbi/gems/stringio@3.1.2.rbi +0 -9
  302. data/sorbet/rbi/gems/tapioca@0.16.4.rbi +0 -3597
  303. data/sorbet/rbi/gems/thor@1.3.2.rbi +0 -4378
  304. data/sorbet/rbi/gems/timeout@0.4.2.rbi +0 -151
  305. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +0 -5918
  306. data/sorbet/rbi/gems/unicode-display_width@3.1.2.rbi +0 -130
  307. data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +0 -251
  308. data/sorbet/rbi/gems/uri@1.0.2.rbi +0 -2377
  309. data/sorbet/rbi/gems/useragent@0.16.11.rbi +0 -9
  310. data/sorbet/rbi/gems/websocket-driver@0.7.6.rbi +0 -9
  311. data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +0 -9
  312. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +0 -435
  313. data/sorbet/rbi/gems/yard@0.9.37.rbi +0 -18504
  314. data/sorbet/rbi/gems/zeitwerk@2.7.1.rbi +0 -9
  315. data/sorbet/tapioca/config.yml +0 -13
  316. data/sorbet/tapioca/require.rb +0 -13
@@ -1,4871 +0,0 @@
1
- # typed: false
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `rexml` gem.
5
- # Please instead update this file by running `bin/tapioca gem rexml`.
6
-
7
-
8
- # This class needs:
9
- # * Documentation
10
- # * Work! Not all types of attlists are intelligently parsed, so we just
11
- # spew back out what we get in. This works, but it would be better if
12
- # we formatted the output ourselves.
13
- #
14
- # AttlistDecls provide *just* enough support to allow namespace
15
- # declarations. If you need some sort of generalized support, or have an
16
- # interesting idea about how to map the hideous, terrible design of DTD
17
- # AttlistDecls onto an intuitive Ruby interface, let me know. I'm desperate
18
- # for anything to make DTDs more palateable.
19
- #
20
- # source://rexml//lib/rexml/attlistdecl.rb#18
21
- class REXML::AttlistDecl < ::REXML::Child
22
- include ::Enumerable
23
-
24
- # Create an AttlistDecl, pulling the information from a Source. Notice
25
- # that this isn't very convenient; to create an AttlistDecl, you basically
26
- # have to format it yourself, and then have the initializer parse it.
27
- # Sorry, but for the foreseeable future, DTD support in REXML is pretty
28
- # weak on convenience. Have I mentioned how much I hate DTDs?
29
- #
30
- # @return [AttlistDecl] a new instance of AttlistDecl
31
- #
32
- # source://rexml//lib/rexml/attlistdecl.rb#29
33
- def initialize(source); end
34
-
35
- # Access the attlist attribute/value pairs.
36
- # value = attlist_decl[ attribute_name ]
37
- #
38
- # source://rexml//lib/rexml/attlistdecl.rb#38
39
- def [](key); end
40
-
41
- # Iterate over the key/value pairs:
42
- # attlist_decl.each { |attribute_name, attribute_value| ... }
43
- #
44
- # source://rexml//lib/rexml/attlistdecl.rb#50
45
- def each(&block); end
46
-
47
- # What is this? Got me.
48
- #
49
- # source://rexml//lib/rexml/attlistdecl.rb#22
50
- def element_name; end
51
-
52
- # Whether an attlist declaration includes the given attribute definition
53
- # if attlist_decl.include? "xmlns:foobar"
54
- #
55
- # @return [Boolean]
56
- #
57
- # source://rexml//lib/rexml/attlistdecl.rb#44
58
- def include?(key); end
59
-
60
- # source://rexml//lib/rexml/attlistdecl.rb#59
61
- def node_type; end
62
-
63
- # Write out exactly what we got in.
64
- #
65
- # source://rexml//lib/rexml/attlistdecl.rb#55
66
- def write(out, indent = T.unsafe(nil)); end
67
- end
68
-
69
- # Defines an Element Attribute; IE, a attribute=value pair, as in:
70
- # <element attribute="value"/>. Attributes can be in their own
71
- # namespaces. General users of REXML will not interact with the
72
- # Attribute class much.
73
- #
74
- # source://rexml//lib/rexml/attribute.rb#10
75
- class REXML::Attribute
76
- include ::REXML::Node
77
- include ::REXML::XMLTokens
78
- include ::REXML::Namespace
79
-
80
- # Constructor.
81
- # FIXME: The parser doesn't catch illegal characters in attributes
82
- #
83
- # first::
84
- # Either: an Attribute, which this new attribute will become a
85
- # clone of; or a String, which is the name of this attribute
86
- # second::
87
- # If +first+ is an Attribute, then this may be an Element, or nil.
88
- # If nil, then the Element parent of this attribute is the parent
89
- # of the +first+ Attribute. If the first argument is a String,
90
- # then this must also be a String, and is the content of the attribute.
91
- # If this is the content, it must be fully normalized (contain no
92
- # illegal characters).
93
- # parent::
94
- # Ignored unless +first+ is a String; otherwise, may be the Element
95
- # parent of this attribute, or nil.
96
- #
97
- #
98
- # Attribute.new( attribute_to_clone )
99
- # Attribute.new( attribute_to_clone, parent_element )
100
- # Attribute.new( "attr", "attr_value" )
101
- # Attribute.new( "attr", "attr_value", parent_element )
102
- #
103
- # @return [Attribute] a new instance of Attribute
104
- #
105
- # source://rexml//lib/rexml/attribute.rb#42
106
- def initialize(first, second = T.unsafe(nil), parent = T.unsafe(nil)); end
107
-
108
- # Returns true if other is an Attribute and has the same name and value,
109
- # false otherwise.
110
- #
111
- # source://rexml//lib/rexml/attribute.rb#106
112
- def ==(other); end
113
-
114
- # Returns a copy of this attribute
115
- #
116
- # source://rexml//lib/rexml/attribute.rb#164
117
- def clone; end
118
-
119
- # source://rexml//lib/rexml/attribute.rb#132
120
- def doctype; end
121
-
122
- # The element to which this attribute belongs
123
- #
124
- # source://rexml//lib/rexml/attribute.rb#15
125
- def element; end
126
-
127
- # Sets the element of which this object is an attribute. Normally, this
128
- # is not directly called.
129
- #
130
- # Returns this attribute
131
- #
132
- # source://rexml//lib/rexml/attribute.rb#172
133
- def element=(element); end
134
-
135
- # Creates (and returns) a hash from both the name and value
136
- #
137
- # source://rexml//lib/rexml/attribute.rb#111
138
- def hash; end
139
-
140
- # source://rexml//lib/rexml/attribute.rb#198
141
- def inspect; end
142
-
143
- # Returns the namespace URL, if defined, or nil otherwise
144
- #
145
- # e = Element.new("el")
146
- # e.add_namespace("ns", "http://url")
147
- # e.add_attribute("ns:a", "b")
148
- # e.add_attribute("nsx:a", "c")
149
- # e.attribute("ns:a").namespace # => "http://url"
150
- # e.attribute("nsx:a").namespace # => nil
151
- #
152
- # This method always returns "" for no namespace attribute. Because
153
- # the default namespace doesn't apply to attribute names.
154
- #
155
- # From https://www.w3.org/TR/xml-names/#uniqAttrs
156
- #
157
- # > the default namespace does not apply to attribute names
158
- #
159
- # e = REXML::Element.new("el")
160
- # e.add_namespace("", "http://example.com/")
161
- # e.namespace # => "http://example.com/"
162
- # e.add_attribute("a", "b")
163
- # e.attribute("a").namespace # => ""
164
- #
165
- # source://rexml//lib/rexml/attribute.rb#95
166
- def namespace(arg = T.unsafe(nil)); end
167
-
168
- # source://rexml//lib/rexml/attribute.rb#194
169
- def node_type; end
170
-
171
- # The normalized value of this attribute. That is, the attribute with
172
- # entities intact.
173
- #
174
- # source://rexml//lib/rexml/attribute.rb#158
175
- def normalized=(new_normalized); end
176
-
177
- # Returns the namespace of the attribute.
178
- #
179
- # e = Element.new( "elns:myelement" )
180
- # e.add_attribute( "nsa:a", "aval" )
181
- # e.add_attribute( "b", "bval" )
182
- # e.attributes.get_attribute( "a" ).prefix # -> "nsa"
183
- # e.attributes.get_attribute( "b" ).prefix # -> ""
184
- # a = Attribute.new( "x", "y" )
185
- # a.prefix # -> ""
186
- #
187
- # source://rexml//lib/rexml/attribute.rb#70
188
- def prefix; end
189
-
190
- # Removes this Attribute from the tree, and returns true if successful
191
- #
192
- # This method is usually not called directly.
193
- #
194
- # source://rexml//lib/rexml/attribute.rb#185
195
- def remove; end
196
-
197
- # Returns the attribute value, with entities replaced
198
- #
199
- # source://rexml//lib/rexml/attribute.rb#140
200
- def to_s; end
201
-
202
- # Returns this attribute out as XML source, expanding the name
203
- #
204
- # a = Attribute.new( "x", "y" )
205
- # a.to_string # -> "x='y'"
206
- # b = Attribute.new( "ns:x", "y" )
207
- # b.to_string # -> "ns:x='y'"
208
- #
209
- # source://rexml//lib/rexml/attribute.rb#121
210
- def to_string; end
211
-
212
- # Returns the UNNORMALIZED value of this attribute. That is, entities
213
- # have been expanded to their values
214
- #
215
- # source://rexml//lib/rexml/attribute.rb#149
216
- def value; end
217
-
218
- # Writes this attribute (EG, puts 'key="value"' to the output)
219
- #
220
- # source://rexml//lib/rexml/attribute.rb#190
221
- def write(output, indent = T.unsafe(nil)); end
222
-
223
- # source://rexml//lib/rexml/attribute.rb#204
224
- def xpath; end
225
- end
226
-
227
- # A class that defines the set of Attributes of an Element and provides
228
- # operations for accessing elements in that set.
229
- #
230
- # source://rexml//lib/rexml/element.rb#2137
231
- class REXML::Attributes < ::Hash
232
- # :call-seq:
233
- # new(element)
234
- #
235
- # Creates and returns a new \REXML::Attributes object.
236
- # The element given by argument +element+ is stored,
237
- # but its own attributes are not modified:
238
- #
239
- # ele = REXML::Element.new('foo')
240
- # attrs = REXML::Attributes.new(ele)
241
- # attrs.object_id == ele.attributes.object_id # => false
242
- #
243
- # Other instance methods in class \REXML::Attributes may refer to:
244
- #
245
- # - +element.document+.
246
- # - +element.prefix+.
247
- # - +element.expanded_name+.
248
- #
249
- # @return [Attributes] a new instance of Attributes
250
- #
251
- # source://rexml//lib/rexml/element.rb#2156
252
- def initialize(element); end
253
-
254
- # :call-seq:
255
- # add(attribute) -> attribute
256
- #
257
- # Adds attribute +attribute+, replacing the previous
258
- # attribute of the same name if it exists;
259
- # returns +attribute+:
260
- #
261
- # xml_string = <<-EOT
262
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
263
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
264
- # </root>
265
- # EOT
266
- # d = REXML::Document.new(xml_string)
267
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
268
- # attrs = ele.attributes
269
- # attrs # => {"att"=>{"foo"=>foo:att='1', "bar"=>bar:att='2', ""=>att='&lt;'}}
270
- # attrs.add(REXML::Attribute.new('foo:att', '2')) # => foo:att='2'
271
- # attrs.add(REXML::Attribute.new('baz', '3')) # => baz='3'
272
- # attrs.include?('baz') # => true
273
- #
274
- # source://rexml//lib/rexml/element.rb#2522
275
- def <<(attribute); end
276
-
277
- # :call-seq:
278
- # [name] -> attribute_value or nil
279
- #
280
- # Returns the value for the attribute given by +name+,
281
- # if it exists; otherwise +nil+.
282
- # The value returned is the unnormalized attribute value,
283
- # with entities expanded:
284
- #
285
- # xml_string = <<-EOT
286
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
287
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
288
- # </root>
289
- # EOT
290
- # d = REXML::Document.new(xml_string)
291
- # ele = d.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
292
- # ele.attributes['att'] # => "<"
293
- # ele.attributes['bar:att'] # => "2"
294
- # ele.attributes['nosuch'] # => nil
295
- #
296
- # Related: get_attribute (returns an \Attribute object).
297
- #
298
- # source://rexml//lib/rexml/element.rb#2181
299
- def [](name); end
300
-
301
- # :call-seq:
302
- # [name] = value -> value
303
- #
304
- # When +value+ is non-+nil+,
305
- # assigns that to the attribute for the given +name+,
306
- # overwriting the previous value if it exists:
307
- #
308
- # xml_string = <<-EOT
309
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
310
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
311
- # </root>
312
- # EOT
313
- # d = REXML::Document.new(xml_string)
314
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
315
- # attrs = ele.attributes
316
- # attrs['foo:att'] = '2' # => "2"
317
- # attrs['baz:att'] = '3' # => "3"
318
- #
319
- # When +value+ is +nil+, deletes the attribute if it exists:
320
- #
321
- # attrs['baz:att'] = nil
322
- # attrs.include?('baz:att') # => false
323
- #
324
- # source://rexml//lib/rexml/element.rb#2365
325
- def []=(name, value); end
326
-
327
- # :call-seq:
328
- # add(attribute) -> attribute
329
- #
330
- # Adds attribute +attribute+, replacing the previous
331
- # attribute of the same name if it exists;
332
- # returns +attribute+:
333
- #
334
- # xml_string = <<-EOT
335
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
336
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
337
- # </root>
338
- # EOT
339
- # d = REXML::Document.new(xml_string)
340
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
341
- # attrs = ele.attributes
342
- # attrs # => {"att"=>{"foo"=>foo:att='1', "bar"=>bar:att='2', ""=>att='&lt;'}}
343
- # attrs.add(REXML::Attribute.new('foo:att', '2')) # => foo:att='2'
344
- # attrs.add(REXML::Attribute.new('baz', '3')) # => baz='3'
345
- # attrs.include?('baz') # => true
346
- #
347
- # source://rexml//lib/rexml/element.rb#2522
348
- def add(attribute); end
349
-
350
- # :call-seq:
351
- # delete(name) -> element
352
- # delete(attribute) -> element
353
- #
354
- # Removes a specified attribute if it exists;
355
- # returns the attributes' element.
356
- #
357
- # When string argument +name+ is given,
358
- # removes the attribute of that name if it exists:
359
- #
360
- # xml_string = <<-EOT
361
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
362
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
363
- # </root>
364
- # EOT
365
- # d = REXML::Document.new(xml_string)
366
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
367
- # attrs = ele.attributes
368
- # attrs.delete('foo:att') # => <ele bar:att='2' att='&lt;'/>
369
- # attrs.delete('foo:att') # => <ele bar:att='2' att='&lt;'/>
370
- #
371
- # When attribute argument +attribute+ is given,
372
- # removes that attribute if it exists:
373
- #
374
- # attr = REXML::Attribute.new('bar:att', '2')
375
- # attrs.delete(attr) # => <ele att='&lt;'/> # => <ele att='&lt;'/>
376
- # attrs.delete(attr) # => <ele att='&lt;'/> # => <ele/>
377
- #
378
- # source://rexml//lib/rexml/element.rb#2475
379
- def delete(attribute); end
380
-
381
- # :call-seq:
382
- # delete_all(name) -> array_of_removed_attributes
383
- #
384
- # Removes all attributes matching the given +name+;
385
- # returns an array of the removed attributes:
386
- #
387
- # xml_string = <<-EOT
388
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
389
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
390
- # </root>
391
- # EOT
392
- # d = REXML::Document.new(xml_string)
393
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
394
- # attrs = ele.attributes
395
- # attrs.delete_all('att') # => [att='&lt;']
396
- #
397
- # source://rexml//lib/rexml/element.rb#2544
398
- def delete_all(name); end
399
-
400
- # :call-seq:
401
- # each {|expanded_name, value| ... }
402
- #
403
- # Calls the given block with each expanded-name/value pair:
404
- #
405
- # xml_string = <<-EOT
406
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
407
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
408
- # </root>
409
- # EOT
410
- # d = REXML::Document.new(xml_string)
411
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
412
- # ele.attributes.each do |expanded_name, value|
413
- # p [expanded_name, value]
414
- # end
415
- #
416
- # Output:
417
- #
418
- # ["foo:att", "1"]
419
- # ["bar:att", "2"]
420
- # ["att", "<"]
421
- #
422
- # source://rexml//lib/rexml/element.rb#2283
423
- def each; end
424
-
425
- # :call-seq:
426
- # each_attribute {|attr| ... }
427
- #
428
- # Calls the given block with each \REXML::Attribute object:
429
- #
430
- # xml_string = <<-EOT
431
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
432
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
433
- # </root>
434
- # EOT
435
- # d = REXML::Document.new(xml_string)
436
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
437
- # ele.attributes.each_attribute do |attr|
438
- # p [attr.class, attr]
439
- # end
440
- #
441
- # Output:
442
- #
443
- # [REXML::Attribute, foo:att='1']
444
- # [REXML::Attribute, bar:att='2']
445
- # [REXML::Attribute, att='&lt;']
446
- #
447
- # source://rexml//lib/rexml/element.rb#2250
448
- def each_attribute; end
449
-
450
- # :call-seq:
451
- # get_attribute(name) -> attribute_object or nil
452
- #
453
- # Returns the \REXML::Attribute object for the given +name+:
454
- #
455
- # xml_string = <<-EOT
456
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
457
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
458
- # </root>
459
- # EOT
460
- # d = REXML::Document.new(xml_string)
461
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
462
- # attrs = ele.attributes
463
- # attrs.get_attribute('foo:att') # => foo:att='1'
464
- # attrs.get_attribute('foo:att').class # => REXML::Attribute
465
- # attrs.get_attribute('bar:att') # => bar:att='2'
466
- # attrs.get_attribute('att') # => att='&lt;'
467
- # attrs.get_attribute('nosuch') # => nil
468
- #
469
- # source://rexml//lib/rexml/element.rb#2309
470
- def get_attribute(name); end
471
-
472
- # :call-seq:
473
- # get_attribute_ns(namespace, name)
474
- #
475
- # Returns the \REXML::Attribute object among the attributes
476
- # that matches the given +namespace+ and +name+:
477
- #
478
- # xml_string = <<-EOT
479
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
480
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
481
- # </root>
482
- # EOT
483
- # d = REXML::Document.new(xml_string)
484
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
485
- # attrs = ele.attributes
486
- # attrs.get_attribute_ns('http://foo', 'att') # => foo:att='1'
487
- # attrs.get_attribute_ns('http://foo', 'nosuch') # => nil
488
- #
489
- # source://rexml//lib/rexml/element.rb#2570
490
- def get_attribute_ns(namespace, name); end
491
-
492
- # :call-seq:
493
- # length
494
- #
495
- # Returns the count of attributes:
496
- #
497
- # xml_string = <<-EOT
498
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
499
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
500
- # </root>
501
- # EOT
502
- # d = REXML::Document.new(xml_string)
503
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
504
- # ele.attributes.length # => 3
505
- #
506
- # source://rexml//lib/rexml/element.rb#2221
507
- def length; end
508
-
509
- # :call-seq:
510
- # namespaces
511
- #
512
- # Returns a hash of name/value pairs for the namespaces:
513
- #
514
- # xml_string = '<a xmlns="foo" xmlns:x="bar" xmlns:y="twee" z="glorp"/>'
515
- # d = REXML::Document.new(xml_string)
516
- # d.root.attributes.namespaces # => {"xmlns"=>"foo", "x"=>"bar", "y"=>"twee"}
517
- #
518
- # source://rexml//lib/rexml/element.rb#2431
519
- def namespaces; end
520
-
521
- # :call-seq:
522
- # prefixes -> array_of_prefix_strings
523
- #
524
- # Returns an array of prefix strings in the attributes.
525
- # The array does not include the default
526
- # namespace declaration, if one exists.
527
- #
528
- # xml_string = '<a xmlns="foo" xmlns:x="bar" xmlns:y="twee" z="glorp"/>'
529
- # d = REXML::Document.new(xml_string)
530
- # d.root.attributes.prefixes # => ["x", "y"]
531
- #
532
- # source://rexml//lib/rexml/element.rb#2406
533
- def prefixes; end
534
-
535
- # :call-seq:
536
- # length
537
- #
538
- # Returns the count of attributes:
539
- #
540
- # xml_string = <<-EOT
541
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
542
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
543
- # </root>
544
- # EOT
545
- # d = REXML::Document.new(xml_string)
546
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
547
- # ele.attributes.length # => 3
548
- #
549
- # source://rexml//lib/rexml/element.rb#2221
550
- def size; end
551
-
552
- # :call-seq:
553
- # to_a -> array_of_attribute_objects
554
- #
555
- # Returns an array of \REXML::Attribute objects representing
556
- # the attributes:
557
- #
558
- # xml_string = <<-EOT
559
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
560
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
561
- # </root>
562
- # EOT
563
- # d = REXML::Document.new(xml_string)
564
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
565
- # attrs = ele.attributes.to_a # => [foo:att='1', bar:att='2', att='&lt;']
566
- # attrs.first.class # => REXML::Attribute
567
- #
568
- # source://rexml//lib/rexml/element.rb#2203
569
- def to_a; end
570
- end
571
-
572
- # source://rexml//lib/rexml/cdata.rb#5
573
- class REXML::CData < ::REXML::Text
574
- # Constructor. CData is data between <![CDATA[ ... ]]>
575
- #
576
- # _Examples_
577
- # CData.new( source )
578
- # CData.new( "Here is some CDATA" )
579
- # CData.new( "Some unprocessed data", respect_whitespace_TF, parent_element )
580
- #
581
- # @return [CData] a new instance of CData
582
- #
583
- # source://rexml//lib/rexml/cdata.rb#16
584
- def initialize(first, whitespace = T.unsafe(nil), parent = T.unsafe(nil)); end
585
-
586
- # Make a copy of this object
587
- #
588
- # _Examples_
589
- # c = CData.new( "Some text" )
590
- # d = c.clone
591
- # d.to_s # -> "Some text"
592
- #
593
- # source://rexml//lib/rexml/cdata.rb#26
594
- def clone; end
595
-
596
- # Returns the content of this CData object
597
- #
598
- # _Examples_
599
- # c = CData.new( "Some text" )
600
- # c.to_s # -> "Some text"
601
- #
602
- # source://rexml//lib/rexml/cdata.rb#35
603
- def to_s; end
604
-
605
- # source://rexml//lib/rexml/cdata.rb#39
606
- def value; end
607
-
608
- # == DEPRECATED
609
- # See the rexml/formatters package
610
- #
611
- # Generates XML output of this object
612
- #
613
- # output::
614
- # Where to write the string. Defaults to $stdout
615
- # indent::
616
- # The amount to indent this node by
617
- # transitive::
618
- # Ignored
619
- # ie_hack::
620
- # Ignored
621
- #
622
- # _Examples_
623
- # c = CData.new( " Some text " )
624
- # c.write( $stdout ) #-> <![CDATA[ Some text ]]>
625
- #
626
- # source://rexml//lib/rexml/cdata.rb#60
627
- def write(output = T.unsafe(nil), indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
628
- end
629
-
630
- # A Child object is something contained by a parent, and this class
631
- # contains methods to support that. Most user code will not use this
632
- # class directly.
633
- #
634
- # source://rexml//lib/rexml/child.rb#9
635
- class REXML::Child
636
- include ::REXML::Node
637
-
638
- # Constructor. Any inheritors of this class should call super to make
639
- # sure this method is called.
640
- # parent::
641
- # if supplied, the parent of this child will be set to the
642
- # supplied value, and self will be added to the parent
643
- #
644
- # @return [Child] a new instance of Child
645
- #
646
- # source://rexml//lib/rexml/child.rb#18
647
- def initialize(parent = T.unsafe(nil)); end
648
-
649
- # This doesn't yet handle encodings
650
- #
651
- # source://rexml//lib/rexml/child.rb#91
652
- def bytes; end
653
-
654
- # Returns:: the document this child belongs to, or nil if this child
655
- # belongs to no document
656
- #
657
- # source://rexml//lib/rexml/child.rb#85
658
- def document; end
659
-
660
- # source://rexml//lib/rexml/node.rb#11
661
- def next_sibling; end
662
-
663
- # Sets the next sibling of this child. This can be used to insert a child
664
- # after some other child.
665
- # a = Element.new("a")
666
- # b = a.add_element("b")
667
- # c = Element.new("c")
668
- # b.next_sibling = c
669
- # # => <a><b/><c/></a>
670
- #
671
- # source://rexml//lib/rexml/child.rb#68
672
- def next_sibling=(other); end
673
-
674
- # The Parent of this object
675
- #
676
- # source://rexml//lib/rexml/child.rb#11
677
- def parent; end
678
-
679
- # Sets the parent of this child to the supplied argument.
680
- #
681
- # other::
682
- # Must be a Parent object. If this object is the same object as the
683
- # existing parent of this child, no action is taken. Otherwise, this
684
- # child is removed from the current parent (if one exists), and is added
685
- # to the new parent.
686
- # Returns:: The parent added
687
- #
688
- # source://rexml//lib/rexml/child.rb#52
689
- def parent=(other); end
690
-
691
- # source://rexml//lib/rexml/node.rb#17
692
- def previous_sibling; end
693
-
694
- # Sets the previous sibling of this child. This can be used to insert a
695
- # child before some other child.
696
- # a = Element.new("a")
697
- # b = a.add_element("b")
698
- # c = Element.new("c")
699
- # b.previous_sibling = c
700
- # # => <a><b/><c/></a>
701
- #
702
- # source://rexml//lib/rexml/child.rb#79
703
- def previous_sibling=(other); end
704
-
705
- # Removes this child from the parent.
706
- #
707
- # Returns:: self
708
- #
709
- # source://rexml//lib/rexml/child.rb#37
710
- def remove; end
711
-
712
- # Replaces this object with another object. Basically, calls
713
- # Parent.replace_child
714
- #
715
- # Returns:: self
716
- #
717
- # source://rexml//lib/rexml/child.rb#29
718
- def replace_with(child); end
719
- end
720
-
721
- # Represents an XML comment; that is, text between \<!-- ... -->
722
- #
723
- # source://rexml//lib/rexml/comment.rb#7
724
- class REXML::Comment < ::REXML::Child
725
- include ::Comparable
726
-
727
- # Constructor. The first argument can be one of three types:
728
- # argument. If Comment, the argument is duplicated. If
729
- # Source, the argument is scanned for a comment.
730
- # should be nil, not supplied, or a Parent to be set as the parent
731
- # of this object
732
- #
733
- # @param first If String, the contents of this comment are set to the
734
- # @param second If the first argument is a Source, this argument
735
- # @return [Comment] a new instance of Comment
736
- #
737
- # source://rexml//lib/rexml/comment.rb#24
738
- def initialize(first, second = T.unsafe(nil)); end
739
-
740
- # Compares this Comment to another; the contents of the comment are used
741
- # in the comparison.
742
- #
743
- # source://rexml//lib/rexml/comment.rb#63
744
- def <=>(other); end
745
-
746
- # Compares this Comment to another; the contents of the comment are used
747
- # in the comparison.
748
- #
749
- # source://rexml//lib/rexml/comment.rb#70
750
- def ==(other); end
751
-
752
- # source://rexml//lib/rexml/comment.rb#33
753
- def clone; end
754
-
755
- # source://rexml//lib/rexml/comment.rb#75
756
- def node_type; end
757
-
758
- # The content text
759
- #
760
- # source://rexml//lib/rexml/comment.rb#14
761
- def string; end
762
-
763
- # The content text
764
- #
765
- # source://rexml//lib/rexml/comment.rb#14
766
- def string=(_arg0); end
767
-
768
- # The content text
769
- #
770
- # source://rexml//lib/rexml/comment.rb#14
771
- def to_s; end
772
-
773
- # == DEPRECATED
774
- # See REXML::Formatters
775
- #
776
- # output::
777
- # Where to write the string
778
- # indent::
779
- # An integer. If -1, no indenting will be used; otherwise, the
780
- # indentation will be this number of spaces, and children will be
781
- # indented an additional amount.
782
- # transitive::
783
- # Ignored by this class. The contents of comments are never modified.
784
- # ie_hack::
785
- # Needed for conformity to the child API, but not used by this class.
786
- #
787
- # source://rexml//lib/rexml/comment.rb#50
788
- def write(output, indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
789
- end
790
-
791
- # source://rexml//lib/rexml/xpath_parser.rb#11
792
- module REXML::DClonable; end
793
-
794
- # This is an abstract class. You never use this directly; it serves as a
795
- # parent class for the specific declarations.
796
- #
797
- # source://rexml//lib/rexml/doctype.rb#242
798
- class REXML::Declaration < ::REXML::Child
799
- # @return [Declaration] a new instance of Declaration
800
- #
801
- # source://rexml//lib/rexml/doctype.rb#243
802
- def initialize(src); end
803
-
804
- # source://rexml//lib/rexml/doctype.rb#248
805
- def to_s; end
806
-
807
- # == DEPRECATED
808
- # See REXML::Formatters
809
- #
810
- # source://rexml//lib/rexml/doctype.rb#255
811
- def write(output, indent); end
812
- end
813
-
814
- # Represents an XML DOCTYPE declaration; that is, the contents of <!DOCTYPE
815
- # ... >. DOCTYPES can be used to declare the DTD of a document, as well as
816
- # being used to declare entities used in the document.
817
- #
818
- # source://rexml//lib/rexml/doctype.rb#51
819
- class REXML::DocType < ::REXML::Parent
820
- include ::REXML::XMLTokens
821
-
822
- # Constructor
823
- #
824
- # dt = DocType.new( 'foo', '-//I/Hate/External/IDs' )
825
- # # <!DOCTYPE foo '-//I/Hate/External/IDs'>
826
- # dt = DocType.new( doctype_to_clone )
827
- # # Incomplete. Shallow clone of doctype
828
- #
829
- # +Note+ that the constructor:
830
- #
831
- # Doctype.new( Source.new( "<!DOCTYPE foo 'bar'>" ) )
832
- #
833
- # is _deprecated_. Do not use it. It will probably disappear.
834
- #
835
- # @return [DocType] a new instance of DocType
836
- #
837
- # source://rexml//lib/rexml/doctype.rb#80
838
- def initialize(first, parent = T.unsafe(nil)); end
839
-
840
- # source://rexml//lib/rexml/doctype.rb#185
841
- def add(child); end
842
-
843
- # source://rexml//lib/rexml/doctype.rb#125
844
- def attribute_of(element, attribute); end
845
-
846
- # source://rexml//lib/rexml/doctype.rb#115
847
- def attributes_of(element); end
848
-
849
- # source://rexml//lib/rexml/doctype.rb#135
850
- def clone; end
851
-
852
- # source://rexml//lib/rexml/doctype.rb#173
853
- def context; end
854
-
855
- # name is the name of the doctype
856
- # external_id is the referenced DTD, if given
857
- #
858
- # source://rexml//lib/rexml/doctype.rb#66
859
- def entities; end
860
-
861
- # source://rexml//lib/rexml/doctype.rb#181
862
- def entity(name); end
863
-
864
- # name is the name of the doctype
865
- # external_id is the referenced DTD, if given
866
- #
867
- # source://rexml//lib/rexml/doctype.rb#66
868
- def external_id; end
869
-
870
- # name is the name of the doctype
871
- # external_id is the referenced DTD, if given
872
- #
873
- # source://rexml//lib/rexml/doctype.rb#66
874
- def name; end
875
-
876
- # name is the name of the doctype
877
- # external_id is the referenced DTD, if given
878
- #
879
- # source://rexml//lib/rexml/doctype.rb#66
880
- def namespaces; end
881
-
882
- # source://rexml//lib/rexml/doctype.rb#111
883
- def node_type; end
884
-
885
- # Retrieves a named notation. Only notations declared in the internal
886
- # DTD subset can be retrieved.
887
- #
888
- # Method contributed by Henrik Martensson
889
- #
890
- # source://rexml//lib/rexml/doctype.rb#229
891
- def notation(name); end
892
-
893
- # This method returns a list of notations that have been declared in the
894
- # _internal_ DTD subset. Notations in the external DTD subset are not
895
- # listed.
896
- #
897
- # Method contributed by Henrik Martensson
898
- #
899
- # source://rexml//lib/rexml/doctype.rb#221
900
- def notations; end
901
-
902
- # This method retrieves the public identifier identifying the document's
903
- # DTD.
904
- #
905
- # Method contributed by Henrik Martensson
906
- #
907
- # source://rexml//lib/rexml/doctype.rb#195
908
- def public; end
909
-
910
- # This method retrieves the system identifier identifying the document's DTD
911
- #
912
- # Method contributed by Henrik Martensson
913
- #
914
- # source://rexml//lib/rexml/doctype.rb#207
915
- def system; end
916
-
917
- # output::
918
- # Where to write the string
919
- # indent::
920
- # An integer. If -1, no indentation will be used; otherwise, the
921
- # indentation will be this number of spaces, and children will be
922
- # indented an additional amount.
923
- # transitive::
924
- # Ignored
925
- # ie_hack::
926
- # Ignored
927
- #
928
- # source://rexml//lib/rexml/doctype.rb#149
929
- def write(output, indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
930
- end
931
-
932
- # Represents an XML document.
933
- #
934
- # A document may have:
935
- #
936
- # - A single child that may be accessed via method #root.
937
- # - An XML declaration.
938
- # - A document type.
939
- # - Processing instructions.
940
- #
941
- # == In a Hurry?
942
- #
943
- # If you're somewhat familiar with XML
944
- # and have a particular task in mind,
945
- # you may want to see the
946
- # {tasks pages}[../doc/rexml/tasks/tocs/master_toc_rdoc.html],
947
- # and in particular, the
948
- # {tasks page for documents}[../doc/rexml/tasks/tocs/document_toc_rdoc.html].
949
- #
950
- # source://rexml//lib/rexml/document.rb#35
951
- class REXML::Document < ::REXML::Element
952
- # :call-seq:
953
- # new(string = nil, context = {}) -> new_document
954
- # new(io_stream = nil, context = {}) -> new_document
955
- # new(document = nil, context = {}) -> new_document
956
- #
957
- # Returns a new \REXML::Document object.
958
- #
959
- # When no arguments are given,
960
- # returns an empty document:
961
- #
962
- # d = REXML::Document.new
963
- # d.to_s # => ""
964
- #
965
- # When argument +string+ is given, it must be a string
966
- # containing a valid XML document:
967
- #
968
- # xml_string = '<root><foo>Foo</foo><bar>Bar</bar></root>'
969
- # d = REXML::Document.new(xml_string)
970
- # d.to_s # => "<root><foo>Foo</foo><bar>Bar</bar></root>"
971
- #
972
- # When argument +io_stream+ is given, it must be an \IO object
973
- # that is opened for reading, and when read must return a valid XML document:
974
- #
975
- # File.write('t.xml', xml_string)
976
- # d = File.open('t.xml', 'r') do |io|
977
- # REXML::Document.new(io)
978
- # end
979
- # d.to_s # => "<root><foo>Foo</foo><bar>Bar</bar></root>"
980
- #
981
- # When argument +document+ is given, it must be an existing
982
- # document object, whose context and attributes (but not children)
983
- # are cloned into the new document:
984
- #
985
- # d = REXML::Document.new(xml_string)
986
- # d.children # => [<root> ... </>]
987
- # d.context = {raw: :all, compress_whitespace: :all}
988
- # d.add_attributes({'bar' => 0, 'baz' => 1})
989
- # d1 = REXML::Document.new(d)
990
- # d1.children # => []
991
- # d1.context # => {:raw=>:all, :compress_whitespace=>:all}
992
- # d1.attributes # => {"bar"=>bar='0', "baz"=>baz='1'}
993
- #
994
- # When argument +context+ is given, it must be a hash
995
- # containing context entries for the document;
996
- # see {Element Context}[../doc/rexml/context_rdoc.html]:
997
- #
998
- # context = {raw: :all, compress_whitespace: :all}
999
- # d = REXML::Document.new(xml_string, context)
1000
- # d.context # => {:raw=>:all, :compress_whitespace=>:all}
1001
- #
1002
- # @return [Document] a new instance of Document
1003
- #
1004
- # source://rexml//lib/rexml/document.rb#92
1005
- def initialize(source = T.unsafe(nil), context = T.unsafe(nil)); end
1006
-
1007
- # :call-seq:
1008
- # add(xml_decl) -> self
1009
- # add(doc_type) -> self
1010
- # add(object) -> self
1011
- #
1012
- # Adds an object to the document; returns +self+.
1013
- #
1014
- # When argument +xml_decl+ is given,
1015
- # it must be an REXML::XMLDecl object,
1016
- # which becomes the XML declaration for the document,
1017
- # replacing the previous XML declaration if any:
1018
- #
1019
- # d = REXML::Document.new
1020
- # d.xml_decl.to_s # => ""
1021
- # d.add(REXML::XMLDecl.new('2.0'))
1022
- # d.xml_decl.to_s # => "<?xml version='2.0'?>"
1023
- #
1024
- # When argument +doc_type+ is given,
1025
- # it must be an REXML::DocType object,
1026
- # which becomes the document type for the document,
1027
- # replacing the previous document type, if any:
1028
- #
1029
- # d = REXML::Document.new
1030
- # d.doctype.to_s # => ""
1031
- # d.add(REXML::DocType.new('foo'))
1032
- # d.doctype.to_s # => "<!DOCTYPE foo>"
1033
- #
1034
- # When argument +object+ (not an REXML::XMLDecl or REXML::DocType object)
1035
- # is given it is added as the last child:
1036
- #
1037
- # d = REXML::Document.new
1038
- # d.add(REXML::Element.new('foo'))
1039
- # d.to_s # => "<foo/>"
1040
- #
1041
- # source://rexml//lib/rexml/document.rb#172
1042
- def <<(child); end
1043
-
1044
- # :call-seq:
1045
- # add(xml_decl) -> self
1046
- # add(doc_type) -> self
1047
- # add(object) -> self
1048
- #
1049
- # Adds an object to the document; returns +self+.
1050
- #
1051
- # When argument +xml_decl+ is given,
1052
- # it must be an REXML::XMLDecl object,
1053
- # which becomes the XML declaration for the document,
1054
- # replacing the previous XML declaration if any:
1055
- #
1056
- # d = REXML::Document.new
1057
- # d.xml_decl.to_s # => ""
1058
- # d.add(REXML::XMLDecl.new('2.0'))
1059
- # d.xml_decl.to_s # => "<?xml version='2.0'?>"
1060
- #
1061
- # When argument +doc_type+ is given,
1062
- # it must be an REXML::DocType object,
1063
- # which becomes the document type for the document,
1064
- # replacing the previous document type, if any:
1065
- #
1066
- # d = REXML::Document.new
1067
- # d.doctype.to_s # => ""
1068
- # d.add(REXML::DocType.new('foo'))
1069
- # d.doctype.to_s # => "<!DOCTYPE foo>"
1070
- #
1071
- # When argument +object+ (not an REXML::XMLDecl or REXML::DocType object)
1072
- # is given it is added as the last child:
1073
- #
1074
- # d = REXML::Document.new
1075
- # d.add(REXML::Element.new('foo'))
1076
- # d.to_s # => "<foo/>"
1077
- #
1078
- # source://rexml//lib/rexml/document.rb#172
1079
- def add(child); end
1080
-
1081
- # :call-seq:
1082
- # add_element(name_or_element = nil, attributes = nil) -> new_element
1083
- #
1084
- # Adds an element to the document by calling REXML::Element.add_element:
1085
- #
1086
- # REXML::Element.add_element(name_or_element, attributes)
1087
- #
1088
- # source://rexml//lib/rexml/document.rb#211
1089
- def add_element(arg = T.unsafe(nil), arg2 = T.unsafe(nil)); end
1090
-
1091
- # :call-seq:
1092
- # clone -> new_document
1093
- #
1094
- # Returns the new document resulting from executing
1095
- # <tt>Document.new(self)</tt>. See Document.new.
1096
- #
1097
- # source://rexml//lib/rexml/document.rb#122
1098
- def clone; end
1099
-
1100
- # :call-seq:
1101
- # doctype -> doc_type or nil
1102
- #
1103
- # Returns the DocType object for the document, if it exists, otherwise +nil+:
1104
- #
1105
- # d = REXML::Document.new('<!DOCTYPE document SYSTEM "subjects.dtd">')
1106
- # d.doctype.class # => REXML::DocType
1107
- # d = REXML::Document.new('')
1108
- # d.doctype.class # => nil
1109
- #
1110
- # source://rexml//lib/rexml/document.rb#243
1111
- def doctype; end
1112
-
1113
- # source://rexml//lib/rexml/document.rb#446
1114
- def document; end
1115
-
1116
- # :call-seq:
1117
- # encoding -> encoding_string
1118
- #
1119
- # Returns the XMLDecl encoding of the document,
1120
- #
1121
- # d = REXML::Document.new('<?xml version="1.0" encoding="UTF-16"?>')
1122
- # d.encoding # => "UTF-16"
1123
- # d = REXML::Document.new('')
1124
- # d.encoding # => "UTF-8"
1125
- #
1126
- # source://rexml//lib/rexml/document.rb#292
1127
- def encoding; end
1128
-
1129
- # Returns the value of attribute entity_expansion_count.
1130
- #
1131
- # source://rexml//lib/rexml/document.rb#435
1132
- def entity_expansion_count; end
1133
-
1134
- # Sets the attribute entity_expansion_limit
1135
- #
1136
- # @param value the value to set the attribute entity_expansion_limit to.
1137
- #
1138
- # source://rexml//lib/rexml/document.rb#436
1139
- def entity_expansion_limit=(_arg0); end
1140
-
1141
- # Returns the value of attribute entity_expansion_text_limit.
1142
- #
1143
- # source://rexml//lib/rexml/document.rb#437
1144
- def entity_expansion_text_limit; end
1145
-
1146
- # Sets the attribute entity_expansion_text_limit
1147
- #
1148
- # @param value the value to set the attribute entity_expansion_text_limit to.
1149
- #
1150
- # source://rexml//lib/rexml/document.rb#437
1151
- def entity_expansion_text_limit=(_arg0); end
1152
-
1153
- # :call-seq:
1154
- # expanded_name -> empty_string
1155
- #
1156
- # Returns an empty string.
1157
- #
1158
- # source://rexml//lib/rexml/document.rb#131
1159
- def expanded_name; end
1160
-
1161
- # :call-seq:
1162
- # expanded_name -> empty_string
1163
- #
1164
- # Returns an empty string.
1165
- # d = doc_type
1166
- # d ? d.name : "UNDEFINED"
1167
- #
1168
- # source://rexml//lib/rexml/document.rb#131
1169
- def name; end
1170
-
1171
- # :call-seq:
1172
- # node_type -> :document
1173
- #
1174
- # Returns the symbol +:document+.
1175
- #
1176
- # source://rexml//lib/rexml/document.rb#112
1177
- def node_type; end
1178
-
1179
- # source://rexml//lib/rexml/document.rb#439
1180
- def record_entity_expansion; end
1181
-
1182
- # :call-seq:
1183
- # root -> root_element or nil
1184
- #
1185
- # Returns the root element of the document, if it exists, otherwise +nil+:
1186
- #
1187
- # d = REXML::Document.new('<root></root>')
1188
- # d.root # => <root/>
1189
- # d = REXML::Document.new('')
1190
- # d.root # => nil
1191
- #
1192
- # source://rexml//lib/rexml/document.rb#227
1193
- def root; end
1194
-
1195
- # :call-seq:
1196
- # stand_alone?
1197
- #
1198
- # Returns the XMLDecl standalone value of the document as a string,
1199
- # if it has been set, otherwise the default standalone value:
1200
- #
1201
- # d = REXML::Document.new('<?xml standalone="yes"?>')
1202
- # d.stand_alone? # => "yes"
1203
- # d = REXML::Document.new('')
1204
- # d.stand_alone? # => nil
1205
- #
1206
- # @return [Boolean]
1207
- #
1208
- # source://rexml//lib/rexml/document.rb#307
1209
- def stand_alone?; end
1210
-
1211
- # :call-seq:
1212
- # version -> version_string
1213
- #
1214
- # Returns the XMLDecl version of this document as a string,
1215
- # if it has been set, otherwise the default version:
1216
- #
1217
- # d = REXML::Document.new('<?xml version="2.0" encoding="UTF-8"?>')
1218
- # d.version # => "2.0"
1219
- # d = REXML::Document.new('')
1220
- # d.version # => "1.0"
1221
- #
1222
- # source://rexml//lib/rexml/document.rb#277
1223
- def version; end
1224
-
1225
- # :call-seq:
1226
- # doc.write(output=$stdout, indent=-1, transtive=false, ie_hack=false, encoding=nil)
1227
- # doc.write(options={:output => $stdout, :indent => -1, :transtive => false, :ie_hack => false, :encoding => nil})
1228
- #
1229
- # Write the XML tree out, optionally with indent. This writes out the
1230
- # entire XML document, including XML declarations, doctype declarations,
1231
- # and processing instructions (if any are given).
1232
- #
1233
- # A controversial point is whether Document should always write the XML
1234
- # declaration (<?xml version='1.0'?>) whether or not one is given by the
1235
- # user (or source document). REXML does not write one if one was not
1236
- # specified, because it adds unnecessary bandwidth to applications such
1237
- # as XML-RPC.
1238
- #
1239
- # Accept Nth argument style and options Hash style as argument.
1240
- # The recommended style is options Hash style for one or more
1241
- # arguments case.
1242
- #
1243
- # _Examples_
1244
- # Document.new("<a><b/></a>").write
1245
- #
1246
- # output = ""
1247
- # Document.new("<a><b/></a>").write(output)
1248
- #
1249
- # output = ""
1250
- # Document.new("<a><b/></a>").write(:output => output, :indent => 2)
1251
- #
1252
- # See also the classes in the rexml/formatters package for the proper way
1253
- # to change the default formatting of XML output.
1254
- #
1255
- # _Examples_
1256
- #
1257
- # output = ""
1258
- # tr = Transitive.new
1259
- # tr.write(Document.new("<a><b/></a>"), output)
1260
- #
1261
- # output::
1262
- # output an object which supports '<< string'; this is where the
1263
- # document will be written.
1264
- # indent::
1265
- # An integer. If -1, no indenting will be used; otherwise, the
1266
- # indentation will be twice this number of spaces, and children will be
1267
- # indented an additional amount. For a value of 3, every item will be
1268
- # indented 3 more levels, or 6 more spaces (2 * 3). Defaults to -1
1269
- # transitive::
1270
- # If transitive is true and indent is >= 0, then the output will be
1271
- # pretty-printed in such a way that the added whitespace does not affect
1272
- # the absolute *value* of the document -- that is, it leaves the value
1273
- # and number of Text nodes in the document unchanged.
1274
- # ie_hack::
1275
- # This hack inserts a space before the /> on empty tags to address
1276
- # a limitation of Internet Explorer. Defaults to false
1277
- # Encoding name as String. Change output encoding to specified encoding
1278
- # instead of encoding in XML declaration.
1279
- # Defaults to nil. It means encoding in XML declaration is used.
1280
- #
1281
- # source://rexml//lib/rexml/document.rb#367
1282
- def write(*arguments); end
1283
-
1284
- # :call-seq:
1285
- # xml_decl -> xml_decl
1286
- #
1287
- # Returns the XMLDecl object for the document, if it exists,
1288
- # otherwise the default XMLDecl object:
1289
- #
1290
- # d = REXML::Document.new('<?xml version="1.0" encoding="UTF-8"?>')
1291
- # d.xml_decl.class # => REXML::XMLDecl
1292
- # d.xml_decl.to_s # => "<?xml version='1.0' encoding='UTF-8'?>"
1293
- # d = REXML::Document.new('')
1294
- # d.xml_decl.class # => REXML::XMLDecl
1295
- # d.xml_decl.to_s # => ""
1296
- #
1297
- # source://rexml//lib/rexml/document.rb#260
1298
- def xml_decl; end
1299
-
1300
- private
1301
-
1302
- # source://rexml//lib/rexml/document.rb#451
1303
- def build(source); end
1304
-
1305
- class << self
1306
- # Get the entity expansion limit. By default the limit is set to 10000.
1307
- #
1308
- # Deprecated. Use REXML::Security.entity_expansion_limit= instead.
1309
- #
1310
- # source://rexml//lib/rexml/document.rb#417
1311
- def entity_expansion_limit; end
1312
-
1313
- # Set the entity expansion limit. By default the limit is set to 10000.
1314
- #
1315
- # Deprecated. Use REXML::Security.entity_expansion_limit= instead.
1316
- #
1317
- # source://rexml//lib/rexml/document.rb#410
1318
- def entity_expansion_limit=(val); end
1319
-
1320
- # Get the entity expansion limit. By default the limit is set to 10240.
1321
- #
1322
- # Deprecated. Use REXML::Security.entity_expansion_text_limit instead.
1323
- #
1324
- # source://rexml//lib/rexml/document.rb#431
1325
- def entity_expansion_text_limit; end
1326
-
1327
- # Set the entity expansion limit. By default the limit is set to 10240.
1328
- #
1329
- # Deprecated. Use REXML::Security.entity_expansion_text_limit= instead.
1330
- #
1331
- # source://rexml//lib/rexml/document.rb#424
1332
- def entity_expansion_text_limit=(val); end
1333
-
1334
- # source://rexml//lib/rexml/document.rb#403
1335
- def parse_stream(source, listener); end
1336
- end
1337
- end
1338
-
1339
- # An \REXML::Element object represents an XML element.
1340
- #
1341
- # An element:
1342
- #
1343
- # - Has a name (string).
1344
- # - May have a parent (another element).
1345
- # - Has zero or more children
1346
- # (other elements, text, CDATA, processing instructions, and comments).
1347
- # - Has zero or more siblings
1348
- # (other elements, text, CDATA, processing instructions, and comments).
1349
- # - Has zero or more named attributes.
1350
- #
1351
- # == In a Hurry?
1352
- #
1353
- # If you're somewhat familiar with XML
1354
- # and have a particular task in mind,
1355
- # you may want to see the
1356
- # {tasks pages}[../doc/rexml/tasks/tocs/master_toc_rdoc.html],
1357
- # and in particular, the
1358
- # {tasks page for elements}[../doc/rexml/tasks/tocs/element_toc_rdoc.html].
1359
- #
1360
- # === Name
1361
- #
1362
- # An element has a name, which is initially set when the element is created:
1363
- #
1364
- # e = REXML::Element.new('foo')
1365
- # e.name # => "foo"
1366
- #
1367
- # The name may be changed:
1368
- #
1369
- # e.name = 'bar'
1370
- # e.name # => "bar"
1371
- #
1372
- #
1373
- # === \Parent
1374
- #
1375
- # An element may have a parent.
1376
- #
1377
- # Its parent may be assigned explicitly when the element is created:
1378
- #
1379
- # e0 = REXML::Element.new('foo')
1380
- # e1 = REXML::Element.new('bar', e0)
1381
- # e1.parent # => <foo> ... </>
1382
- #
1383
- # Note: the representation of an element always shows the element's name.
1384
- # If the element has children, the representation indicates that
1385
- # by including an ellipsis (<tt>...</tt>).
1386
- #
1387
- # The parent may be assigned explicitly at any time:
1388
- #
1389
- # e2 = REXML::Element.new('baz')
1390
- # e1.parent = e2
1391
- # e1.parent # => <baz/>
1392
- #
1393
- # When an element is added as a child, its parent is set automatically:
1394
- #
1395
- # e1.add_element(e0)
1396
- # e0.parent # => <bar> ... </>
1397
- #
1398
- # For an element that has no parent, method +parent+ returns +nil+.
1399
- #
1400
- # === Children
1401
- #
1402
- # An element has zero or more children.
1403
- # The children are an ordered collection
1404
- # of all objects whose parent is the element itself.
1405
- #
1406
- # The children may include any combination of elements, text, comments,
1407
- # processing instructions, and CDATA.
1408
- # (This example keeps things clean by controlling whitespace
1409
- # via a +context+ setting.)
1410
- #
1411
- # xml_string = <<-EOT
1412
- # <root>
1413
- # <ele_0/>
1414
- # text 0
1415
- # <!--comment 0-->
1416
- # <?target_0 pi_0?>
1417
- # <![CDATA[cdata 0]]>
1418
- # <ele_1/>
1419
- # text 1
1420
- # <!--comment 1-->
1421
- # <?target_0 pi_1?>
1422
- # <![CDATA[cdata 1]]>
1423
- # </root>
1424
- # EOT
1425
- # context = {ignore_whitespace_nodes: :all, compress_whitespace: :all}
1426
- # d = REXML::Document.new(xml_string, context)
1427
- # root = d.root
1428
- # root.children.size # => 10
1429
- # root.each {|child| p "#{child.class}: #{child}" }
1430
- #
1431
- # Output:
1432
- #
1433
- # "REXML::Element: <ele_0/>"
1434
- # "REXML::Text: \n text 0\n "
1435
- # "REXML::Comment: comment 0"
1436
- # "REXML::Instruction: <?target_0 pi_0?>"
1437
- # "REXML::CData: cdata 0"
1438
- # "REXML::Element: <ele_1/>"
1439
- # "REXML::Text: \n text 1\n "
1440
- # "REXML::Comment: comment 1"
1441
- # "REXML::Instruction: <?target_0 pi_1?>"
1442
- # "REXML::CData: cdata 1"
1443
- #
1444
- # A child may be added using inherited methods
1445
- # Parent#insert_before or Parent#insert_after:
1446
- #
1447
- # xml_string = '<root><a/><c/><d/></root>'
1448
- # d = REXML::Document.new(xml_string)
1449
- # root = d.root
1450
- # c = d.root[1] # => <c/>
1451
- # root.insert_before(c, REXML::Element.new('b'))
1452
- # root.to_a # => [<a/>, <b/>, <c/>, <d/>]
1453
- #
1454
- # A child may be replaced using Parent#replace_child:
1455
- #
1456
- # root.replace_child(c, REXML::Element.new('x'))
1457
- # root.to_a # => [<a/>, <b/>, <x/>, <d/>]
1458
- #
1459
- # A child may be removed using Parent#delete:
1460
- #
1461
- # x = root[2] # => <x/>
1462
- # root.delete(x)
1463
- # root.to_a # => [<a/>, <b/>, <d/>]
1464
- #
1465
- # === Siblings
1466
- #
1467
- # An element has zero or more siblings,
1468
- # which are the other children of the element's parent.
1469
- #
1470
- # In the example above, element +ele_1+ is between a CDATA sibling
1471
- # and a text sibling:
1472
- #
1473
- # ele_1 = root[5] # => <ele_1/>
1474
- # ele_1.previous_sibling # => "cdata 0"
1475
- # ele_1.next_sibling # => "\n text 1\n "
1476
- #
1477
- # === \Attributes
1478
- #
1479
- # An element has zero or more named attributes.
1480
- #
1481
- # A new element has no attributes:
1482
- #
1483
- # e = REXML::Element.new('foo')
1484
- # e.attributes # => {}
1485
- #
1486
- # Attributes may be added:
1487
- #
1488
- # e.add_attribute('bar', 'baz')
1489
- # e.add_attribute('bat', 'bam')
1490
- # e.attributes.size # => 2
1491
- # e['bar'] # => "baz"
1492
- # e['bat'] # => "bam"
1493
- #
1494
- # An existing attribute may be modified:
1495
- #
1496
- # e.add_attribute('bar', 'bad')
1497
- # e.attributes.size # => 2
1498
- # e['bar'] # => "bad"
1499
- #
1500
- # An existing attribute may be deleted:
1501
- #
1502
- # e.delete_attribute('bar')
1503
- # e.attributes.size # => 1
1504
- # e['bar'] # => nil
1505
- #
1506
- # == What's Here
1507
- #
1508
- # To begin with, what's elsewhere?
1509
- #
1510
- # \Class \REXML::Element inherits from its ancestor classes:
1511
- #
1512
- # - REXML::Child
1513
- # - REXML::Parent
1514
- #
1515
- # \REXML::Element itself and its ancestors also include modules:
1516
- #
1517
- # - {Enumerable}[https://docs.ruby-lang.org/en/master/Enumerable.html]
1518
- # - REXML::Namespace
1519
- # - REXML::Node
1520
- # - REXML::XMLTokens
1521
- #
1522
- # === Methods for Creating an \Element
1523
- #
1524
- # ::new:: Returns a new empty element.
1525
- # #clone:: Returns a clone of another element.
1526
- #
1527
- # === Methods for Attributes
1528
- #
1529
- # {[attribute_name]}[#method-i-5B-5D]:: Returns an attribute value.
1530
- # #add_attribute:: Adds a new attribute.
1531
- # #add_attributes:: Adds multiple new attributes.
1532
- # #attribute:: Returns the attribute value for a given name and optional namespace.
1533
- # #delete_attribute:: Removes an attribute.
1534
- #
1535
- # === Methods for Children
1536
- #
1537
- # {[index]}[#method-i-5B-5D]:: Returns the child at the given offset.
1538
- # #add_element:: Adds an element as the last child.
1539
- # #delete_element:: Deletes a child element.
1540
- # #each_element:: Calls the given block with each child element.
1541
- # #each_element_with_attribute:: Calls the given block with each child element
1542
- # that meets given criteria,
1543
- # which can include the attribute name.
1544
- # #each_element_with_text:: Calls the given block with each child element
1545
- # that meets given criteria,
1546
- # which can include text.
1547
- # #get_elements:: Returns an array of element children that match a given xpath.
1548
- #
1549
- # === Methods for \Text Children
1550
- #
1551
- # #add_text:: Adds a text node to the element.
1552
- # #get_text:: Returns a text node that meets specified criteria.
1553
- # #text:: Returns the text string from the first node that meets specified criteria.
1554
- # #texts:: Returns an array of the text children of the element.
1555
- # #text=:: Adds, removes, or replaces the first text child of the element
1556
- #
1557
- # === Methods for Other Children
1558
- #
1559
- # #cdatas:: Returns an array of the cdata children of the element.
1560
- # #comments:: Returns an array of the comment children of the element.
1561
- # #instructions:: Returns an array of the instruction children of the element.
1562
- #
1563
- # === Methods for Namespaces
1564
- #
1565
- # #add_namespace:: Adds a namespace to the element.
1566
- # #delete_namespace:: Removes a namespace from the element.
1567
- # #namespace:: Returns the string namespace URI for the element.
1568
- # #namespaces:: Returns a hash of all defined namespaces in the element.
1569
- # #prefixes:: Returns an array of the string prefixes (names)
1570
- # of all defined namespaces in the element
1571
- #
1572
- # === Methods for Querying
1573
- #
1574
- # #document:: Returns the document, if any, that the element belongs to.
1575
- # #root:: Returns the most distant element (not document) ancestor of the element.
1576
- # #root_node:: Returns the most distant ancestor of the element.
1577
- # #xpath:: Returns the string xpath to the element
1578
- # relative to the most distant parent
1579
- # #has_attributes?:: Returns whether the element has attributes.
1580
- # #has_elements?:: Returns whether the element has elements.
1581
- # #has_text?:: Returns whether the element has text.
1582
- # #next_element:: Returns the next sibling that is an element.
1583
- # #previous_element:: Returns the previous sibling that is an element.
1584
- # #raw:: Returns whether raw mode is set for the element.
1585
- # #whitespace:: Returns whether whitespace is respected for the element.
1586
- # #ignore_whitespace_nodes:: Returns whether whitespace nodes
1587
- # are to be ignored for the element.
1588
- # #node_type:: Returns symbol <tt>:element</tt>.
1589
- #
1590
- # === One More Method
1591
- #
1592
- # #inspect:: Returns a string representation of the element.
1593
- #
1594
- # === Accessors
1595
- #
1596
- # #elements:: Returns the REXML::Elements object for the element.
1597
- # #attributes:: Returns the REXML::Attributes object for the element.
1598
- # #context:: Returns or sets the context hash for the element.
1599
- #
1600
- # source://rexml//lib/rexml/element.rb#271
1601
- class REXML::Element < ::REXML::Parent
1602
- include ::REXML::XMLTokens
1603
- include ::REXML::Namespace
1604
-
1605
- # :call-seq:
1606
- # Element.new(name = 'UNDEFINED', parent = nil, context = nil) -> new_element
1607
- # Element.new(element, parent = nil, context = nil) -> new_element
1608
- #
1609
- # Returns a new \REXML::Element object.
1610
- #
1611
- # When no arguments are given,
1612
- # returns an element with name <tt>'UNDEFINED'</tt>:
1613
- #
1614
- # e = REXML::Element.new # => <UNDEFINED/>
1615
- # e.class # => REXML::Element
1616
- # e.name # => "UNDEFINED"
1617
- #
1618
- # When only argument +name+ is given,
1619
- # returns an element of the given name:
1620
- #
1621
- # REXML::Element.new('foo') # => <foo/>
1622
- #
1623
- # When only argument +element+ is given, it must be an \REXML::Element object;
1624
- # returns a shallow copy of the given element:
1625
- #
1626
- # e0 = REXML::Element.new('foo')
1627
- # e1 = REXML::Element.new(e0) # => <foo/>
1628
- #
1629
- # When argument +parent+ is also given, it must be an REXML::Parent object:
1630
- #
1631
- # e = REXML::Element.new('foo', REXML::Parent.new)
1632
- # e.parent # => #<REXML::Parent @parent=nil, @children=[<foo/>]>
1633
- #
1634
- # When argument +context+ is also given, it must be a hash
1635
- # representing the context for the element;
1636
- # see {Element Context}[../doc/rexml/context_rdoc.html]:
1637
- #
1638
- # e = REXML::Element.new('foo', nil, {raw: :all})
1639
- # e.context # => {:raw=>:all}
1640
- #
1641
- # @return [Element] a new instance of Element
1642
- #
1643
- # source://rexml//lib/rexml/element.rb#319
1644
- def initialize(arg = T.unsafe(nil), parent = T.unsafe(nil), context = T.unsafe(nil)); end
1645
-
1646
- # :call-seq:
1647
- # [index] -> object
1648
- # [attr_name] -> attr_value
1649
- # [attr_sym] -> attr_value
1650
- #
1651
- # With integer argument +index+ given,
1652
- # returns the child at offset +index+, or +nil+ if none:
1653
- #
1654
- # d = REXML::Document.new '><root><a/>text<b/>more<c/></root>'
1655
- # root = d.root
1656
- # (0..root.size).each do |index|
1657
- # node = root[index]
1658
- # p "#{index}: #{node} (#{node.class})"
1659
- # end
1660
- #
1661
- # Output:
1662
- #
1663
- # "0: <a/> (REXML::Element)"
1664
- # "1: text (REXML::Text)"
1665
- # "2: <b/> (REXML::Element)"
1666
- # "3: more (REXML::Text)"
1667
- # "4: <c/> (REXML::Element)"
1668
- # "5: (NilClass)"
1669
- #
1670
- # With string argument +attr_name+ given,
1671
- # returns the string value for the given attribute name if it exists,
1672
- # otherwise +nil+:
1673
- #
1674
- # d = REXML::Document.new('<root attr="value"></root>')
1675
- # root = d.root
1676
- # root['attr'] # => "value"
1677
- # root['nosuch'] # => nil
1678
- #
1679
- # With symbol argument +attr_sym+ given,
1680
- # returns <tt>[attr_sym.to_s]</tt>:
1681
- #
1682
- # root[:attr] # => "value"
1683
- # root[:nosuch] # => nil
1684
- #
1685
- # source://rexml//lib/rexml/element.rb#1246
1686
- def [](name_or_index); end
1687
-
1688
- # :call-seq:
1689
- # add_attribute(name, value) -> value
1690
- # add_attribute(attribute) -> attribute
1691
- #
1692
- # Adds an attribute to this element, overwriting any existing attribute
1693
- # by the same name.
1694
- #
1695
- # With string argument +name+ and object +value+ are given,
1696
- # adds the attribute created with that name and value:
1697
- #
1698
- # e = REXML::Element.new
1699
- # e.add_attribute('attr', 'value') # => "value"
1700
- # e['attr'] # => "value"
1701
- # e.add_attribute('attr', 'VALUE') # => "VALUE"
1702
- # e['attr'] # => "VALUE"
1703
- #
1704
- # With only attribute object +attribute+ given,
1705
- # adds the given attribute:
1706
- #
1707
- # a = REXML::Attribute.new('attr', 'value')
1708
- # e.add_attribute(a) # => attr='value'
1709
- # e['attr'] # => "value"
1710
- # a = REXML::Attribute.new('attr', 'VALUE')
1711
- # e.add_attribute(a) # => attr='VALUE'
1712
- # e['attr'] # => "VALUE"
1713
- #
1714
- # source://rexml//lib/rexml/element.rb#1345
1715
- def add_attribute(key, value = T.unsafe(nil)); end
1716
-
1717
- # :call-seq:
1718
- # add_attributes(hash) -> hash
1719
- # add_attributes(array)
1720
- #
1721
- # Adds zero or more attributes to the element;
1722
- # returns the argument.
1723
- #
1724
- # If hash argument +hash+ is given,
1725
- # each key must be a string;
1726
- # adds each attribute created with the key/value pair:
1727
- #
1728
- # e = REXML::Element.new
1729
- # h = {'foo' => 'bar', 'baz' => 'bat'}
1730
- # e.add_attributes(h)
1731
- #
1732
- # If argument +array+ is given,
1733
- # each array member must be a 2-element array <tt>[name, value];
1734
- # each name must be a string:
1735
- #
1736
- # e = REXML::Element.new
1737
- # a = [['foo' => 'bar'], ['baz' => 'bat']]
1738
- # e.add_attributes(a)
1739
- #
1740
- # source://rexml//lib/rexml/element.rb#1376
1741
- def add_attributes(hash); end
1742
-
1743
- # :call-seq:
1744
- # add_element(name, attributes = nil) -> new_element
1745
- # add_element(element, attributes = nil) -> element
1746
- #
1747
- # Adds a child element, optionally setting attributes
1748
- # on the added element; returns the added element.
1749
- #
1750
- # With string argument +name+, creates a new element with that name
1751
- # and adds the new element as a child:
1752
- #
1753
- # e0 = REXML::Element.new('foo')
1754
- # e0.add_element('bar')
1755
- # e0[0] # => <bar/>
1756
- #
1757
- #
1758
- # With argument +name+ and hash argument +attributes+,
1759
- # sets attributes on the new element:
1760
- #
1761
- # e0.add_element('baz', {'bat' => '0', 'bam' => '1'})
1762
- # e0[1] # => <baz bat='0' bam='1'/>
1763
- #
1764
- # With element argument +element+, adds that element as a child:
1765
- #
1766
- # e0 = REXML::Element.new('foo')
1767
- # e1 = REXML::Element.new('bar')
1768
- # e0.add_element(e1)
1769
- # e0[0] # => <bar/>
1770
- #
1771
- # With argument +element+ and hash argument +attributes+,
1772
- # sets attributes on the added element:
1773
- #
1774
- # e0.add_element(e1, {'bat' => '0', 'bam' => '1'})
1775
- # e0[1] # => <bar bat='0' bam='1'/>
1776
- #
1777
- # source://rexml//lib/rexml/element.rb#732
1778
- def add_element(element, attrs = T.unsafe(nil)); end
1779
-
1780
- # :call-seq:
1781
- # add_namespace(prefix, uri = nil) -> self
1782
- #
1783
- # Adds a namespace to the element; returns +self+.
1784
- #
1785
- # With the single argument +prefix+,
1786
- # adds a namespace using the given +prefix+ and the namespace URI:
1787
- #
1788
- # e = REXML::Element.new('foo')
1789
- # e.add_namespace('bar')
1790
- # e.namespaces # => {"xmlns"=>"bar"}
1791
- #
1792
- # With both arguments +prefix+ and +uri+ given,
1793
- # adds a namespace using both arguments:
1794
- #
1795
- # e.add_namespace('baz', 'bat')
1796
- # e.namespaces # => {"xmlns"=>"bar", "baz"=>"bat"}
1797
- #
1798
- # source://rexml//lib/rexml/element.rb#655
1799
- def add_namespace(prefix, uri = T.unsafe(nil)); end
1800
-
1801
- # :call-seq:
1802
- # add_text(string) -> nil
1803
- # add_text(text_node) -> self
1804
- #
1805
- # Adds text to the element.
1806
- #
1807
- # When string argument +string+ is given, returns +nil+.
1808
- #
1809
- # If the element has no child text node,
1810
- # creates a \REXML::Text object using the string,
1811
- # honoring the current settings for whitespace and raw,
1812
- # then adds that node to the element:
1813
- #
1814
- # d = REXML::Document.new('<a><b/></a>')
1815
- # a = d.root
1816
- # a.add_text('foo')
1817
- # a.to_a # => [<b/>, "foo"]
1818
- #
1819
- # If the element has child text nodes,
1820
- # appends the string to the _last_ text node:
1821
- #
1822
- # d = REXML::Document.new('<a>foo<b/>bar</a>')
1823
- # a = d.root
1824
- # a.add_text('baz')
1825
- # a.to_a # => ["foo", <b/>, "barbaz"]
1826
- # a.add_text('baz')
1827
- # a.to_a # => ["foo", <b/>, "barbazbaz"]
1828
- #
1829
- # When text node argument +text_node+ is given,
1830
- # appends the node as the last text node in the element;
1831
- # returns +self+:
1832
- #
1833
- # d = REXML::Document.new('<a>foo<b/>bar</a>')
1834
- # a = d.root
1835
- # a.add_text(REXML::Text.new('baz'))
1836
- # a.to_a # => ["foo", <b/>, "bar", "baz"]
1837
- # a.add_text(REXML::Text.new('baz'))
1838
- # a.to_a # => ["foo", <b/>, "bar", "baz", "baz"]
1839
- #
1840
- # source://rexml//lib/rexml/element.rb#1147
1841
- def add_text(text); end
1842
-
1843
- # :call-seq:
1844
- # attribute(name, namespace = nil)
1845
- #
1846
- # Returns the string value for the given attribute name.
1847
- #
1848
- # With only argument +name+ given,
1849
- # returns the value of the named attribute if it exists, otherwise +nil+:
1850
- #
1851
- # xml_string = <<-EOT
1852
- # <root xmlns="ns0">
1853
- # <a xmlns="ns1" attr="value"></a>
1854
- # <b xmlns="ns2" attr="value"></b>
1855
- # <c attr="value"/>
1856
- # </root>
1857
- # EOT
1858
- # d = REXML::Document.new(xml_string)
1859
- # root = d.root
1860
- # a = root[1] # => <a xmlns='ns1' attr='value'/>
1861
- # a.attribute('attr') # => attr='value'
1862
- # a.attribute('nope') # => nil
1863
- #
1864
- # With arguments +name+ and +namespace+ given,
1865
- # returns the value of the named attribute if it exists, otherwise +nil+:
1866
- #
1867
- # xml_string = "<root xmlns:a='a' a:x='a:x' x='x'/>"
1868
- # document = REXML::Document.new(xml_string)
1869
- # document.root.attribute("x") # => x='x'
1870
- # document.root.attribute("x", "a") # => a:x='a:x'
1871
- #
1872
- # source://rexml//lib/rexml/element.rb#1287
1873
- def attribute(name, namespace = T.unsafe(nil)); end
1874
-
1875
- # Mechanisms for accessing attributes and child elements of this
1876
- # element.
1877
- #
1878
- # source://rexml//lib/rexml/element.rb#278
1879
- def attributes; end
1880
-
1881
- # :call-seq:
1882
- # cdatas -> array_of_cdata_children
1883
- #
1884
- # Returns a frozen array of the REXML::CData children of the element:
1885
- #
1886
- # xml_string = <<-EOT
1887
- # <root>
1888
- # <![CDATA[foo]]>
1889
- # <![CDATA[bar]]>
1890
- # </root>
1891
- # EOT
1892
- # d = REXML::Document.new(xml_string)
1893
- # cds = d.root.cdatas # => ["foo", "bar"]
1894
- # cds.frozen? # => true
1895
- # cds.map {|cd| cd.class } # => [REXML::CData, REXML::CData]
1896
- #
1897
- # source://rexml//lib/rexml/element.rb#1420
1898
- def cdatas; end
1899
-
1900
- # :call-seq:
1901
- # clone -> new_element
1902
- #
1903
- # Returns a shallow copy of the element, containing the name and attributes,
1904
- # but not the parent or children:
1905
- #
1906
- # e = REXML::Element.new('foo')
1907
- # e.add_attributes({'bar' => 0, 'baz' => 1})
1908
- # e.clone # => <foo bar='0' baz='1'/>
1909
- #
1910
- # source://rexml//lib/rexml/element.rb#383
1911
- def clone; end
1912
-
1913
- # :call-seq:
1914
- # comments -> array_of_comment_children
1915
- #
1916
- # Returns a frozen array of the REXML::Comment children of the element:
1917
- #
1918
- # xml_string = <<-EOT
1919
- # <root>
1920
- # <!--foo-->
1921
- # <!--bar-->
1922
- # </root>
1923
- # EOT
1924
- # d = REXML::Document.new(xml_string)
1925
- # cs = d.root.comments
1926
- # cs.frozen? # => true
1927
- # cs.map {|c| c.class } # => [REXML::Comment, REXML::Comment]
1928
- # cs.map {|c| c.to_s } # => ["foo", "bar"]
1929
- #
1930
- # source://rexml//lib/rexml/element.rb#1441
1931
- def comments; end
1932
-
1933
- # The context holds information about the processing environment, such as
1934
- # whitespace handling.
1935
- #
1936
- # source://rexml//lib/rexml/element.rb#281
1937
- def context; end
1938
-
1939
- # The context holds information about the processing environment, such as
1940
- # whitespace handling.
1941
- #
1942
- # source://rexml//lib/rexml/element.rb#281
1943
- def context=(_arg0); end
1944
-
1945
- # :call-seq:
1946
- # delete_attribute(name) -> removed_attribute or nil
1947
- #
1948
- # Removes a named attribute if it exists;
1949
- # returns the removed attribute if found, otherwise +nil+:
1950
- #
1951
- # e = REXML::Element.new('foo')
1952
- # e.add_attribute('bar', 'baz')
1953
- # e.delete_attribute('bar') # => <bar/>
1954
- # e.delete_attribute('bar') # => nil
1955
- #
1956
- # source://rexml//lib/rexml/element.rb#1395
1957
- def delete_attribute(key); end
1958
-
1959
- # :call-seq:
1960
- # delete_element(index) -> removed_element or nil
1961
- # delete_element(element) -> removed_element or nil
1962
- # delete_element(xpath) -> removed_element or nil
1963
- #
1964
- # Deletes a child element.
1965
- #
1966
- # When 1-based integer argument +index+ is given,
1967
- # removes and returns the child element at that offset if it exists;
1968
- # indexing does not include text nodes;
1969
- # returns +nil+ if the element does not exist:
1970
- #
1971
- # d = REXML::Document.new '<a><b/>text<c/></a>'
1972
- # a = d.root # => <a> ... </>
1973
- # a.delete_element(1) # => <b/>
1974
- # a.delete_element(1) # => <c/>
1975
- # a.delete_element(1) # => nil
1976
- #
1977
- # When element argument +element+ is given,
1978
- # removes and returns that child element if it exists,
1979
- # otherwise returns +nil+:
1980
- #
1981
- # d = REXML::Document.new '<a><b/>text<c/></a>'
1982
- # a = d.root # => <a> ... </>
1983
- # c = a[2] # => <c/>
1984
- # a.delete_element(c) # => <c/>
1985
- # a.delete_element(c) # => nil
1986
- #
1987
- # When xpath argument +xpath+ is given,
1988
- # removes and returns the element at xpath if it exists,
1989
- # otherwise returns +nil+:
1990
- #
1991
- # d = REXML::Document.new '<a><b/>text<c/></a>'
1992
- # a = d.root # => <a> ... </>
1993
- # a.delete_element('//c') # => <c/>
1994
- # a.delete_element('//c') # => nil
1995
- #
1996
- # source://rexml//lib/rexml/element.rb#778
1997
- def delete_element(element); end
1998
-
1999
- # :call-seq:
2000
- # delete_namespace(namespace = 'xmlns') -> self
2001
- #
2002
- # Removes a namespace from the element.
2003
- #
2004
- # With no argument, removes the default namespace:
2005
- #
2006
- # d = REXML::Document.new "<a xmlns:foo='bar' xmlns='twiddle'/>"
2007
- # d.to_s # => "<a xmlns:foo='bar' xmlns='twiddle'/>"
2008
- # d.root.delete_namespace # => <a xmlns:foo='bar'/>
2009
- # d.to_s # => "<a xmlns:foo='bar'/>"
2010
- #
2011
- # With argument +namespace+, removes the specified namespace:
2012
- #
2013
- # d.root.delete_namespace('foo')
2014
- # d.to_s # => "<a/>"
2015
- #
2016
- # Does nothing if no such namespace is found:
2017
- #
2018
- # d.root.delete_namespace('nosuch')
2019
- # d.to_s # => "<a/>"
2020
- #
2021
- # source://rexml//lib/rexml/element.rb#687
2022
- def delete_namespace(namespace = T.unsafe(nil)); end
2023
-
2024
- # :call-seq:
2025
- # document -> document or nil
2026
- #
2027
- # If the element is part of a document, returns that document:
2028
- #
2029
- # d = REXML::Document.new('<a><b><c/></b></a>')
2030
- # top_element = d.first
2031
- # child = top_element.first
2032
- # top_element.document == d # => true
2033
- # child.document == d # => true
2034
- #
2035
- # If the element is not part of a document, returns +nil+:
2036
- #
2037
- # REXML::Element.new.document # => nil
2038
- #
2039
- # For a document, returns +self+:
2040
- #
2041
- # d.document == d # => true
2042
- #
2043
- # Related: #root, #root_node.
2044
- #
2045
- # source://rexml//lib/rexml/element.rb#475
2046
- def document; end
2047
-
2048
- # :call-seq:
2049
- # each_element {|e| ... }
2050
- #
2051
- # Calls the given block with each child element:
2052
- #
2053
- # d = REXML::Document.new '<a><b>b</b><c>b</c><d>d</d><e/></a>'
2054
- # a = d.root
2055
- # a.each_element {|e| p e }
2056
- #
2057
- # Output:
2058
- #
2059
- # <b> ... </>
2060
- # <c> ... </>
2061
- # <d> ... </>
2062
- # <e/>
2063
- #
2064
- # source://rexml//lib/rexml/element.rb#930
2065
- def each_element(xpath = T.unsafe(nil), &block); end
2066
-
2067
- # :call-seq:
2068
- # each_element_with_attribute(attr_name, value = nil, max = 0, xpath = nil) {|e| ... }
2069
- #
2070
- # Calls the given block with each child element that meets given criteria.
2071
- #
2072
- # When only string argument +attr_name+ is given,
2073
- # calls the block with each child element that has that attribute:
2074
- #
2075
- # d = REXML::Document.new '<a><b id="1"/><c id="2"/><d id="1"/><e/></a>'
2076
- # a = d.root
2077
- # a.each_element_with_attribute('id') {|e| p e }
2078
- #
2079
- # Output:
2080
- #
2081
- # <b id='1'/>
2082
- # <c id='2'/>
2083
- # <d id='1'/>
2084
- #
2085
- # With argument +attr_name+ and string argument +value+ given,
2086
- # calls the block with each child element that has that attribute
2087
- # with that value:
2088
- #
2089
- # a.each_element_with_attribute('id', '1') {|e| p e }
2090
- #
2091
- # Output:
2092
- #
2093
- # <b id='1'/>
2094
- # <d id='1'/>
2095
- #
2096
- # With arguments +attr_name+, +value+, and integer argument +max+ given,
2097
- # calls the block with at most +max+ child elements:
2098
- #
2099
- # a.each_element_with_attribute('id', '1', 1) {|e| p e }
2100
- #
2101
- # Output:
2102
- #
2103
- # <b id='1'/>
2104
- #
2105
- # With all arguments given, including +xpath+,
2106
- # calls the block with only those child elements
2107
- # that meet the first three criteria,
2108
- # and also match the given +xpath+:
2109
- #
2110
- # a.each_element_with_attribute('id', '1', 2, '//d') {|e| p e }
2111
- #
2112
- # Output:
2113
- #
2114
- # <d id='1'/>
2115
- #
2116
- # source://rexml//lib/rexml/element.rb#847
2117
- def each_element_with_attribute(key, value = T.unsafe(nil), max = T.unsafe(nil), name = T.unsafe(nil), &block); end
2118
-
2119
- # :call-seq:
2120
- # each_element_with_text(text = nil, max = 0, xpath = nil) {|e| ... }
2121
- #
2122
- # Calls the given block with each child element that meets given criteria.
2123
- #
2124
- # With no arguments, calls the block with each child element that has text:
2125
- #
2126
- # d = REXML::Document.new '<a><b>b</b><c>b</c><d>d</d><e/></a>'
2127
- # a = d.root
2128
- # a.each_element_with_text {|e| p e }
2129
- #
2130
- # Output:
2131
- #
2132
- # <b> ... </>
2133
- # <c> ... </>
2134
- # <d> ... </>
2135
- #
2136
- # With the single string argument +text+,
2137
- # calls the block with each element that has exactly that text:
2138
- #
2139
- # a.each_element_with_text('b') {|e| p e }
2140
- #
2141
- # Output:
2142
- #
2143
- # <b> ... </>
2144
- # <c> ... </>
2145
- #
2146
- # With argument +text+ and integer argument +max+,
2147
- # calls the block with at most +max+ elements:
2148
- #
2149
- # a.each_element_with_text('b', 1) {|e| p e }
2150
- #
2151
- # Output:
2152
- #
2153
- # <b> ... </>
2154
- #
2155
- # With all arguments given, including +xpath+,
2156
- # calls the block with only those child elements
2157
- # that meet the first two criteria,
2158
- # and also match the given +xpath+:
2159
- #
2160
- # a.each_element_with_text('b', 2, '//c') {|e| p e }
2161
- #
2162
- # Output:
2163
- #
2164
- # <c> ... </>
2165
- #
2166
- # source://rexml//lib/rexml/element.rb#904
2167
- def each_element_with_text(text = T.unsafe(nil), max = T.unsafe(nil), name = T.unsafe(nil), &block); end
2168
-
2169
- # Mechanisms for accessing attributes and child elements of this
2170
- # element.
2171
- #
2172
- # source://rexml//lib/rexml/element.rb#278
2173
- def elements; end
2174
-
2175
- # :call-seq:
2176
- # get_elements(xpath)
2177
- #
2178
- # Returns an array of the elements that match the given +xpath+:
2179
- #
2180
- # xml_string = <<-EOT
2181
- # <root>
2182
- # <a level='1'>
2183
- # <a level='2'/>
2184
- # </a>
2185
- # </root>
2186
- # EOT
2187
- # d = REXML::Document.new(xml_string)
2188
- # d.root.get_elements('//a') # => [<a level='1'> ... </>, <a level='2'/>]
2189
- #
2190
- # source://rexml//lib/rexml/element.rb#949
2191
- def get_elements(xpath); end
2192
-
2193
- # :call-seq:
2194
- # get_text(xpath = nil) -> text_node or nil
2195
- #
2196
- # Returns the first text node child in a specified element, if it exists,
2197
- # +nil+ otherwise.
2198
- #
2199
- # With no argument, returns the first text node from +self+:
2200
- #
2201
- # d = REXML::Document.new "<p>some text <b>this is bold!</b> more text</p>"
2202
- # d.root.get_text.class # => REXML::Text
2203
- # d.root.get_text # => "some text "
2204
- #
2205
- # With argument +xpath+, returns the first text node from the element
2206
- # that matches +xpath+:
2207
- #
2208
- # d.root.get_text(1) # => "this is bold!"
2209
- #
2210
- # source://rexml//lib/rexml/element.rb#1053
2211
- def get_text(path = T.unsafe(nil)); end
2212
-
2213
- # :call-seq:
2214
- # has_attributes? -> true or false
2215
- #
2216
- # Returns +true+ if the element has attributes, +false+ otherwise:
2217
- #
2218
- # d = REXML::Document.new('<root><a attr="val"/><b/></root>')
2219
- # a, b = *d.root
2220
- # a.has_attributes? # => true
2221
- # b.has_attributes? # => false
2222
- #
2223
- # @return [Boolean]
2224
- #
2225
- # source://rexml//lib/rexml/element.rb#1315
2226
- def has_attributes?; end
2227
-
2228
- # :call-seq:
2229
- # has_elements?
2230
- #
2231
- # Returns +true+ if the element has one or more element children,
2232
- # +false+ otherwise:
2233
- #
2234
- # d = REXML::Document.new '<a><b/>text<c/></a>'
2235
- # a = d.root # => <a> ... </>
2236
- # a.has_elements? # => true
2237
- # b = a[0] # => <b/>
2238
- # b.has_elements? # => false
2239
- #
2240
- # @return [Boolean]
2241
- #
2242
- # source://rexml//lib/rexml/element.rb#794
2243
- def has_elements?; end
2244
-
2245
- # :call-seq:
2246
- # has_text? -> true or false
2247
- #
2248
- # Returns +true+ if the element has one or more text noded,
2249
- # +false+ otherwise:
2250
- #
2251
- # d = REXML::Document.new '<a><b/>text<c/></a>'
2252
- # a = d.root
2253
- # a.has_text? # => true
2254
- # b = a[0]
2255
- # b.has_text? # => false
2256
- #
2257
- # @return [Boolean]
2258
- #
2259
- # source://rexml//lib/rexml/element.rb#1002
2260
- def has_text?; end
2261
-
2262
- # :call-seq:
2263
- # ignore_whitespace_nodes
2264
- #
2265
- # Returns +true+ if whitespace nodes are ignored for the element.
2266
- #
2267
- # See {Element Context}[../doc/rexml/context_rdoc.html].
2268
- #
2269
- # source://rexml//lib/rexml/element.rb#513
2270
- def ignore_whitespace_nodes; end
2271
-
2272
- # :call-seq:
2273
- # inspect -> string
2274
- #
2275
- # Returns a string representation of the element.
2276
- #
2277
- # For an element with no attributes and no children, shows the element name:
2278
- #
2279
- # REXML::Element.new.inspect # => "<UNDEFINED/>"
2280
- #
2281
- # Shows attributes, if any:
2282
- #
2283
- # e = REXML::Element.new('foo')
2284
- # e.add_attributes({'bar' => 0, 'baz' => 1})
2285
- # e.inspect # => "<foo bar='0' baz='1'/>"
2286
- #
2287
- # Shows an ellipsis (<tt>...</tt>), if there are child elements:
2288
- #
2289
- # e.add_element(REXML::Element.new('bar'))
2290
- # e.add_element(REXML::Element.new('baz'))
2291
- # e.inspect # => "<foo bar='0' baz='1'> ... </>"
2292
- #
2293
- # source://rexml//lib/rexml/element.rb#358
2294
- def inspect; end
2295
-
2296
- # :call-seq:
2297
- # instructions -> array_of_instruction_children
2298
- #
2299
- # Returns a frozen array of the REXML::Instruction children of the element:
2300
- #
2301
- # xml_string = <<-EOT
2302
- # <root>
2303
- # <?target0 foo?>
2304
- # <?target1 bar?>
2305
- # </root>
2306
- # EOT
2307
- # d = REXML::Document.new(xml_string)
2308
- # is = d.root.instructions
2309
- # is.frozen? # => true
2310
- # is.map {|i| i.class } # => [REXML::Instruction, REXML::Instruction]
2311
- # is.map {|i| i.to_s } # => ["<?target0 foo?>", "<?target1 bar?>"]
2312
- #
2313
- # source://rexml//lib/rexml/element.rb#1462
2314
- def instructions; end
2315
-
2316
- # :call-seq:
2317
- # namespace(prefix = nil) -> string_uri or nil
2318
- #
2319
- # Returns the string namespace URI for the element,
2320
- # possibly deriving from one of its ancestors.
2321
- #
2322
- # xml_string = <<-EOT
2323
- # <root>
2324
- # <a xmlns='1' xmlns:y='2'>
2325
- # <b/>
2326
- # <c xmlns:z='3'/>
2327
- # </a>
2328
- # </root>
2329
- # EOT
2330
- # d = REXML::Document.new(xml_string)
2331
- # b = d.elements['//b']
2332
- # b.namespace # => "1"
2333
- # b.namespace('y') # => "2"
2334
- # b.namespace('nosuch') # => nil
2335
- #
2336
- # source://rexml//lib/rexml/element.rb#618
2337
- def namespace(prefix = T.unsafe(nil)); end
2338
-
2339
- # :call-seq:
2340
- # namespaces -> array_of_namespace_names
2341
- #
2342
- # Returns a hash of all defined namespaces
2343
- # in the element and its ancestors:
2344
- #
2345
- # xml_string = <<-EOT
2346
- # <root>
2347
- # <a xmlns:x='1' xmlns:y='2'>
2348
- # <b/>
2349
- # <c xmlns:z='3'/>
2350
- # </a>
2351
- # </root>
2352
- # EOT
2353
- # d = REXML::Document.new(xml_string)
2354
- # d.elements['//a'].namespaces # => {"x"=>"1", "y"=>"2"}
2355
- # d.elements['//b'].namespaces # => {"x"=>"1", "y"=>"2"}
2356
- # d.elements['//c'].namespaces # => {"x"=>"1", "y"=>"2", "z"=>"3"}
2357
- #
2358
- # source://rexml//lib/rexml/element.rb#591
2359
- def namespaces; end
2360
-
2361
- # :call-seq:
2362
- # next_element
2363
- #
2364
- # Returns the next sibling that is an element if it exists,
2365
- # +niL+ otherwise:
2366
- #
2367
- # d = REXML::Document.new '<a><b/>text<c/></a>'
2368
- # d.root.elements['b'].next_element #-> <c/>
2369
- # d.root.elements['c'].next_element #-> nil
2370
- #
2371
- # source://rexml//lib/rexml/element.rb#963
2372
- def next_element; end
2373
-
2374
- # :call-seq:
2375
- # node_type -> :element
2376
- #
2377
- # Returns symbol <tt>:element</tt>:
2378
- #
2379
- # d = REXML::Document.new('<a/>')
2380
- # a = d.root # => <a/>
2381
- # a.node_type # => :element
2382
- #
2383
- # source://rexml//lib/rexml/element.rb#1168
2384
- def node_type; end
2385
-
2386
- # :call-seq:
2387
- # prefixes -> array_of_namespace_prefixes
2388
- #
2389
- # Returns an array of the string prefixes (names) of all defined namespaces
2390
- # in the element and its ancestors:
2391
- #
2392
- # xml_string = <<-EOT
2393
- # <root>
2394
- # <a xmlns:x='1' xmlns:y='2'>
2395
- # <b/>
2396
- # <c xmlns:z='3'/>
2397
- # </a>
2398
- # </root>
2399
- # EOT
2400
- # d = REXML::Document.new(xml_string, {compress_whitespace: :all})
2401
- # d.elements['//a'].prefixes # => ["x", "y"]
2402
- # d.elements['//b'].prefixes # => ["x", "y"]
2403
- # d.elements['//c'].prefixes # => ["x", "y", "z"]
2404
- #
2405
- # source://rexml//lib/rexml/element.rb#565
2406
- def prefixes; end
2407
-
2408
- # :call-seq:
2409
- # previous_element
2410
- #
2411
- # Returns the previous sibling that is an element if it exists,
2412
- # +niL+ otherwise:
2413
- #
2414
- # d = REXML::Document.new '<a><b/>text<c/></a>'
2415
- # d.root.elements['c'].previous_element #-> <b/>
2416
- # d.root.elements['b'].previous_element #-> nil
2417
- #
2418
- # source://rexml//lib/rexml/element.rb#979
2419
- def previous_element; end
2420
-
2421
- # :call-seq:
2422
- # raw
2423
- #
2424
- # Returns +true+ if raw mode is set for the element.
2425
- #
2426
- # See {Element Context}[../doc/rexml/context_rdoc.html].
2427
- #
2428
- # The evaluation is tested against +expanded_name+, and so is namespace
2429
- # sensitive.
2430
- #
2431
- # source://rexml//lib/rexml/element.rb#533
2432
- def raw; end
2433
-
2434
- # :call-seq:
2435
- # root -> element
2436
- #
2437
- # Returns the most distant _element_ (not document) ancestor of the element:
2438
- #
2439
- # d = REXML::Document.new('<a><b><c/></b></a>')
2440
- # top_element = d.first
2441
- # child = top_element.first
2442
- # top_element.root == top_element # => true
2443
- # child.root == top_element # => true
2444
- #
2445
- # For a document, returns the topmost element:
2446
- #
2447
- # d.root == top_element # => true
2448
- #
2449
- # Related: #root_node, #document.
2450
- #
2451
- # source://rexml//lib/rexml/element.rb#443
2452
- def root; end
2453
-
2454
- # :call-seq:
2455
- # root_node -> document or element
2456
- #
2457
- # Returns the most distant ancestor of +self+.
2458
- #
2459
- # When the element is part of a document,
2460
- # returns the root node of the document.
2461
- # Note that the root node is different from the document element;
2462
- # in this example +a+ is document element and the root node is its parent:
2463
- #
2464
- # d = REXML::Document.new('<a><b><c/></b></a>')
2465
- # top_element = d.first # => <a> ... </>
2466
- # child = top_element.first # => <b> ... </>
2467
- # d.root_node == d # => true
2468
- # top_element.root_node == d # => true
2469
- # child.root_node == d # => true
2470
- #
2471
- # When the element is not part of a document, but does have ancestor elements,
2472
- # returns the most distant ancestor element:
2473
- #
2474
- # e0 = REXML::Element.new('foo')
2475
- # e1 = REXML::Element.new('bar')
2476
- # e1.parent = e0
2477
- # e2 = REXML::Element.new('baz')
2478
- # e2.parent = e1
2479
- # e2.root_node == e0 # => true
2480
- #
2481
- # When the element has no ancestor elements,
2482
- # returns +self+:
2483
- #
2484
- # e = REXML::Element.new('foo')
2485
- # e.root_node == e # => true
2486
- #
2487
- # Related: #root, #document.
2488
- #
2489
- # source://rexml//lib/rexml/element.rb#422
2490
- def root_node; end
2491
-
2492
- # :call-seq:
2493
- # text(xpath = nil) -> text_string or nil
2494
- #
2495
- # Returns the text string from the first text node child
2496
- # in a specified element, if it exists, +nil+ otherwise.
2497
- #
2498
- # With no argument, returns the text from the first text node in +self+:
2499
- #
2500
- # d = REXML::Document.new "<p>some text <b>this is bold!</b> more text</p>"
2501
- # d.root.text.class # => String
2502
- # d.root.text # => "some text "
2503
- #
2504
- # With argument +xpath+, returns text from the first text node
2505
- # in the element that matches +xpath+:
2506
- #
2507
- # d.root.text(1) # => "this is bold!"
2508
- #
2509
- # Note that an element may have multiple text nodes,
2510
- # possibly separated by other non-text children, as above.
2511
- # Even so, the returned value is the string text from the first such node.
2512
- #
2513
- # Note also that the text note is retrieved by method get_text,
2514
- # and so is always normalized text.
2515
- #
2516
- # source://rexml//lib/rexml/element.rb#1030
2517
- def text(path = T.unsafe(nil)); end
2518
-
2519
- # :call-seq:
2520
- # text = string -> string
2521
- # text = nil -> nil
2522
- #
2523
- # Adds, replaces, or removes the first text node child in the element.
2524
- #
2525
- # With string argument +string+,
2526
- # creates a new \REXML::Text node containing that string,
2527
- # honoring the current settings for whitespace and row,
2528
- # then places the node as the first text child in the element;
2529
- # returns +string+.
2530
- #
2531
- # If the element has no text child, the text node is added:
2532
- #
2533
- # d = REXML::Document.new '<a><b/></a>'
2534
- # d.root.text = 'foo' #-> '<a><b/>foo</a>'
2535
- #
2536
- # If the element has a text child, it is replaced:
2537
- #
2538
- # d.root.text = 'bar' #-> '<a><b/>bar</a>'
2539
- #
2540
- # With argument +nil+, removes the first text child:
2541
- #
2542
- # d.root.text = nil #-> '<a><b/><c/></a>'
2543
- #
2544
- # source://rexml//lib/rexml/element.rb#1089
2545
- def text=(text); end
2546
-
2547
- # :call-seq:
2548
- # texts -> array_of_text_children
2549
- #
2550
- # Returns a frozen array of the REXML::Text children of the element:
2551
- #
2552
- # xml_string = '<root><a/>text<b/>more<c/></root>'
2553
- # d = REXML::Document.new(xml_string)
2554
- # ts = d.root.texts
2555
- # ts.frozen? # => true
2556
- # ts.map {|t| t.class } # => [REXML::Text, REXML::Text]
2557
- # ts.map {|t| t.to_s } # => ["text", "more"]
2558
- #
2559
- # source://rexml//lib/rexml/element.rb#1478
2560
- def texts; end
2561
-
2562
- # :call-seq:
2563
- # whitespace
2564
- #
2565
- # Returns +true+ if whitespace is respected for this element,
2566
- # +false+ otherwise.
2567
- #
2568
- # See {Element Context}[../doc/rexml/context_rdoc.html].
2569
- #
2570
- # The evaluation is tested against the element's +expanded_name+,
2571
- # and so is namespace-sensitive.
2572
- #
2573
- # source://rexml//lib/rexml/element.rb#490
2574
- def whitespace; end
2575
-
2576
- # == DEPRECATED
2577
- # See REXML::Formatters
2578
- #
2579
- # Writes out this element, and recursively, all children.
2580
- # output::
2581
- # output an object which supports '<< string'; this is where the
2582
- # document will be written.
2583
- # indent::
2584
- # An integer. If -1, no indenting will be used; otherwise, the
2585
- # indentation will be this number of spaces, and children will be
2586
- # indented an additional amount. Defaults to -1
2587
- # transitive::
2588
- # If transitive is true and indent is >= 0, then the output will be
2589
- # pretty-printed in such a way that the added whitespace does not affect
2590
- # the parse tree of the document
2591
- # ie_hack::
2592
- # This hack inserts a space before the /> on empty tags to address
2593
- # a limitation of Internet Explorer. Defaults to false
2594
- #
2595
- # out = ''
2596
- # doc.write( out ) #-> doc is written to the string 'out'
2597
- # doc.write( $stdout ) #-> doc written to the console
2598
- #
2599
- # source://rexml//lib/rexml/element.rb#1504
2600
- def write(output = T.unsafe(nil), indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
2601
-
2602
- # :call-seq:
2603
- # xpath -> string_xpath
2604
- #
2605
- # Returns the string xpath to the element
2606
- # relative to the most distant parent:
2607
- #
2608
- # d = REXML::Document.new('<a><b><c/></b></a>')
2609
- # a = d.root # => <a> ... </>
2610
- # b = a[0] # => <b> ... </>
2611
- # c = b[0] # => <c/>
2612
- # d.xpath # => ""
2613
- # a.xpath # => "/a"
2614
- # b.xpath # => "/a/b"
2615
- # c.xpath # => "/a/b/c"
2616
- #
2617
- # If there is no parent, returns the expanded name of the element:
2618
- #
2619
- # e = REXML::Element.new('foo')
2620
- # e.xpath # => "foo"
2621
- #
2622
- # source://rexml//lib/rexml/element.rb#1192
2623
- def xpath; end
2624
-
2625
- private
2626
-
2627
- # source://rexml//lib/rexml/element.rb#1521
2628
- def __to_xpath_helper(node); end
2629
-
2630
- # A private helper method
2631
- #
2632
- # source://rexml//lib/rexml/element.rb#1536
2633
- def each_with_something(test, max = T.unsafe(nil), name = T.unsafe(nil)); end
2634
- end
2635
-
2636
- # source://rexml//lib/rexml/doctype.rb#261
2637
- class REXML::ElementDecl < ::REXML::Declaration
2638
- # @return [ElementDecl] a new instance of ElementDecl
2639
- #
2640
- # source://rexml//lib/rexml/doctype.rb#262
2641
- def initialize(src); end
2642
- end
2643
-
2644
- # A class which provides filtering of children for Elements, and
2645
- # XPath search support. You are expected to only encounter this class as
2646
- # the <tt>element.elements</tt> object. Therefore, you are
2647
- # _not_ expected to instantiate this yourself.
2648
- #
2649
- # xml_string = <<-EOT
2650
- # <?xml version="1.0" encoding="UTF-8"?>
2651
- # <bookstore>
2652
- # <book category="cooking">
2653
- # <title lang="en">Everyday Italian</title>
2654
- # <author>Giada De Laurentiis</author>
2655
- # <year>2005</year>
2656
- # <price>30.00</price>
2657
- # </book>
2658
- # <book category="children">
2659
- # <title lang="en">Harry Potter</title>
2660
- # <author>J K. Rowling</author>
2661
- # <year>2005</year>
2662
- # <price>29.99</price>
2663
- # </book>
2664
- # <book category="web">
2665
- # <title lang="en">XQuery Kick Start</title>
2666
- # <author>James McGovern</author>
2667
- # <author>Per Bothner</author>
2668
- # <author>Kurt Cagle</author>
2669
- # <author>James Linn</author>
2670
- # <author>Vaidyanathan Nagarajan</author>
2671
- # <year>2003</year>
2672
- # <price>49.99</price>
2673
- # </book>
2674
- # <book category="web" cover="paperback">
2675
- # <title lang="en">Learning XML</title>
2676
- # <author>Erik T. Ray</author>
2677
- # <year>2003</year>
2678
- # <price>39.95</price>
2679
- # </book>
2680
- # </bookstore>
2681
- # EOT
2682
- # d = REXML::Document.new(xml_string)
2683
- # elements = d.root.elements
2684
- # elements # => #<REXML::Elements @element=<bookstore> ... </>>
2685
- #
2686
- # source://rexml//lib/rexml/element.rb#1591
2687
- class REXML::Elements
2688
- include ::Enumerable
2689
-
2690
- # :call-seq:
2691
- # new(parent) -> new_elements_object
2692
- #
2693
- # Returns a new \Elements object with the given +parent+.
2694
- # Does _not_ assign <tt>parent.elements = self</tt>:
2695
- #
2696
- # d = REXML::Document.new(xml_string)
2697
- # eles = REXML::Elements.new(d.root)
2698
- # eles # => #<REXML::Elements @element=<bookstore> ... </>>
2699
- # eles == d.root.elements # => false
2700
- #
2701
- # @return [Elements] a new instance of Elements
2702
- #
2703
- # source://rexml//lib/rexml/element.rb#1604
2704
- def initialize(parent); end
2705
-
2706
- # :call-seq:
2707
- # add -> new_element
2708
- # add(name) -> new_element
2709
- # add(element) -> element
2710
- #
2711
- # Adds an element; returns the element added.
2712
- #
2713
- # With no argument, creates and adds a new element.
2714
- # The new element has:
2715
- #
2716
- # - No name.
2717
- # - \Parent from the \Elements object.
2718
- # - Context from the that parent.
2719
- #
2720
- # Example:
2721
- #
2722
- # d = REXML::Document.new(xml_string)
2723
- # elements = d.root.elements
2724
- # parent = elements.parent # => <bookstore> ... </>
2725
- # parent.context = {raw: :all}
2726
- # elements.size # => 4
2727
- # new_element = elements.add # => </>
2728
- # elements.size # => 5
2729
- # new_element.name # => nil
2730
- # new_element.parent # => <bookstore> ... </>
2731
- # new_element.context # => {:raw=>:all}
2732
- #
2733
- # With string argument +name+, creates and adds a new element.
2734
- # The new element has:
2735
- #
2736
- # - Name +name+.
2737
- # - \Parent from the \Elements object.
2738
- # - Context from the that parent.
2739
- #
2740
- # Example:
2741
- #
2742
- # d = REXML::Document.new(xml_string)
2743
- # elements = d.root.elements
2744
- # parent = elements.parent # => <bookstore> ... </>
2745
- # parent.context = {raw: :all}
2746
- # elements.size # => 4
2747
- # new_element = elements.add('foo') # => <foo/>
2748
- # elements.size # => 5
2749
- # new_element.name # => "foo"
2750
- # new_element.parent # => <bookstore> ... </>
2751
- # new_element.context # => {:raw=>:all}
2752
- #
2753
- # With argument +element+,
2754
- # creates and adds a clone of the given +element+.
2755
- # The new element has name, parent, and context from the given +element+.
2756
- #
2757
- # d = REXML::Document.new(xml_string)
2758
- # elements = d.root.elements
2759
- # elements.size # => 4
2760
- # e0 = REXML::Element.new('foo')
2761
- # e1 = REXML::Element.new('bar', e0, {raw: :all})
2762
- # element = elements.add(e1) # => <bar/>
2763
- # elements.size # => 5
2764
- # element.name # => "bar"
2765
- # element.parent # => <bookstore> ... </>
2766
- # element.context # => {:raw=>:all}
2767
- #
2768
- # source://rexml//lib/rexml/element.rb#1921
2769
- def <<(element = T.unsafe(nil)); end
2770
-
2771
- # :call-seq:
2772
- # elements[index] -> element or nil
2773
- # elements[xpath] -> element or nil
2774
- # elements[n, name] -> element or nil
2775
- #
2776
- # Returns the first \Element object selected by the arguments,
2777
- # if any found, or +nil+ if none found.
2778
- #
2779
- # Notes:
2780
- # - The +index+ is 1-based, not 0-based, so that:
2781
- # - The first element has index <tt>1</tt>
2782
- # - The _nth_ element has index +n+.
2783
- # - The selection ignores non-\Element nodes.
2784
- #
2785
- # When the single argument +index+ is given,
2786
- # returns the element given by the index, if any; otherwise, +nil+:
2787
- #
2788
- # d = REXML::Document.new(xml_string)
2789
- # eles = d.root.elements
2790
- # eles # => #<REXML::Elements @element=<bookstore> ... </>>
2791
- # eles[1] # => <book category='cooking'> ... </>
2792
- # eles.size # => 4
2793
- # eles[4] # => <book category='web' cover='paperback'> ... </>
2794
- # eles[5] # => nil
2795
- #
2796
- # The node at this index is not an \Element, and so is not returned:
2797
- #
2798
- # eles = d.root.first.first # => <title lang='en'> ... </>
2799
- # eles.to_a # => ["Everyday Italian"]
2800
- # eles[1] # => nil
2801
- #
2802
- # When the single argument +xpath+ is given,
2803
- # returns the first element found via that +xpath+, if any; otherwise, +nil+:
2804
- #
2805
- # eles = d.root.elements # => #<REXML::Elements @element=<bookstore> ... </>>
2806
- # eles['/bookstore'] # => <bookstore> ... </>
2807
- # eles['//book'] # => <book category='cooking'> ... </>
2808
- # eles['//book [@category="children"]'] # => <book category='children'> ... </>
2809
- # eles['/nosuch'] # => nil
2810
- # eles['//nosuch'] # => nil
2811
- # eles['//book [@category="nosuch"]'] # => nil
2812
- # eles['.'] # => <bookstore> ... </>
2813
- # eles['..'].class # => REXML::Document
2814
- #
2815
- # With arguments +n+ and +name+ given,
2816
- # returns the _nth_ found element that has the given +name+,
2817
- # or +nil+ if there is no such _nth_ element:
2818
- #
2819
- # eles = d.root.elements # => #<REXML::Elements @element=<bookstore> ... </>>
2820
- # eles[1, 'book'] # => <book category='cooking'> ... </>
2821
- # eles[4, 'book'] # => <book category='web' cover='paperback'> ... </>
2822
- # eles[5, 'book'] # => nil
2823
- #
2824
- # source://rexml//lib/rexml/element.rb#1676
2825
- def [](index, name = T.unsafe(nil)); end
2826
-
2827
- # :call-seq:
2828
- # elements[] = index, replacement_element -> replacement_element or nil
2829
- #
2830
- # Replaces or adds an element.
2831
- #
2832
- # When <tt>eles[index]</tt> exists, replaces it with +replacement_element+
2833
- # and returns +replacement_element+:
2834
- #
2835
- # d = REXML::Document.new(xml_string)
2836
- # eles = d.root.elements # => #<REXML::Elements @element=<bookstore> ... </>>
2837
- # eles[1] # => <book category='cooking'> ... </>
2838
- # eles[1] = REXML::Element.new('foo')
2839
- # eles[1] # => <foo/>
2840
- #
2841
- # Does nothing (or raises an exception)
2842
- # if +replacement_element+ is not an \Element:
2843
- # eles[2] # => <book category='web' cover='paperback'> ... </>
2844
- # eles[2] = REXML::Text.new('bar')
2845
- # eles[2] # => <book category='web' cover='paperback'> ... </>
2846
- #
2847
- # When <tt>eles[index]</tt> does not exist,
2848
- # adds +replacement_element+ to the element and returns
2849
- #
2850
- # d = REXML::Document.new(xml_string)
2851
- # eles = d.root.elements # => #<REXML::Elements @element=<bookstore> ... </>>
2852
- # eles.size # => 4
2853
- # eles[50] = REXML::Element.new('foo') # => <foo/>
2854
- # eles.size # => 5
2855
- # eles[5] # => <foo/>
2856
- #
2857
- # Does nothing (or raises an exception)
2858
- # if +replacement_element+ is not an \Element:
2859
- #
2860
- # eles[50] = REXML::Text.new('bar') # => "bar"
2861
- # eles.size # => 5
2862
- #
2863
- # source://rexml//lib/rexml/element.rb#1731
2864
- def []=(index, element); end
2865
-
2866
- # :call-seq:
2867
- # add -> new_element
2868
- # add(name) -> new_element
2869
- # add(element) -> element
2870
- #
2871
- # Adds an element; returns the element added.
2872
- #
2873
- # With no argument, creates and adds a new element.
2874
- # The new element has:
2875
- #
2876
- # - No name.
2877
- # - \Parent from the \Elements object.
2878
- # - Context from the that parent.
2879
- #
2880
- # Example:
2881
- #
2882
- # d = REXML::Document.new(xml_string)
2883
- # elements = d.root.elements
2884
- # parent = elements.parent # => <bookstore> ... </>
2885
- # parent.context = {raw: :all}
2886
- # elements.size # => 4
2887
- # new_element = elements.add # => </>
2888
- # elements.size # => 5
2889
- # new_element.name # => nil
2890
- # new_element.parent # => <bookstore> ... </>
2891
- # new_element.context # => {:raw=>:all}
2892
- #
2893
- # With string argument +name+, creates and adds a new element.
2894
- # The new element has:
2895
- #
2896
- # - Name +name+.
2897
- # - \Parent from the \Elements object.
2898
- # - Context from the that parent.
2899
- #
2900
- # Example:
2901
- #
2902
- # d = REXML::Document.new(xml_string)
2903
- # elements = d.root.elements
2904
- # parent = elements.parent # => <bookstore> ... </>
2905
- # parent.context = {raw: :all}
2906
- # elements.size # => 4
2907
- # new_element = elements.add('foo') # => <foo/>
2908
- # elements.size # => 5
2909
- # new_element.name # => "foo"
2910
- # new_element.parent # => <bookstore> ... </>
2911
- # new_element.context # => {:raw=>:all}
2912
- #
2913
- # With argument +element+,
2914
- # creates and adds a clone of the given +element+.
2915
- # The new element has name, parent, and context from the given +element+.
2916
- #
2917
- # d = REXML::Document.new(xml_string)
2918
- # elements = d.root.elements
2919
- # elements.size # => 4
2920
- # e0 = REXML::Element.new('foo')
2921
- # e1 = REXML::Element.new('bar', e0, {raw: :all})
2922
- # element = elements.add(e1) # => <bar/>
2923
- # elements.size # => 5
2924
- # element.name # => "bar"
2925
- # element.parent # => <bookstore> ... </>
2926
- # element.context # => {:raw=>:all}
2927
- #
2928
- # source://rexml//lib/rexml/element.rb#1921
2929
- def add(element = T.unsafe(nil)); end
2930
-
2931
- # :call-seq:
2932
- # collect(xpath = nil) {|element| ... } -> array
2933
- #
2934
- # Iterates over the elements; returns the array of block return values.
2935
- #
2936
- # With no argument, iterates over all elements:
2937
- #
2938
- # d = REXML::Document.new(xml_string)
2939
- # elements = d.root.elements
2940
- # elements.collect {|element| element.size } # => [9, 9, 17, 9]
2941
- #
2942
- # With argument +xpath+, iterates over elements that match
2943
- # the given +xpath+:
2944
- #
2945
- # xpath = '//book [@category="web"]'
2946
- # elements.collect(xpath) {|element| element.size } # => [17, 9]
2947
- #
2948
- # source://rexml//lib/rexml/element.rb#1984
2949
- def collect(xpath = T.unsafe(nil)); end
2950
-
2951
- # :call-seq:
2952
- # delete(index) -> removed_element or nil
2953
- # delete(element) -> removed_element or nil
2954
- # delete(xpath) -> removed_element or nil
2955
- #
2956
- # Removes an element; returns the removed element, or +nil+ if none removed.
2957
- #
2958
- # With integer argument +index+ given,
2959
- # removes the child element at that offset:
2960
- #
2961
- # d = REXML::Document.new(xml_string)
2962
- # elements = d.root.elements
2963
- # elements.size # => 4
2964
- # elements[2] # => <book category='children'> ... </>
2965
- # elements.delete(2) # => <book category='children'> ... </>
2966
- # elements.size # => 3
2967
- # elements[2] # => <book category='web'> ... </>
2968
- # elements.delete(50) # => nil
2969
- #
2970
- # With element argument +element+ given,
2971
- # removes that child element:
2972
- #
2973
- # d = REXML::Document.new(xml_string)
2974
- # elements = d.root.elements
2975
- # ele_1, ele_2, ele_3, ele_4 = *elements
2976
- # elements.size # => 4
2977
- # elements[2] # => <book category='children'> ... </>
2978
- # elements.delete(ele_2) # => <book category='children'> ... </>
2979
- # elements.size # => 3
2980
- # elements[2] # => <book category='web'> ... </>
2981
- # elements.delete(ele_2) # => nil
2982
- #
2983
- # With string argument +xpath+ given,
2984
- # removes the first element found via that xpath:
2985
- #
2986
- # d = REXML::Document.new(xml_string)
2987
- # elements = d.root.elements
2988
- # elements.delete('//book') # => <book category='cooking'> ... </>
2989
- # elements.delete('//book [@category="children"]') # => <book category='children'> ... </>
2990
- # elements.delete('//nosuch') # => nil
2991
- #
2992
- # source://rexml//lib/rexml/element.rb#1821
2993
- def delete(element); end
2994
-
2995
- # :call-seq:
2996
- # delete_all(xpath)
2997
- #
2998
- # Removes all elements found via the given +xpath+;
2999
- # returns the array of removed elements, if any, else +nil+.
3000
- #
3001
- # d = REXML::Document.new(xml_string)
3002
- # elements = d.root.elements
3003
- # elements.size # => 4
3004
- # deleted_elements = elements.delete_all('//book [@category="web"]')
3005
- # deleted_elements.size # => 2
3006
- # elements.size # => 2
3007
- # deleted_elements = elements.delete_all('//book')
3008
- # deleted_elements.size # => 2
3009
- # elements.size # => 0
3010
- # elements.delete_all('//book') # => []
3011
- #
3012
- # source://rexml//lib/rexml/element.rb#1847
3013
- def delete_all(xpath); end
3014
-
3015
- # :call-seq:
3016
- # each(xpath = nil) {|element| ... } -> self
3017
- #
3018
- # Iterates over the elements.
3019
- #
3020
- # With no argument, calls the block with each element:
3021
- #
3022
- # d = REXML::Document.new(xml_string)
3023
- # elements = d.root.elements
3024
- # elements.each {|element| p element }
3025
- #
3026
- # Output:
3027
- #
3028
- # <book category='cooking'> ... </>
3029
- # <book category='children'> ... </>
3030
- # <book category='web'> ... </>
3031
- # <book category='web' cover='paperback'> ... </>
3032
- #
3033
- # With argument +xpath+, calls the block with each element
3034
- # that matches the given +xpath+:
3035
- #
3036
- # elements.each('//book [@category="web"]') {|element| p element }
3037
- #
3038
- # Output:
3039
- #
3040
- # <book category='web'> ... </>
3041
- # <book category='web' cover='paperback'> ... </>
3042
- #
3043
- # source://rexml//lib/rexml/element.rb#1963
3044
- def each(xpath = T.unsafe(nil)); end
3045
-
3046
- # :call-seq:
3047
- # empty? -> true or false
3048
- #
3049
- # Returns +true+ if there are no children, +false+ otherwise.
3050
- #
3051
- # d = REXML::Document.new('')
3052
- # d.elements.empty? # => true
3053
- # d = REXML::Document.new(xml_string)
3054
- # d.elements.empty? # => false
3055
- #
3056
- # @return [Boolean]
3057
- #
3058
- # source://rexml//lib/rexml/element.rb#1751
3059
- def empty?; end
3060
-
3061
- # :call-seq:
3062
- # index(element)
3063
- #
3064
- # Returns the 1-based index of the given +element+, if found;
3065
- # otherwise, returns -1:
3066
- #
3067
- # d = REXML::Document.new(xml_string)
3068
- # elements = d.root.elements
3069
- # ele_1, ele_2, ele_3, ele_4 = *elements
3070
- # elements.index(ele_4) # => 4
3071
- # elements.delete(ele_3)
3072
- # elements.index(ele_4) # => 3
3073
- # elements.index(ele_3) # => -1
3074
- #
3075
- # source://rexml//lib/rexml/element.rb#1769
3076
- def index(element); end
3077
-
3078
- # :call-seq:
3079
- # inject(xpath = nil, initial = nil) -> object
3080
- #
3081
- # Calls the block with elements; returns the last block return value.
3082
- #
3083
- # With no argument, iterates over the elements, calling the block
3084
- # <tt>elements.size - 1</tt> times.
3085
- #
3086
- # - The first call passes the first and second elements.
3087
- # - The second call passes the first block return value and the third element.
3088
- # - The third call passes the second block return value and the fourth element.
3089
- # - And so on.
3090
- #
3091
- # In this example, the block returns the passed element,
3092
- # which is then the object argument to the next call:
3093
- #
3094
- # d = REXML::Document.new(xml_string)
3095
- # elements = d.root.elements
3096
- # elements.inject do |object, element|
3097
- # p [elements.index(object), elements.index(element)]
3098
- # element
3099
- # end
3100
- #
3101
- # Output:
3102
- #
3103
- # [1, 2]
3104
- # [2, 3]
3105
- # [3, 4]
3106
- #
3107
- # With the single argument +xpath+, calls the block only with
3108
- # elements matching that xpath:
3109
- #
3110
- # elements.inject('//book [@category="web"]') do |object, element|
3111
- # p [elements.index(object), elements.index(element)]
3112
- # element
3113
- # end
3114
- #
3115
- # Output:
3116
- #
3117
- # [3, 4]
3118
- #
3119
- # With argument +xpath+ given as +nil+
3120
- # and argument +initial+ also given,
3121
- # calls the block once for each element.
3122
- #
3123
- # - The first call passes the +initial+ and the first element.
3124
- # - The second call passes the first block return value and the second element.
3125
- # - The third call passes the second block return value and the third element.
3126
- # - And so on.
3127
- #
3128
- # In this example, the first object index is <tt>-1</tt>
3129
- #
3130
- # elements.inject(nil, 'Initial') do |object, element|
3131
- # p [elements.index(object), elements.index(element)]
3132
- # element
3133
- # end
3134
- #
3135
- # Output:
3136
- #
3137
- # [-1, 1]
3138
- # [1, 2]
3139
- # [2, 3]
3140
- # [3, 4]
3141
- #
3142
- # In this form the passed object can be used as an accumulator:
3143
- #
3144
- # elements.inject(nil, 0) do |total, element|
3145
- # total += element.size
3146
- # end # => 44
3147
- #
3148
- # With both arguments +xpath+ and +initial+ are given,
3149
- # calls the block only with elements matching that xpath:
3150
- #
3151
- # elements.inject('//book [@category="web"]', 0) do |total, element|
3152
- # total += element.size
3153
- # end # => 26
3154
- #
3155
- # source://rexml//lib/rexml/element.rb#2069
3156
- def inject(xpath = T.unsafe(nil), initial = T.unsafe(nil)); end
3157
-
3158
- # :call-seq:
3159
- # parent
3160
- #
3161
- # Returns the parent element cited in creating the \Elements object.
3162
- # This element is also the default starting point for searching
3163
- # in the \Elements object.
3164
- #
3165
- # d = REXML::Document.new(xml_string)
3166
- # elements = REXML::Elements.new(d.root)
3167
- # elements.parent == d.root # => true
3168
- #
3169
- # source://rexml//lib/rexml/element.rb#1619
3170
- def parent; end
3171
-
3172
- # :call-seq:
3173
- # size -> integer
3174
- #
3175
- # Returns the count of \Element children:
3176
- #
3177
- # d = REXML::Document.new '<a>sean<b/>elliott<b/>russell<b/></a>'
3178
- # d.root.elements.size # => 3 # Three elements.
3179
- # d.root.size # => 6 # Three elements plus three text nodes..
3180
- #
3181
- # source://rexml//lib/rexml/element.rb#2093
3182
- def size; end
3183
-
3184
- # :call-seq:
3185
- # to_a(xpath = nil) -> array_of_elements
3186
- #
3187
- # Returns an array of element children (not including non-element children).
3188
- #
3189
- # With no argument, returns an array of all element children:
3190
- #
3191
- # d = REXML::Document.new '<a>sean<b/>elliott<c/></a>'
3192
- # elements = d.root.elements
3193
- # elements.to_a # => [<b/>, <c/>] # Omits non-element children.
3194
- # children = d.root.children
3195
- # children # => ["sean", <b/>, "elliott", <c/>] # Includes non-element children.
3196
- #
3197
- # With argument +xpath+, returns an array of element children
3198
- # that match the xpath:
3199
- #
3200
- # elements.to_a('//c') # => [<c/>]
3201
- #
3202
- # source://rexml//lib/rexml/element.rb#2117
3203
- def to_a(xpath = T.unsafe(nil)); end
3204
-
3205
- private
3206
-
3207
- # Private helper class. Removes quotes from quoted strings
3208
- #
3209
- # source://rexml//lib/rexml/element.rb#2125
3210
- def literalize(name); end
3211
- end
3212
-
3213
- # source://rexml//lib/rexml/encoding.rb#4
3214
- module REXML::Encoding
3215
- # source://rexml//lib/rexml/encoding.rb#29
3216
- def decode(string); end
3217
-
3218
- # source://rexml//lib/rexml/encoding.rb#25
3219
- def encode(string); end
3220
-
3221
- # ID ---> Encoding name
3222
- #
3223
- # source://rexml//lib/rexml/encoding.rb#6
3224
- def encoding; end
3225
-
3226
- # source://rexml//lib/rexml/encoding.rb#7
3227
- def encoding=(encoding); end
3228
-
3229
- private
3230
-
3231
- # source://rexml//lib/rexml/encoding.rb#34
3232
- def find_encoding(name); end
3233
- end
3234
-
3235
- # source://rexml//lib/rexml/entity.rb#7
3236
- class REXML::Entity < ::REXML::Child
3237
- include ::REXML::XMLTokens
3238
-
3239
- # Create a new entity. Simple entities can be constructed by passing a
3240
- # name, value to the constructor; this creates a generic, plain entity
3241
- # reference. For anything more complicated, you have to pass a Source to
3242
- # the constructor with the entity definition, or use the accessor methods.
3243
- # +WARNING+: There is no validation of entity state except when the entity
3244
- # is read from a stream. If you start poking around with the accessors,
3245
- # you can easily create a non-conformant Entity.
3246
- #
3247
- # e = Entity.new( 'amp', '&' )
3248
- #
3249
- # @return [Entity] a new instance of Entity
3250
- #
3251
- # source://rexml//lib/rexml/entity.rb#34
3252
- def initialize(stream, value = T.unsafe(nil), parent = T.unsafe(nil), reference = T.unsafe(nil)); end
3253
-
3254
- # Returns the value of attribute external.
3255
- #
3256
- # source://rexml//lib/rexml/entity.rb#23
3257
- def external; end
3258
-
3259
- # Returns the value of attribute name.
3260
- #
3261
- # source://rexml//lib/rexml/entity.rb#23
3262
- def name; end
3263
-
3264
- # Returns the value of attribute ndata.
3265
- #
3266
- # source://rexml//lib/rexml/entity.rb#23
3267
- def ndata; end
3268
-
3269
- # Returns the value of this entity unprocessed -- raw. This is the
3270
- # normalized value; that is, with all %ent; and &ent; entities intact
3271
- #
3272
- # source://rexml//lib/rexml/entity.rb#86
3273
- def normalized; end
3274
-
3275
- # Returns the value of attribute pubid.
3276
- #
3277
- # source://rexml//lib/rexml/entity.rb#23
3278
- def pubid; end
3279
-
3280
- # Returns the value of attribute ref.
3281
- #
3282
- # source://rexml//lib/rexml/entity.rb#23
3283
- def ref; end
3284
-
3285
- # Returns this entity as a string. See write().
3286
- #
3287
- # source://rexml//lib/rexml/entity.rb#120
3288
- def to_s; end
3289
-
3290
- # Evaluates to the unnormalized value of this entity; that is, replacing
3291
- # &ent; entities.
3292
- #
3293
- # source://rexml//lib/rexml/entity.rb#73
3294
- def unnormalized; end
3295
-
3296
- # Returns the value of attribute value.
3297
- #
3298
- # source://rexml//lib/rexml/entity.rb#23
3299
- def value; end
3300
-
3301
- # Write out a fully formed, correct entity definition (assuming the Entity
3302
- # object itself is valid.)
3303
- #
3304
- # out::
3305
- # An object implementing <TT>&lt;&lt;</TT> to which the entity will be
3306
- # output
3307
- # indent::
3308
- # *DEPRECATED* and ignored
3309
- #
3310
- # source://rexml//lib/rexml/entity.rb#98
3311
- def write(out, indent = T.unsafe(nil)); end
3312
-
3313
- class << self
3314
- # Evaluates whether the given string matches an entity definition,
3315
- # returning true if so, and false otherwise.
3316
- #
3317
- # @return [Boolean]
3318
- #
3319
- # source://rexml//lib/rexml/entity.rb#67
3320
- def matches?(string); end
3321
- end
3322
- end
3323
-
3324
- # source://rexml//lib/rexml/doctype.rb#267
3325
- class REXML::ExternalEntity < ::REXML::Child
3326
- # @return [ExternalEntity] a new instance of ExternalEntity
3327
- #
3328
- # source://rexml//lib/rexml/doctype.rb#268
3329
- def initialize(src); end
3330
-
3331
- # source://rexml//lib/rexml/doctype.rb#272
3332
- def to_s; end
3333
-
3334
- # source://rexml//lib/rexml/doctype.rb#275
3335
- def write(output, indent); end
3336
- end
3337
-
3338
- # source://rexml//lib/rexml/formatters/default.rb#5
3339
- class REXML::Formatters::Default
3340
- # Prints out the XML document with no formatting -- except if ie_hack is
3341
- # set.
3342
- #
3343
- # ie_hack::
3344
- # If set to true, then inserts whitespace before the close of an empty
3345
- # tag, so that IE's bad XML parser doesn't choke.
3346
- #
3347
- # @return [Default] a new instance of Default
3348
- #
3349
- # source://rexml//lib/rexml/formatters/default.rb#12
3350
- def initialize(ie_hack = T.unsafe(nil)); end
3351
-
3352
- # Writes the node to some output.
3353
- #
3354
- # node::
3355
- # The node to write
3356
- # output::
3357
- # A class implementing <TT>&lt;&lt;</TT>. Pass in an Output object to
3358
- # change the output encoding.
3359
- #
3360
- # source://rexml//lib/rexml/formatters/default.rb#23
3361
- def write(node, output); end
3362
-
3363
- protected
3364
-
3365
- # source://rexml//lib/rexml/formatters/default.rb#98
3366
- def write_cdata(node, output); end
3367
-
3368
- # source://rexml//lib/rexml/formatters/default.rb#92
3369
- def write_comment(node, output); end
3370
-
3371
- # source://rexml//lib/rexml/formatters/default.rb#61
3372
- def write_document(node, output); end
3373
-
3374
- # source://rexml//lib/rexml/formatters/default.rb#65
3375
- def write_element(node, output); end
3376
-
3377
- # source://rexml//lib/rexml/formatters/default.rb#104
3378
- def write_instruction(node, output); end
3379
-
3380
- # source://rexml//lib/rexml/formatters/default.rb#88
3381
- def write_text(node, output); end
3382
- end
3383
-
3384
- # Pretty-prints an XML document. This destroys whitespace in text nodes
3385
- # and will insert carriage returns and indentations.
3386
- #
3387
- # TODO: Add an option to print attributes on new lines
3388
- #
3389
- # source://rexml//lib/rexml/formatters/pretty.rb#10
3390
- class REXML::Formatters::Pretty < ::REXML::Formatters::Default
3391
- # Create a new pretty printer.
3392
- #
3393
- # output::
3394
- # An object implementing '<<(String)', to which the output will be written.
3395
- # indentation::
3396
- # An integer greater than 0. The indentation of each level will be
3397
- # this number of spaces. If this is < 1, the behavior of this object
3398
- # is undefined. Defaults to 2.
3399
- # ie_hack::
3400
- # If true, the printer will insert whitespace before closing empty
3401
- # tags, thereby allowing Internet Explorer's XML parser to
3402
- # function. Defaults to false.
3403
- #
3404
- # @return [Pretty] a new instance of Pretty
3405
- #
3406
- # source://rexml//lib/rexml/formatters/pretty.rb#30
3407
- def initialize(indentation = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
3408
-
3409
- # If compact is set to true, then the formatter will attempt to use as
3410
- # little space as possible
3411
- #
3412
- # source://rexml//lib/rexml/formatters/pretty.rb#14
3413
- def compact; end
3414
-
3415
- # If compact is set to true, then the formatter will attempt to use as
3416
- # little space as possible
3417
- #
3418
- # source://rexml//lib/rexml/formatters/pretty.rb#14
3419
- def compact=(_arg0); end
3420
-
3421
- # The width of a page. Used for formatting text
3422
- #
3423
- # source://rexml//lib/rexml/formatters/pretty.rb#16
3424
- def width; end
3425
-
3426
- # The width of a page. Used for formatting text
3427
- #
3428
- # source://rexml//lib/rexml/formatters/pretty.rb#16
3429
- def width=(_arg0); end
3430
-
3431
- protected
3432
-
3433
- # source://rexml//lib/rexml/formatters/pretty.rb#102
3434
- def write_cdata(node, output); end
3435
-
3436
- # source://rexml//lib/rexml/formatters/pretty.rb#97
3437
- def write_comment(node, output); end
3438
-
3439
- # source://rexml//lib/rexml/formatters/pretty.rb#107
3440
- def write_document(node, output); end
3441
-
3442
- # source://rexml//lib/rexml/formatters/pretty.rb#39
3443
- def write_element(node, output); end
3444
-
3445
- # source://rexml//lib/rexml/formatters/pretty.rb#88
3446
- def write_text(node, output); end
3447
-
3448
- private
3449
-
3450
- # source://rexml//lib/rexml/formatters/pretty.rb#124
3451
- def indent_text(string, level = T.unsafe(nil), style = T.unsafe(nil), indentfirstline = T.unsafe(nil)); end
3452
-
3453
- # source://rexml//lib/rexml/formatters/pretty.rb#129
3454
- def wrap(string, width); end
3455
- end
3456
-
3457
- # A Source that wraps an IO. See the Source class for method
3458
- # documentation
3459
- #
3460
- # source://rexml//lib/rexml/source.rb#201
3461
- class REXML::IOSource < ::REXML::Source
3462
- # block_size has been deprecated
3463
- #
3464
- # @return [IOSource] a new instance of IOSource
3465
- #
3466
- # source://rexml//lib/rexml/source.rb#205
3467
- def initialize(arg, block_size = T.unsafe(nil), encoding = T.unsafe(nil)); end
3468
-
3469
- # @return the current line in the source
3470
- #
3471
- # source://rexml//lib/rexml/source.rb#310
3472
- def current_line; end
3473
-
3474
- # @return [Boolean]
3475
- #
3476
- # source://rexml//lib/rexml/source.rb#305
3477
- def empty?; end
3478
-
3479
- # source://rexml//lib/rexml/source.rb#265
3480
- def ensure_buffer; end
3481
-
3482
- # source://rexml//lib/rexml/source.rb#269
3483
- def match(pattern, cons = T.unsafe(nil)); end
3484
-
3485
- # @return [Boolean]
3486
- #
3487
- # source://rexml//lib/rexml/source.rb#288
3488
- def match?(pattern, cons = T.unsafe(nil)); end
3489
-
3490
- # source://rexml//lib/rexml/source.rb#226
3491
- def read(term = T.unsafe(nil), min_bytes = T.unsafe(nil)); end
3492
-
3493
- # source://rexml//lib/rexml/source.rb#247
3494
- def read_until(term); end
3495
-
3496
- private
3497
-
3498
- # source://rexml//lib/rexml/source.rb#357
3499
- def encoding_updated; end
3500
-
3501
- # source://rexml//lib/rexml/source.rb#332
3502
- def readline(term = T.unsafe(nil)); end
3503
- end
3504
-
3505
- # Represents an XML Instruction; IE, <? ... ?>
3506
- # TODO: Add parent arg (3rd arg) to constructor
3507
- #
3508
- # source://rexml//lib/rexml/instruction.rb#9
3509
- class REXML::Instruction < ::REXML::Child
3510
- # Constructs a new Instruction
3511
- # the target of this instruction is set to this. If an Instruction,
3512
- # then the Instruction is shallowly cloned (target and content are
3513
- # copied).
3514
- # be a Parent if the target argument is a Source. Otherwise, this
3515
- # String is set as the content of this instruction.
3516
- #
3517
- # @param target can be one of a number of things. If String, then
3518
- # @param content Must be either a String, or a Parent. Can only
3519
- # @return [Instruction] a new instance of Instruction
3520
- #
3521
- # source://rexml//lib/rexml/instruction.rb#25
3522
- def initialize(target, content = T.unsafe(nil)); end
3523
-
3524
- # of the other matches the target and content of this object.
3525
- #
3526
- # @return true if other is an Instruction, and the content and target
3527
- #
3528
- # source://rexml//lib/rexml/instruction.rb#65
3529
- def ==(other); end
3530
-
3531
- # source://rexml//lib/rexml/instruction.rb#44
3532
- def clone; end
3533
-
3534
- # target is the "name" of the Instruction; IE, the "tag" in <?tag ...?>
3535
- # content is everything else.
3536
- #
3537
- # source://rexml//lib/rexml/instruction.rb#15
3538
- def content; end
3539
-
3540
- # target is the "name" of the Instruction; IE, the "tag" in <?tag ...?>
3541
- # content is everything else.
3542
- #
3543
- # source://rexml//lib/rexml/instruction.rb#15
3544
- def content=(_arg0); end
3545
-
3546
- # source://rexml//lib/rexml/instruction.rb#75
3547
- def inspect; end
3548
-
3549
- # source://rexml//lib/rexml/instruction.rb#71
3550
- def node_type; end
3551
-
3552
- # target is the "name" of the Instruction; IE, the "tag" in <?tag ...?>
3553
- # content is everything else.
3554
- #
3555
- # source://rexml//lib/rexml/instruction.rb#15
3556
- def target; end
3557
-
3558
- # target is the "name" of the Instruction; IE, the "tag" in <?tag ...?>
3559
- # content is everything else.
3560
- #
3561
- # source://rexml//lib/rexml/instruction.rb#15
3562
- def target=(_arg0); end
3563
-
3564
- # == DEPRECATED
3565
- # See the rexml/formatters package
3566
- #
3567
- # source://rexml//lib/rexml/instruction.rb#51
3568
- def write(writer, indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
3569
- end
3570
-
3571
- # Adds named attributes to an object.
3572
- #
3573
- # source://rexml//lib/rexml/namespace.rb#7
3574
- module REXML::Namespace
3575
- include ::REXML::XMLTokens
3576
-
3577
- # The name of the object, valid if set
3578
- #
3579
- # source://rexml//lib/rexml/namespace.rb#9
3580
- def expanded_name; end
3581
-
3582
- # Fully expand the name, even if the prefix wasn't specified in the
3583
- # source file.
3584
- #
3585
- # source://rexml//lib/rexml/namespace.rb#57
3586
- def fully_expanded_name; end
3587
-
3588
- # Compares names optionally WITH namespaces
3589
- #
3590
- # @return [Boolean]
3591
- #
3592
- # source://rexml//lib/rexml/namespace.rb#43
3593
- def has_name?(other, ns = T.unsafe(nil)); end
3594
-
3595
- # The name of the object, valid if set
3596
- #
3597
- # source://rexml//lib/rexml/namespace.rb#9
3598
- def name; end
3599
-
3600
- # Sets the name and the expanded name
3601
- #
3602
- # source://rexml//lib/rexml/namespace.rb#17
3603
- def name=(name); end
3604
-
3605
- # The expanded name of the object, valid if name is set
3606
- #
3607
- # source://rexml//lib/rexml/namespace.rb#11
3608
- def prefix; end
3609
-
3610
- # The expanded name of the object, valid if name is set
3611
- #
3612
- # source://rexml//lib/rexml/namespace.rb#11
3613
- def prefix=(_arg0); end
3614
- end
3615
-
3616
- # source://rexml//lib/rexml/namespace.rb#13
3617
- REXML::Namespace::NAME_WITHOUT_NAMESPACE = T.let(T.unsafe(nil), Regexp)
3618
-
3619
- # source://rexml//lib/rexml/doctype.rb#280
3620
- class REXML::NotationDecl < ::REXML::Child
3621
- # @return [NotationDecl] a new instance of NotationDecl
3622
- #
3623
- # source://rexml//lib/rexml/doctype.rb#282
3624
- def initialize(name, middle, pub, sys); end
3625
-
3626
- # This method retrieves the name of the notation.
3627
- #
3628
- # Method contributed by Henrik Martensson
3629
- #
3630
- # source://rexml//lib/rexml/doctype.rb#307
3631
- def name; end
3632
-
3633
- # Returns the value of attribute public.
3634
- #
3635
- # source://rexml//lib/rexml/doctype.rb#281
3636
- def public; end
3637
-
3638
- # Sets the attribute public
3639
- #
3640
- # @param value the value to set the attribute public to.
3641
- #
3642
- # source://rexml//lib/rexml/doctype.rb#281
3643
- def public=(_arg0); end
3644
-
3645
- # Returns the value of attribute system.
3646
- #
3647
- # source://rexml//lib/rexml/doctype.rb#281
3648
- def system; end
3649
-
3650
- # Sets the attribute system
3651
- #
3652
- # @param value the value to set the attribute system to.
3653
- #
3654
- # source://rexml//lib/rexml/doctype.rb#281
3655
- def system=(_arg0); end
3656
-
3657
- # source://rexml//lib/rexml/doctype.rb#290
3658
- def to_s; end
3659
-
3660
- # source://rexml//lib/rexml/doctype.rb#300
3661
- def write(output, indent = T.unsafe(nil)); end
3662
- end
3663
-
3664
- # source://rexml//lib/rexml/output.rb#5
3665
- class REXML::Output
3666
- include ::REXML::Encoding
3667
-
3668
- # @return [Output] a new instance of Output
3669
- #
3670
- # source://rexml//lib/rexml/output.rb#10
3671
- def initialize(real_IO, encd = T.unsafe(nil)); end
3672
-
3673
- # source://rexml//lib/rexml/output.rb#22
3674
- def <<(content); end
3675
-
3676
- # Returns the value of attribute encoding.
3677
- #
3678
- # source://rexml//lib/rexml/output.rb#8
3679
- def encoding; end
3680
-
3681
- # source://rexml//lib/rexml/output.rb#26
3682
- def to_s; end
3683
- end
3684
-
3685
- # A parent has children, and has methods for accessing them. The Parent
3686
- # class is never encountered except as the superclass for some other
3687
- # object.
3688
- #
3689
- # source://rexml//lib/rexml/parent.rb#8
3690
- class REXML::Parent < ::REXML::Child
3691
- include ::Enumerable
3692
-
3693
- # Constructor
3694
- #
3695
- # @param parent if supplied, will be set as the parent of this object
3696
- # @return [Parent] a new instance of Parent
3697
- #
3698
- # source://rexml//lib/rexml/parent.rb#13
3699
- def initialize(parent = T.unsafe(nil)); end
3700
-
3701
- # source://rexml//lib/rexml/parent.rb#18
3702
- def <<(object); end
3703
-
3704
- # Fetches a child at a given index
3705
- #
3706
- # @param index the Integer index of the child to fetch
3707
- #
3708
- # source://rexml//lib/rexml/parent.rb#57
3709
- def [](index); end
3710
-
3711
- # Set an index entry. See Array.[]=
3712
- #
3713
- # @param index the index of the element to set
3714
- # @param opt either the object to set, or an Integer length
3715
- # @param child if opt is an Integer, this is the child to set
3716
- # @return the parent (self)
3717
- #
3718
- # source://rexml//lib/rexml/parent.rb#70
3719
- def []=(*args); end
3720
-
3721
- # source://rexml//lib/rexml/parent.rb#18
3722
- def add(object); end
3723
-
3724
- # source://rexml//lib/rexml/parent.rb#115
3725
- def children; end
3726
-
3727
- # Deeply clones this object. This creates a complete duplicate of this
3728
- # Parent, including all descendants.
3729
- #
3730
- # source://rexml//lib/rexml/parent.rb#148
3731
- def deep_clone; end
3732
-
3733
- # source://rexml//lib/rexml/parent.rb#32
3734
- def delete(object); end
3735
-
3736
- # source://rexml//lib/rexml/parent.rb#47
3737
- def delete_at(index); end
3738
-
3739
- # source://rexml//lib/rexml/parent.rb#43
3740
- def delete_if(&block); end
3741
-
3742
- # source://rexml//lib/rexml/parent.rb#39
3743
- def each(&block); end
3744
-
3745
- # source://rexml//lib/rexml/parent.rb#39
3746
- def each_child(&block); end
3747
-
3748
- # source://rexml//lib/rexml/parent.rb#51
3749
- def each_index(&block); end
3750
-
3751
- # Fetches the index of a given child
3752
- # of this parent.
3753
- #
3754
- # @param child the child to get the index of
3755
- # @return the index of the child, or nil if the object is not a child
3756
- #
3757
- # source://rexml//lib/rexml/parent.rb#123
3758
- def index(child); end
3759
-
3760
- # Inserts an child after another child
3761
- # child2 will be inserted after child1 in the child list of the parent.
3762
- # If an xpath, child2 will be inserted after the first child to match
3763
- # the xpath.
3764
- #
3765
- # @param child1 this is either an xpath or an Element. If an Element,
3766
- # @param child2 the child to insert
3767
- # @return the parent (self)
3768
- #
3769
- # source://rexml//lib/rexml/parent.rb#102
3770
- def insert_after(child1, child2); end
3771
-
3772
- # Inserts an child before another child
3773
- # child2 will be inserted before child1 in the child list of the parent.
3774
- # If an xpath, child2 will be inserted before the first child to match
3775
- # the xpath.
3776
- #
3777
- # @param child1 this is either an xpath or an Element. If an Element,
3778
- # @param child2 the child to insert
3779
- # @return the parent (self)
3780
- #
3781
- # source://rexml//lib/rexml/parent.rb#82
3782
- def insert_before(child1, child2); end
3783
-
3784
- # @return the number of children of this parent
3785
- #
3786
- # source://rexml//lib/rexml/parent.rb#130
3787
- def length; end
3788
-
3789
- # @return [Boolean]
3790
- #
3791
- # source://rexml//lib/rexml/parent.rb#162
3792
- def parent?; end
3793
-
3794
- # source://rexml//lib/rexml/parent.rb#18
3795
- def push(object); end
3796
-
3797
- # Replaces one child with another, making sure the nodelist is correct
3798
- # Child)
3799
- #
3800
- # @param to_replace the child to replace (must be a Child)
3801
- # @param replacement the child to insert into the nodelist (must be a
3802
- #
3803
- # source://rexml//lib/rexml/parent.rb#140
3804
- def replace_child(to_replace, replacement); end
3805
-
3806
- # @return the number of children of this parent
3807
- #
3808
- # source://rexml//lib/rexml/parent.rb#130
3809
- def size; end
3810
-
3811
- # source://rexml//lib/rexml/parent.rb#115
3812
- def to_a; end
3813
-
3814
- # source://rexml//lib/rexml/parent.rb#27
3815
- def unshift(object); end
3816
- end
3817
-
3818
- # source://rexml//lib/rexml/parseexception.rb#3
3819
- class REXML::ParseException < ::RuntimeError
3820
- # @return [ParseException] a new instance of ParseException
3821
- #
3822
- # source://rexml//lib/rexml/parseexception.rb#6
3823
- def initialize(message, source = T.unsafe(nil), parser = T.unsafe(nil), exception = T.unsafe(nil)); end
3824
-
3825
- # source://rexml//lib/rexml/parseexception.rb#49
3826
- def context; end
3827
-
3828
- # Returns the value of attribute continued_exception.
3829
- #
3830
- # source://rexml//lib/rexml/parseexception.rb#4
3831
- def continued_exception; end
3832
-
3833
- # Sets the attribute continued_exception
3834
- #
3835
- # @param value the value to set the attribute continued_exception to.
3836
- #
3837
- # source://rexml//lib/rexml/parseexception.rb#4
3838
- def continued_exception=(_arg0); end
3839
-
3840
- # source://rexml//lib/rexml/parseexception.rb#44
3841
- def line; end
3842
-
3843
- # Returns the value of attribute parser.
3844
- #
3845
- # source://rexml//lib/rexml/parseexception.rb#4
3846
- def parser; end
3847
-
3848
- # Sets the attribute parser
3849
- #
3850
- # @param value the value to set the attribute parser to.
3851
- #
3852
- # source://rexml//lib/rexml/parseexception.rb#4
3853
- def parser=(_arg0); end
3854
-
3855
- # source://rexml//lib/rexml/parseexception.rb#39
3856
- def position; end
3857
-
3858
- # Returns the value of attribute source.
3859
- #
3860
- # source://rexml//lib/rexml/parseexception.rb#4
3861
- def source; end
3862
-
3863
- # Sets the attribute source
3864
- #
3865
- # @param value the value to set the attribute source to.
3866
- #
3867
- # source://rexml//lib/rexml/parseexception.rb#4
3868
- def source=(_arg0); end
3869
-
3870
- # source://rexml//lib/rexml/parseexception.rb#13
3871
- def to_s; end
3872
- end
3873
-
3874
- # = Using the Pull Parser
3875
- # <em>This API is experimental, and subject to change.</em>
3876
- # parser = PullParser.new( "<a>text<b att='val'/>txet</a>" )
3877
- # while parser.has_next?
3878
- # res = parser.next
3879
- # puts res[1]['att'] if res.start_tag? and res[0] == 'b'
3880
- # end
3881
- # See the PullEvent class for information on the content of the results.
3882
- # The data is identical to the arguments passed for the various events to
3883
- # the StreamListener API.
3884
- #
3885
- # Notice that:
3886
- # parser = PullParser.new( "<a>BAD DOCUMENT" )
3887
- # while parser.has_next?
3888
- # res = parser.next
3889
- # raise res[1] if res.error?
3890
- # end
3891
- #
3892
- # Nat Price gave me some good ideas for the API.
3893
- #
3894
- # source://rexml//lib/rexml/parsers/baseparser.rb#57
3895
- class REXML::Parsers::BaseParser
3896
- # @return [BaseParser] a new instance of BaseParser
3897
- #
3898
- # source://rexml//lib/rexml/parsers/baseparser.rb#163
3899
- def initialize(source); end
3900
-
3901
- # source://rexml//lib/rexml/parsers/baseparser.rb#173
3902
- def add_listener(listener); end
3903
-
3904
- # Returns true if there are no more events
3905
- #
3906
- # @return [Boolean]
3907
- #
3908
- # source://rexml//lib/rexml/parsers/baseparser.rb#208
3909
- def empty?; end
3910
-
3911
- # source://rexml//lib/rexml/parsers/baseparser.rb#540
3912
- def entity(reference, entities); end
3913
-
3914
- # Returns the value of attribute entity_expansion_count.
3915
- #
3916
- # source://rexml//lib/rexml/parsers/baseparser.rb#178
3917
- def entity_expansion_count; end
3918
-
3919
- # Sets the attribute entity_expansion_limit
3920
- #
3921
- # @param value the value to set the attribute entity_expansion_limit to.
3922
- #
3923
- # source://rexml//lib/rexml/parsers/baseparser.rb#179
3924
- def entity_expansion_limit=(_arg0); end
3925
-
3926
- # Sets the attribute entity_expansion_text_limit
3927
- #
3928
- # @param value the value to set the attribute entity_expansion_text_limit to.
3929
- #
3930
- # source://rexml//lib/rexml/parsers/baseparser.rb#180
3931
- def entity_expansion_text_limit=(_arg0); end
3932
-
3933
- # Returns true if there are more events. Synonymous with !empty?
3934
- #
3935
- # @return [Boolean]
3936
- #
3937
- # source://rexml//lib/rexml/parsers/baseparser.rb#213
3938
- def has_next?; end
3939
-
3940
- # Escapes all possible entities
3941
- #
3942
- # source://rexml//lib/rexml/parsers/baseparser.rb#551
3943
- def normalize(input, entities = T.unsafe(nil), entity_filter = T.unsafe(nil)); end
3944
-
3945
- # Peek at the +depth+ event in the stack. The first element on the stack
3946
- # is at depth 0. If +depth+ is -1, will parse to the end of the input
3947
- # stream and return the last event, which is always :end_document.
3948
- # Be aware that this causes the stream to be parsed up to the +depth+
3949
- # event, so you can effectively pre-parse the entire document (pull the
3950
- # entire thing into memory) using this method.
3951
- #
3952
- # source://rexml//lib/rexml/parsers/baseparser.rb#229
3953
- def peek(depth = T.unsafe(nil)); end
3954
-
3955
- # source://rexml//lib/rexml/parsers/baseparser.rb#198
3956
- def position; end
3957
-
3958
- # Returns the next event. This is a +PullEvent+ object.
3959
- #
3960
- # source://rexml//lib/rexml/parsers/baseparser.rb#244
3961
- def pull; end
3962
-
3963
- # source://rexml//lib/rexml/parsers/baseparser.rb#187
3964
- def reset; end
3965
-
3966
- # Returns the value of attribute source.
3967
- #
3968
- # source://rexml//lib/rexml/parsers/baseparser.rb#177
3969
- def source; end
3970
-
3971
- # source://rexml//lib/rexml/parsers/baseparser.rb#182
3972
- def stream=(source); end
3973
-
3974
- # Unescapes all possible entities
3975
- #
3976
- # source://rexml//lib/rexml/parsers/baseparser.rb#567
3977
- def unnormalize(string, entities = T.unsafe(nil), filter = T.unsafe(nil)); end
3978
-
3979
- # Push an event back on the head of the stream. This method
3980
- # has (theoretically) infinite depth.
3981
- #
3982
- # source://rexml//lib/rexml/parsers/baseparser.rb#219
3983
- def unshift(token); end
3984
-
3985
- private
3986
-
3987
- # source://rexml//lib/rexml/parsers/baseparser.rb#616
3988
- def add_namespace(prefix, uri); end
3989
-
3990
- # @return [Boolean]
3991
- #
3992
- # source://rexml//lib/rexml/parsers/baseparser.rb#649
3993
- def need_source_encoding_update?(xml_declaration_encoding); end
3994
-
3995
- # source://rexml//lib/rexml/parsers/baseparser.rb#769
3996
- def parse_attributes(prefixes); end
3997
-
3998
- # source://rexml//lib/rexml/parsers/baseparser.rb#668
3999
- def parse_id(base_error_message, accept_external_id:, accept_public_id:); end
4000
-
4001
- # source://rexml//lib/rexml/parsers/baseparser.rb#696
4002
- def parse_id_invalid_details(accept_external_id:, accept_public_id:); end
4003
-
4004
- # source://rexml//lib/rexml/parsers/baseparser.rb#655
4005
- def parse_name(base_error_message); end
4006
-
4007
- # source://rexml//lib/rexml/parsers/baseparser.rb#631
4008
- def pop_namespaces_restore; end
4009
-
4010
- # source://rexml//lib/rexml/parsers/baseparser.rb#734
4011
- def process_instruction; end
4012
-
4013
- # source://rexml//lib/rexml/parsers/baseparser.rb#254
4014
- def pull_event; end
4015
-
4016
- # source://rexml//lib/rexml/parsers/baseparser.rb#625
4017
- def push_namespaces_restore; end
4018
-
4019
- # source://rexml//lib/rexml/parsers/baseparser.rb#642
4020
- def record_entity_expansion(delta = T.unsafe(nil)); end
4021
- end
4022
-
4023
- # source://rexml//lib/rexml/parsers/baseparser.rb#130
4024
- REXML::Parsers::BaseParser::EXTERNAL_ID_PUBLIC = T.let(T.unsafe(nil), Regexp)
4025
-
4026
- # source://rexml//lib/rexml/parsers/baseparser.rb#131
4027
- REXML::Parsers::BaseParser::EXTERNAL_ID_SYSTEM = T.let(T.unsafe(nil), Regexp)
4028
-
4029
- # source://rexml//lib/rexml/parsers/baseparser.rb#132
4030
- REXML::Parsers::BaseParser::PUBLIC_ID = T.let(T.unsafe(nil), Regexp)
4031
-
4032
- # source://rexml//lib/rexml/parsers/baseparser.rb#143
4033
- module REXML::Parsers::BaseParser::Private; end
4034
-
4035
- # source://rexml//lib/rexml/parsers/baseparser.rb#147
4036
- REXML::Parsers::BaseParser::Private::ATTLISTDECL_END = T.let(T.unsafe(nil), Regexp)
4037
-
4038
- # source://rexml//lib/rexml/parsers/baseparser.rb#152
4039
- REXML::Parsers::BaseParser::Private::CARRIAGE_RETURN_NEWLINE_PATTERN = T.let(T.unsafe(nil), Regexp)
4040
-
4041
- # source://rexml//lib/rexml/parsers/baseparser.rb#153
4042
- REXML::Parsers::BaseParser::Private::CHARACTER_REFERENCES = T.let(T.unsafe(nil), Regexp)
4043
-
4044
- # source://rexml//lib/rexml/parsers/baseparser.rb#146
4045
- REXML::Parsers::BaseParser::Private::CLOSE_PATTERN = T.let(T.unsafe(nil), Regexp)
4046
-
4047
- # source://rexml//lib/rexml/parsers/baseparser.rb#154
4048
- REXML::Parsers::BaseParser::Private::DEFAULT_ENTITIES_PATTERNS = T.let(T.unsafe(nil), Hash)
4049
-
4050
- # source://rexml//lib/rexml/parsers/baseparser.rb#151
4051
- REXML::Parsers::BaseParser::Private::ENTITYDECL_PATTERN = T.let(T.unsafe(nil), Regexp)
4052
-
4053
- # source://rexml//lib/rexml/parsers/baseparser.rb#149
4054
- REXML::Parsers::BaseParser::Private::GEDECL_PATTERN = T.let(T.unsafe(nil), String)
4055
-
4056
- # source://rexml//lib/rexml/parsers/baseparser.rb#148
4057
- REXML::Parsers::BaseParser::Private::NAME_PATTERN = T.let(T.unsafe(nil), Regexp)
4058
-
4059
- # source://rexml//lib/rexml/parsers/baseparser.rb#150
4060
- REXML::Parsers::BaseParser::Private::PEDECL_PATTERN = T.let(T.unsafe(nil), String)
4061
-
4062
- # source://rexml//lib/rexml/parsers/baseparser.rb#144
4063
- REXML::Parsers::BaseParser::Private::PEREFERENCE_PATTERN = T.let(T.unsafe(nil), Regexp)
4064
-
4065
- # source://rexml//lib/rexml/parsers/baseparser.rb#145
4066
- REXML::Parsers::BaseParser::Private::TAG_PATTERN = T.let(T.unsafe(nil), Regexp)
4067
-
4068
- # source://rexml//lib/rexml/parsers/baseparser.rb#159
4069
- REXML::Parsers::BaseParser::Private::XML_PREFIXED_NAMESPACE = T.let(T.unsafe(nil), String)
4070
-
4071
- # source://rexml//lib/rexml/parsers/baseparser.rb#66
4072
- REXML::Parsers::BaseParser::QNAME = T.let(T.unsafe(nil), Regexp)
4073
-
4074
- # source://rexml//lib/rexml/parsers/baseparser.rb#65
4075
- REXML::Parsers::BaseParser::QNAME_STR = T.let(T.unsafe(nil), String)
4076
-
4077
- # source://rexml//lib/rexml/parsers/streamparser.rb#6
4078
- class REXML::Parsers::StreamParser
4079
- # @return [StreamParser] a new instance of StreamParser
4080
- #
4081
- # source://rexml//lib/rexml/parsers/streamparser.rb#7
4082
- def initialize(source, listener); end
4083
-
4084
- # source://rexml//lib/rexml/parsers/streamparser.rb#13
4085
- def add_listener(listener); end
4086
-
4087
- # source://rexml//lib/rexml/parsers/streamparser.rb#17
4088
- def entity_expansion_count; end
4089
-
4090
- # source://rexml//lib/rexml/parsers/streamparser.rb#21
4091
- def entity_expansion_limit=(limit); end
4092
-
4093
- # source://rexml//lib/rexml/parsers/streamparser.rb#25
4094
- def entity_expansion_text_limit=(limit); end
4095
-
4096
- # source://rexml//lib/rexml/parsers/streamparser.rb#29
4097
- def parse; end
4098
- end
4099
-
4100
- # source://rexml//lib/rexml/parsers/baseparser.rb#28
4101
- module REXML::Parsers::StringScannerCaptures; end
4102
-
4103
- # source://rexml//lib/rexml/parsers/treeparser.rb#7
4104
- class REXML::Parsers::TreeParser
4105
- # @return [TreeParser] a new instance of TreeParser
4106
- #
4107
- # source://rexml//lib/rexml/parsers/treeparser.rb#8
4108
- def initialize(source, build_context = T.unsafe(nil)); end
4109
-
4110
- # source://rexml//lib/rexml/parsers/treeparser.rb#13
4111
- def add_listener(listener); end
4112
-
4113
- # source://rexml//lib/rexml/parsers/treeparser.rb#17
4114
- def parse; end
4115
- end
4116
-
4117
- # You don't want to use this class. Really. Use XPath, which is a wrapper
4118
- # for this class. Believe me. You don't want to poke around in here.
4119
- # There is strange, dark magic at work in this code. Beware. Go back! Go
4120
- # back while you still can!
4121
- #
4122
- # source://rexml//lib/rexml/parsers/xpathparser.rb#12
4123
- class REXML::Parsers::XPathParser
4124
- include ::REXML::XMLTokens
4125
-
4126
- # source://rexml//lib/rexml/parsers/xpathparser.rb#42
4127
- def abbreviate(path_or_parsed); end
4128
-
4129
- # source://rexml//lib/rexml/parsers/xpathparser.rb#132
4130
- def expand(path_or_parsed); end
4131
-
4132
- # source://rexml//lib/rexml/parsers/xpathparser.rb#16
4133
- def namespaces=(namespaces); end
4134
-
4135
- # source://rexml//lib/rexml/parsers/xpathparser.rb#21
4136
- def parse(path); end
4137
-
4138
- # For backward compatibility
4139
- #
4140
- # source://rexml//lib/rexml/parsers/xpathparser.rb#174
4141
- def preciate_to_string(parsed, &block); end
4142
-
4143
- # source://rexml//lib/rexml/parsers/xpathparser.rb#36
4144
- def predicate(path); end
4145
-
4146
- # source://rexml//lib/rexml/parsers/xpathparser.rb#174
4147
- def predicate_to_path(parsed, &block); end
4148
-
4149
- private
4150
-
4151
- # | AdditiveExpr ('+' | '-') MultiplicativeExpr
4152
- # | MultiplicativeExpr
4153
- #
4154
- # source://rexml//lib/rexml/parsers/xpathparser.rb#505
4155
- def AdditiveExpr(path, parsed); end
4156
-
4157
- # | AndExpr S 'and' S EqualityExpr
4158
- # | EqualityExpr
4159
- #
4160
- # source://rexml//lib/rexml/parsers/xpathparser.rb#438
4161
- def AndExpr(path, parsed); end
4162
-
4163
- # | EqualityExpr ('=' | '!=') RelationalExpr
4164
- # | RelationalExpr
4165
- #
4166
- # source://rexml//lib/rexml/parsers/xpathparser.rb#457
4167
- def EqualityExpr(path, parsed); end
4168
-
4169
- # | FilterExpr Predicate
4170
- # | PrimaryExpr
4171
- #
4172
- # source://rexml//lib/rexml/parsers/xpathparser.rb#608
4173
- def FilterExpr(path, parsed); end
4174
-
4175
- # | FUNCTION_NAME '(' ( expr ( ',' expr )* )? ')'
4176
- #
4177
- # source://rexml//lib/rexml/parsers/xpathparser.rb#663
4178
- def FunctionCall(rest, parsed); end
4179
-
4180
- # LocationPath
4181
- # | RelativeLocationPath
4182
- # | '/' RelativeLocationPath?
4183
- # | '//' RelativeLocationPath
4184
- #
4185
- # source://rexml//lib/rexml/parsers/xpathparser.rb#243
4186
- def LocationPath(path, parsed); end
4187
-
4188
- # | MultiplicativeExpr ('*' | S ('div' | 'mod') S) UnaryExpr
4189
- # | UnaryExpr
4190
- #
4191
- # source://rexml//lib/rexml/parsers/xpathparser.rb#528
4192
- def MultiplicativeExpr(path, parsed); end
4193
-
4194
- # source://rexml//lib/rexml/parsers/xpathparser.rb#343
4195
- def NodeTest(path, parsed); end
4196
-
4197
- # | OrExpr S 'or' S AndExpr
4198
- # | AndExpr
4199
- #
4200
- # source://rexml//lib/rexml/parsers/xpathparser.rb#419
4201
- def OrExpr(path, parsed); end
4202
-
4203
- # | LocationPath
4204
- # | FilterExpr ('/' | '//') RelativeLocationPath
4205
- #
4206
- # source://rexml//lib/rexml/parsers/xpathparser.rb#590
4207
- def PathExpr(path, parsed); end
4208
-
4209
- # Filters the supplied nodeset on the predicate(s)
4210
- #
4211
- # source://rexml//lib/rexml/parsers/xpathparser.rb#395
4212
- def Predicate(path, parsed); end
4213
-
4214
- # source://rexml//lib/rexml/parsers/xpathparser.rb#626
4215
- def PrimaryExpr(path, parsed); end
4216
-
4217
- # | RelationalExpr ('<' | '>' | '<=' | '>=') AdditiveExpr
4218
- # | AdditiveExpr
4219
- #
4220
- # source://rexml//lib/rexml/parsers/xpathparser.rb#480
4221
- def RelationalExpr(path, parsed); end
4222
-
4223
- # source://rexml//lib/rexml/parsers/xpathparser.rb#267
4224
- def RelativeLocationPath(path, parsed); end
4225
-
4226
- # | '-' UnaryExpr
4227
- # | UnionExpr
4228
- #
4229
- # source://rexml//lib/rexml/parsers/xpathparser.rb#553
4230
- def UnaryExpr(path, parsed); end
4231
-
4232
- # | UnionExpr '|' PathExpr
4233
- # | PathExpr
4234
- #
4235
- # source://rexml//lib/rexml/parsers/xpathparser.rb#571
4236
- def UnionExpr(path, parsed); end
4237
-
4238
- # get_group( '[foo]bar' ) -> ['bar', '[foo]']
4239
- #
4240
- # source://rexml//lib/rexml/parsers/xpathparser.rb#676
4241
- def get_group(string); end
4242
-
4243
- # source://rexml//lib/rexml/parsers/xpathparser.rb#694
4244
- def parse_args(string); end
4245
-
4246
- # source://rexml//lib/rexml/parsers/xpathparser.rb#224
4247
- def quote_literal(literal); end
4248
- end
4249
-
4250
- # source://rexml//lib/rexml/parsers/xpathparser.rb#339
4251
- REXML::Parsers::XPathParser::LOCAL_NAME_WILDCARD = T.let(T.unsafe(nil), Regexp)
4252
-
4253
- # Returns a 1-1 map of the nodeset
4254
- # The contents of the resulting array are either:
4255
- # true/false, if a positive match
4256
- # String, if a name match
4257
- # NodeTest
4258
- # | ('*' | NCNAME ':' '*' | QNAME) NameTest
4259
- # | '*' ':' NCNAME NameTest since XPath 2.0
4260
- # | NODE_TYPE '(' ')' NodeType
4261
- # | PI '(' LITERAL ')' PI
4262
- # | '[' expr ']' Predicate
4263
- #
4264
- # source://rexml//lib/rexml/parsers/xpathparser.rb#338
4265
- REXML::Parsers::XPathParser::PREFIX_WILDCARD = T.let(T.unsafe(nil), Regexp)
4266
-
4267
- # source://rexml//lib/rexml/doctype.rb#10
4268
- class REXML::ReferenceWriter
4269
- # @return [ReferenceWriter] a new instance of ReferenceWriter
4270
- #
4271
- # source://rexml//lib/rexml/doctype.rb#11
4272
- def initialize(id_type, public_id_literal, system_literal, context = T.unsafe(nil)); end
4273
-
4274
- # source://rexml//lib/rexml/doctype.rb#25
4275
- def write(output); end
4276
- end
4277
-
4278
- # A Source can be searched for patterns, and wraps buffers and other
4279
- # objects and provides consumption of text
4280
- #
4281
- # source://rexml//lib/rexml/source.rb#61
4282
- class REXML::Source
4283
- include ::REXML::Encoding
4284
-
4285
- # Constructor
4286
- # value, overriding all encoding detection
4287
- #
4288
- # @param arg must be a String, and should be a valid XML document
4289
- # @param encoding if non-null, sets the encoding of the source to this
4290
- # @return [Source] a new instance of Source
4291
- #
4292
- # source://rexml//lib/rexml/source.rb#81
4293
- def initialize(arg, encoding = T.unsafe(nil)); end
4294
-
4295
- # The current buffer (what we're going to read next)
4296
- #
4297
- # source://rexml//lib/rexml/source.rb#94
4298
- def buffer; end
4299
-
4300
- # source://rexml//lib/rexml/source.rb#104
4301
- def buffer_encoding=(encoding); end
4302
-
4303
- # @return the current line in the source
4304
- #
4305
- # source://rexml//lib/rexml/source.rb#161
4306
- def current_line; end
4307
-
4308
- # source://rexml//lib/rexml/source.rb#98
4309
- def drop_parsed_content; end
4310
-
4311
- # @return [Boolean] true if the Source is exhausted
4312
- #
4313
- # source://rexml//lib/rexml/source.rb#156
4314
- def empty?; end
4315
-
4316
- # Returns the value of attribute encoding.
4317
- #
4318
- # source://rexml//lib/rexml/source.rb#65
4319
- def encoding; end
4320
-
4321
- # Inherited from Encoding
4322
- # Overridden to support optimized en/decoding
4323
- #
4324
- # source://rexml//lib/rexml/source.rb#110
4325
- def encoding=(enc); end
4326
-
4327
- # source://rexml//lib/rexml/source.rb#128
4328
- def ensure_buffer; end
4329
-
4330
- # The line number of the last consumed text
4331
- #
4332
- # source://rexml//lib/rexml/source.rb#64
4333
- def line; end
4334
-
4335
- # source://rexml//lib/rexml/source.rb#131
4336
- def match(pattern, cons = T.unsafe(nil)); end
4337
-
4338
- # @return [Boolean]
4339
- #
4340
- # source://rexml//lib/rexml/source.rb#139
4341
- def match?(pattern, cons = T.unsafe(nil)); end
4342
-
4343
- # source://rexml//lib/rexml/source.rb#147
4344
- def position; end
4345
-
4346
- # source://rexml//lib/rexml/source.rb#151
4347
- def position=(pos); end
4348
-
4349
- # source://rexml//lib/rexml/source.rb#115
4350
- def read(term = T.unsafe(nil)); end
4351
-
4352
- # source://rexml//lib/rexml/source.rb#118
4353
- def read_until(term); end
4354
-
4355
- private
4356
-
4357
- # source://rexml//lib/rexml/source.rb#170
4358
- def detect_encoding; end
4359
-
4360
- # source://rexml//lib/rexml/source.rb#188
4361
- def encoding_updated; end
4362
- end
4363
-
4364
- # source://rexml//lib/rexml/source.rb#67
4365
- module REXML::Source::Private; end
4366
-
4367
- # source://rexml//lib/rexml/source.rb#69
4368
- REXML::Source::Private::PRE_DEFINED_TERM_PATTERNS = T.let(T.unsafe(nil), Hash)
4369
-
4370
- # source://rexml//lib/rexml/source.rb#68
4371
- REXML::Source::Private::SCANNER_RESET_SIZE = T.let(T.unsafe(nil), Integer)
4372
-
4373
- # Represents text nodes in an XML document
4374
- #
4375
- # source://rexml//lib/rexml/text.rb#11
4376
- class REXML::Text < ::REXML::Child
4377
- include ::Comparable
4378
-
4379
- # Constructor
4380
- # +arg+ if a String, the content is set to the String. If a Text,
4381
- # the object is shallowly cloned.
4382
- #
4383
- # +respect_whitespace+ (boolean, false) if true, whitespace is
4384
- # respected
4385
- #
4386
- # +parent+ (nil) if this is a Parent object, the parent
4387
- # will be set to this.
4388
- #
4389
- # +raw+ (nil) This argument can be given three values.
4390
- # If true, then the value of used to construct this object is expected to
4391
- # contain no unescaped XML markup, and REXML will not change the text. If
4392
- # this value is false, the string may contain any characters, and REXML will
4393
- # escape any and all defined entities whose values are contained in the
4394
- # text. If this value is nil (the default), then the raw value of the
4395
- # parent will be used as the raw value for this node. If there is no raw
4396
- # value for the parent, and no value is supplied, the default is false.
4397
- # Use this field if you have entities defined for some text, and you don't
4398
- # want REXML to escape that text in output.
4399
- # Text.new( "<&", false, nil, false ) #-> "&lt;&amp;"
4400
- # Text.new( "&lt;&amp;", false, nil, false ) #-> "&amp;lt;&amp;amp;"
4401
- # Text.new( "<&", false, nil, true ) #-> Parse exception
4402
- # Text.new( "&lt;&amp;", false, nil, true ) #-> "&lt;&amp;"
4403
- # # Assume that the entity "s" is defined to be "sean"
4404
- # # and that the entity "r" is defined to be "russell"
4405
- # Text.new( "sean russell" ) #-> "&s; &r;"
4406
- # Text.new( "sean russell", false, nil, true ) #-> "sean russell"
4407
- #
4408
- # +entity_filter+ (nil) This can be an array of entities to match in the
4409
- # supplied text. This argument is only useful if +raw+ is set to false.
4410
- # Text.new( "sean russell", false, nil, false, ["s"] ) #-> "&s; russell"
4411
- # Text.new( "sean russell", false, nil, true, ["s"] ) #-> "sean russell"
4412
- # In the last example, the +entity_filter+ argument is ignored.
4413
- #
4414
- # +illegal+ INTERNAL USE ONLY
4415
- #
4416
- # @return [Text] a new instance of Text
4417
- #
4418
- # source://rexml//lib/rexml/text.rb#79
4419
- def initialize(arg, respect_whitespace = T.unsafe(nil), parent = T.unsafe(nil), raw = T.unsafe(nil), entity_filter = T.unsafe(nil), illegal = T.unsafe(nil)); end
4420
-
4421
- # Appends text to this text node. The text is appended in the +raw+ mode
4422
- # of this text node.
4423
- #
4424
- # +returns+ the text itself to enable method chain like
4425
- # 'text << "XXX" << "YYY"'.
4426
- #
4427
- # source://rexml//lib/rexml/text.rb#189
4428
- def <<(to_append); end
4429
-
4430
- # +other+ a String or a Text
4431
- # +returns+ the result of (to_s <=> arg.to_s)
4432
- #
4433
- # source://rexml//lib/rexml/text.rb#198
4434
- def <=>(other); end
4435
-
4436
- # source://rexml//lib/rexml/text.rb#179
4437
- def clone; end
4438
-
4439
- # source://rexml//lib/rexml/text.rb#202
4440
- def doctype; end
4441
-
4442
- # @return [Boolean]
4443
- #
4444
- # source://rexml//lib/rexml/text.rb#174
4445
- def empty?; end
4446
-
4447
- # source://rexml//lib/rexml/text.rb#274
4448
- def indent_text(string, level = T.unsafe(nil), style = T.unsafe(nil), indentfirstline = T.unsafe(nil)); end
4449
-
4450
- # source://rexml//lib/rexml/text.rb#228
4451
- def inspect; end
4452
-
4453
- # source://rexml//lib/rexml/text.rb#170
4454
- def node_type; end
4455
-
4456
- # source://rexml//lib/rexml/text.rb#110
4457
- def parent=(parent); end
4458
-
4459
- # If +raw+ is true, then REXML leaves the value alone
4460
- #
4461
- # source://rexml//lib/rexml/text.rb#21
4462
- def raw; end
4463
-
4464
- # If +raw+ is true, then REXML leaves the value alone
4465
- #
4466
- # source://rexml//lib/rexml/text.rb#21
4467
- def raw=(_arg0); end
4468
-
4469
- # Returns the string value of this text node. This string is always
4470
- # escaped, meaning that it is a valid XML text node string, and all
4471
- # entities that can be escaped, have been inserted. This method respects
4472
- # the entity filter set in the constructor.
4473
- #
4474
- # # Assume that the entity "s" is defined to be "sean", and that the
4475
- # # entity "r" is defined to be "russell"
4476
- # t = Text.new( "< & sean russell", false, nil, false, ['s'] )
4477
- # t.to_s #-> "&lt; &amp; &s; russell"
4478
- # t = Text.new( "< & &s; russell", false, nil, false )
4479
- # t.to_s #-> "&lt; &amp; &s; russell"
4480
- # u = Text.new( "sean russell", false, nil, true )
4481
- # u.to_s #-> "sean russell"
4482
- #
4483
- # source://rexml//lib/rexml/text.rb#223
4484
- def to_s; end
4485
-
4486
- # Returns the string value of this text. This is the text without
4487
- # entities, as it might be used programmatically, or printed to the
4488
- # console. This ignores the 'raw' attribute setting, and any
4489
- # entity_filter.
4490
- #
4491
- # # Assume that the entity "s" is defined to be "sean", and that the
4492
- # # entity "r" is defined to be "russell"
4493
- # t = Text.new( "< & sean russell", false, nil, false, ['s'] )
4494
- # t.value #-> "< & sean russell"
4495
- # t = Text.new( "< & &s; russell", false, nil, false )
4496
- # t.value #-> "< & sean russell"
4497
- # u = Text.new( "sean russell", false, nil, true )
4498
- # u.value #-> "sean russell"
4499
- #
4500
- # source://rexml//lib/rexml/text.rb#245
4501
- def value; end
4502
-
4503
- # Sets the contents of this text node. This expects the text to be
4504
- # unnormalized. It returns self.
4505
- #
4506
- # e = Element.new( "a" )
4507
- # e.add_text( "foo" ) # <a>foo</a>
4508
- # e[0].value = "bar" # <a>bar</a>
4509
- # e[0].value = "<a>" # <a>&lt;a&gt;</a>
4510
- #
4511
- # source://rexml//lib/rexml/text.rb#257
4512
- def value=(val); end
4513
-
4514
- # source://rexml//lib/rexml/text.rb#263
4515
- def wrap(string, width, addnewline = T.unsafe(nil)); end
4516
-
4517
- # == DEPRECATED
4518
- # See REXML::Formatters
4519
- #
4520
- # source://rexml//lib/rexml/text.rb#289
4521
- def write(writer, indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
4522
-
4523
- # Writes out text, substituting special characters beforehand.
4524
- # +out+ A String, IO, or any other object supporting <<( String )
4525
- # +input+ the text to substitute and the write out
4526
- #
4527
- # z=utf8.unpack("U*")
4528
- # ascOut=""
4529
- # z.each{|r|
4530
- # if r < 0x100
4531
- # ascOut.concat(r.chr)
4532
- # else
4533
- # ascOut.concat(sprintf("&#x%x;", r))
4534
- # end
4535
- # }
4536
- # puts ascOut
4537
- #
4538
- # source://rexml//lib/rexml/text.rb#321
4539
- def write_with_substitution(out, input); end
4540
-
4541
- # FIXME
4542
- # This probably won't work properly
4543
- #
4544
- # source://rexml//lib/rexml/text.rb#301
4545
- def xpath; end
4546
-
4547
- private
4548
-
4549
- # source://rexml//lib/rexml/text.rb#334
4550
- def clear_cache; end
4551
-
4552
- class << self
4553
- # check for illegal characters
4554
- #
4555
- # source://rexml//lib/rexml/text.rb#116
4556
- def check(string, pattern, doctype); end
4557
-
4558
- # source://rexml//lib/rexml/text.rb#404
4559
- def expand(ref, doctype, filter); end
4560
-
4561
- # Escapes all possible entities
4562
- #
4563
- # source://rexml//lib/rexml/text.rb#366
4564
- def normalize(input, doctype = T.unsafe(nil), entity_filter = T.unsafe(nil)); end
4565
-
4566
- # Reads text, substituting entities
4567
- #
4568
- # source://rexml//lib/rexml/text.rb#340
4569
- def read_with_substitution(input, illegal = T.unsafe(nil)); end
4570
-
4571
- # Unescapes all possible entities
4572
- #
4573
- # source://rexml//lib/rexml/text.rb#390
4574
- def unnormalize(string, doctype = T.unsafe(nil), filter = T.unsafe(nil), illegal = T.unsafe(nil), entity_expansion_text_limit: T.unsafe(nil)); end
4575
- end
4576
- end
4577
-
4578
- # source://rexml//lib/rexml/undefinednamespaceexception.rb#4
4579
- class REXML::UndefinedNamespaceException < ::REXML::ParseException
4580
- # @return [UndefinedNamespaceException] a new instance of UndefinedNamespaceException
4581
- #
4582
- # source://rexml//lib/rexml/undefinednamespaceexception.rb#5
4583
- def initialize(prefix, source, parser); end
4584
- end
4585
-
4586
- # source://rexml//lib/rexml/validation/validationexception.rb#4
4587
- class REXML::Validation::ValidationException < ::RuntimeError
4588
- # @return [ValidationException] a new instance of ValidationException
4589
- #
4590
- # source://rexml//lib/rexml/validation/validationexception.rb#5
4591
- def initialize(msg); end
4592
- end
4593
-
4594
- # NEEDS DOCUMENTATION
4595
- #
4596
- # source://rexml//lib/rexml/xmldecl.rb#8
4597
- class REXML::XMLDecl < ::REXML::Child
4598
- include ::REXML::Encoding
4599
-
4600
- # @return [XMLDecl] a new instance of XMLDecl
4601
- #
4602
- # source://rexml//lib/rexml/xmldecl.rb#20
4603
- def initialize(version = T.unsafe(nil), encoding = T.unsafe(nil), standalone = T.unsafe(nil)); end
4604
-
4605
- # source://rexml//lib/rexml/xmldecl.rb#56
4606
- def ==(other); end
4607
-
4608
- # source://rexml//lib/rexml/xmldecl.rb#39
4609
- def clone; end
4610
-
4611
- # source://rexml//lib/rexml/xmldecl.rb#102
4612
- def dowrite; end
4613
-
4614
- # source://rexml//lib/rexml/xmldecl.rb#76
4615
- def encoding=(enc); end
4616
-
4617
- # source://rexml//lib/rexml/xmldecl.rb#106
4618
- def inspect; end
4619
-
4620
- # source://rexml//lib/rexml/xmldecl.rb#69
4621
- def node_type; end
4622
-
4623
- # source://rexml//lib/rexml/xmldecl.rb#98
4624
- def nowrite; end
4625
-
4626
- # source://rexml//lib/rexml/encoding.rb#7
4627
- def old_enc=(encoding); end
4628
-
4629
- # Returns the value of attribute standalone.
4630
- #
4631
- # source://rexml//lib/rexml/xmldecl.rb#17
4632
- def stand_alone?; end
4633
-
4634
- # Returns the value of attribute standalone.
4635
- #
4636
- # source://rexml//lib/rexml/xmldecl.rb#17
4637
- def standalone; end
4638
-
4639
- # Sets the attribute standalone
4640
- #
4641
- # @param value the value to set the attribute standalone to.
4642
- #
4643
- # source://rexml//lib/rexml/xmldecl.rb#17
4644
- def standalone=(_arg0); end
4645
-
4646
- # Returns the value of attribute version.
4647
- #
4648
- # source://rexml//lib/rexml/xmldecl.rb#17
4649
- def version; end
4650
-
4651
- # Sets the attribute version
4652
- #
4653
- # @param value the value to set the attribute version to.
4654
- #
4655
- # source://rexml//lib/rexml/xmldecl.rb#17
4656
- def version=(_arg0); end
4657
-
4658
- # indent::
4659
- # Ignored. There must be no whitespace before an XML declaration
4660
- # transitive::
4661
- # Ignored
4662
- # ie_hack::
4663
- # Ignored
4664
- #
4665
- # source://rexml//lib/rexml/xmldecl.rb#49
4666
- def write(writer, indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
4667
-
4668
- # Returns the value of attribute writeencoding.
4669
- #
4670
- # source://rexml//lib/rexml/xmldecl.rb#18
4671
- def writeencoding; end
4672
-
4673
- # Returns the value of attribute writethis.
4674
- #
4675
- # source://rexml//lib/rexml/xmldecl.rb#18
4676
- def writethis; end
4677
-
4678
- # source://rexml//lib/rexml/xmldecl.rb#63
4679
- def xmldecl(version, encoding, standalone); end
4680
-
4681
- private
4682
-
4683
- # source://rexml//lib/rexml/xmldecl.rb#111
4684
- def content(enc); end
4685
-
4686
- class << self
4687
- # Only use this if you do not want the XML declaration to be written;
4688
- # this object is ignored by the XML writer. Otherwise, instantiate your
4689
- # own XMLDecl and add it to the document.
4690
- #
4691
- # Note that XML 1.1 documents *must* include an XML declaration
4692
- #
4693
- # source://rexml//lib/rexml/xmldecl.rb#92
4694
- def default; end
4695
- end
4696
- end
4697
-
4698
- # @private
4699
- #
4700
- # source://rexml//lib/rexml/xpath_parser.rb#963
4701
- class REXML::XPathNode
4702
- # @return [XPathNode] a new instance of XPathNode
4703
- #
4704
- # source://rexml//lib/rexml/xpath_parser.rb#965
4705
- def initialize(node, context = T.unsafe(nil)); end
4706
-
4707
- # Returns the value of attribute context.
4708
- #
4709
- # source://rexml//lib/rexml/xpath_parser.rb#964
4710
- def context; end
4711
-
4712
- # source://rexml//lib/rexml/xpath_parser.rb#974
4713
- def position; end
4714
-
4715
- # Returns the value of attribute raw_node.
4716
- #
4717
- # source://rexml//lib/rexml/xpath_parser.rb#964
4718
- def raw_node; end
4719
- end
4720
-
4721
- # You don't want to use this class. Really. Use XPath, which is a wrapper
4722
- # for this class. Believe me. You don't want to poke around in here.
4723
- # There is strange, dark magic at work in this code. Beware. Go back! Go
4724
- # back while you still can!
4725
- #
4726
- # source://rexml//lib/rexml/xpath_parser.rb#54
4727
- class REXML::XPathParser
4728
- include ::REXML::XMLTokens
4729
-
4730
- # @return [XPathParser] a new instance of XPathParser
4731
- #
4732
- # source://rexml//lib/rexml/xpath_parser.rb#60
4733
- def initialize(strict: T.unsafe(nil)); end
4734
-
4735
- # source://rexml//lib/rexml/xpath_parser.rb#94
4736
- def []=(variable_name, value); end
4737
-
4738
- # Performs a depth-first (document order) XPath search, and returns the
4739
- # first match. This is the fastest, lightest way to return a single result.
4740
- #
4741
- # FIXME: This method is incomplete!
4742
- #
4743
- # source://rexml//lib/rexml/xpath_parser.rb#103
4744
- def first(path_stack, node); end
4745
-
4746
- # source://rexml//lib/rexml/xpath_parser.rb#84
4747
- def get_first(path, nodeset); end
4748
-
4749
- # source://rexml//lib/rexml/xpath_parser.rb#139
4750
- def match(path_stack, nodeset); end
4751
-
4752
- # source://rexml//lib/rexml/xpath_parser.rb#69
4753
- def namespaces=(namespaces = T.unsafe(nil)); end
4754
-
4755
- # source://rexml//lib/rexml/xpath_parser.rb#79
4756
- def parse(path, nodeset); end
4757
-
4758
- # source://rexml//lib/rexml/xpath_parser.rb#89
4759
- def predicate(path, nodeset); end
4760
-
4761
- # source://rexml//lib/rexml/xpath_parser.rb#74
4762
- def variables=(vars = T.unsafe(nil)); end
4763
-
4764
- private
4765
-
4766
- # source://rexml//lib/rexml/xpath_parser.rb#779
4767
- def child(nodeset); end
4768
-
4769
- # source://rexml//lib/rexml/xpath_parser.rb#920
4770
- def compare(a, operator, b); end
4771
-
4772
- # source://rexml//lib/rexml/xpath_parser.rb#682
4773
- def descendant(nodeset, include_self); end
4774
-
4775
- # source://rexml//lib/rexml/xpath_parser.rb#693
4776
- def descendant_recursive(raw_node, new_nodeset, new_nodes, include_self); end
4777
-
4778
- # source://rexml//lib/rexml/xpath_parser.rb#942
4779
- def each_unnode(nodeset); end
4780
-
4781
- # source://rexml//lib/rexml/xpath_parser.rb#641
4782
- def enter(tag, *args); end
4783
-
4784
- # source://rexml//lib/rexml/xpath_parser.rb#819
4785
- def equality_relational_compare(set1, op, set2); end
4786
-
4787
- # source://rexml//lib/rexml/xpath_parser.rb#591
4788
- def evaluate_predicate(expression, nodesets); end
4789
-
4790
- # Expr takes a stack of path elements and a set of nodes (either a Parent
4791
- # or an Array and returns an Array of matching nodes
4792
- #
4793
- # source://rexml//lib/rexml/xpath_parser.rb#175
4794
- def expr(path_stack, nodeset, context = T.unsafe(nil)); end
4795
-
4796
- # source://rexml//lib/rexml/xpath_parser.rb#582
4797
- def filter_nodeset(nodeset); end
4798
-
4799
- # source://rexml//lib/rexml/xpath_parser.rb#749
4800
- def following(node); end
4801
-
4802
- # source://rexml//lib/rexml/xpath_parser.rb#760
4803
- def following_node_of(node); end
4804
-
4805
- # Returns a String namespace for a node, given a prefix
4806
- # The rules are:
4807
- #
4808
- # 1. Use the supplied namespace mapping first.
4809
- # 2. If no mapping was supplied, use the context node to look up the namespace
4810
- #
4811
- # source://rexml//lib/rexml/xpath_parser.rb#163
4812
- def get_namespace(node, prefix); end
4813
-
4814
- # source://rexml//lib/rexml/xpath_parser.rb#646
4815
- def leave(tag, *args); end
4816
-
4817
- # source://rexml//lib/rexml/xpath_parser.rb#767
4818
- def next_sibling_node(node); end
4819
-
4820
- # source://rexml//lib/rexml/xpath_parser.rb#477
4821
- def node_test(path_stack, nodesets, any_type: T.unsafe(nil)); end
4822
-
4823
- # source://rexml//lib/rexml/xpath_parser.rb#806
4824
- def norm(b); end
4825
-
4826
- # source://rexml//lib/rexml/xpath_parser.rb#894
4827
- def normalize_compare_values(a, operator, b); end
4828
-
4829
- # Builds a nodeset of all of the preceding nodes of the supplied node,
4830
- # in reverse document order
4831
- # preceding:: includes every element in the document that precedes this node,
4832
- # except for ancestors
4833
- #
4834
- # source://rexml//lib/rexml/xpath_parser.rb#712
4835
- def preceding(node); end
4836
-
4837
- # source://rexml//lib/rexml/xpath_parser.rb#734
4838
- def preceding_node_of(node); end
4839
-
4840
- # Reorders an array of nodes so that they are in document order
4841
- # It tries to do this efficiently.
4842
- #
4843
- # FIXME: I need to get rid of this, but the issue is that most of the XPath
4844
- # interpreter functions as a filter, which means that we lose context going
4845
- # in and out of function calls. If I knew what the index of the nodes was,
4846
- # I wouldn't have to do this. Maybe add a document IDX for each node?
4847
- # Problems with mutable documents. Or, rewrite everything.
4848
- #
4849
- # source://rexml//lib/rexml/xpath_parser.rb#659
4850
- def sort(array_of_nodes, order); end
4851
-
4852
- # source://rexml//lib/rexml/xpath_parser.rb#441
4853
- def step(path_stack, any_type: T.unsafe(nil), order: T.unsafe(nil)); end
4854
-
4855
- # @return [Boolean]
4856
- #
4857
- # source://rexml//lib/rexml/xpath_parser.rb#154
4858
- def strict?; end
4859
-
4860
- # source://rexml//lib/rexml/xpath_parser.rb#634
4861
- def trace(*args); end
4862
-
4863
- # source://rexml//lib/rexml/xpath_parser.rb#954
4864
- def unnode(nodeset); end
4865
-
4866
- # source://rexml//lib/rexml/xpath_parser.rb#881
4867
- def value_type(value); end
4868
- end
4869
-
4870
- # source://rexml//lib/rexml/xpath_parser.rb#58
4871
- REXML::XPathParser::DEBUG = T.let(T.unsafe(nil), FalseClass)