logstash-output-scalyr 0.1.9 → 0.1.14.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/Gemfile +5 -0
  4. data/README.md +2 -2
  5. data/lib/logstash/outputs/scalyr.rb +265 -142
  6. data/lib/scalyr/common/client.rb +80 -57
  7. data/lib/scalyr/common/util.rb +7 -0
  8. data/lib/scalyr/constants.rb +2 -0
  9. data/logstash-output-scalyr.gemspec +1 -1
  10. data/spec/logstash/outputs/scalyr_integration_spec.rb +187 -8
  11. data/spec/logstash/outputs/scalyr_spec.rb +12 -6
  12. data/vendor/bundle/jruby/2.5.0/cache/addressable-2.7.0.gem +0 -0
  13. data/vendor/bundle/jruby/2.5.0/cache/crack-0.4.5.gem +0 -0
  14. data/vendor/bundle/jruby/2.5.0/cache/hashdiff-1.0.1.gem +0 -0
  15. data/vendor/bundle/jruby/2.5.0/cache/public_suffix-4.0.6.gem +0 -0
  16. data/vendor/bundle/jruby/2.5.0/cache/rexml-3.2.5.gem +0 -0
  17. data/vendor/bundle/jruby/2.5.0/cache/webmock-3.13.0.gem +0 -0
  18. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/CHANGELOG.md +235 -0
  19. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/Gemfile +32 -0
  20. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/LICENSE.txt +202 -0
  21. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/README.md +121 -0
  22. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/Rakefile +34 -0
  23. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/data/unicode.data +0 -0
  24. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable.rb +4 -0
  25. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna.rb +27 -0
  26. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna/native.rb +61 -0
  27. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna/pure.rb +676 -0
  28. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/template.rb +1045 -0
  29. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/uri.rb +2529 -0
  30. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/version.rb +32 -0
  31. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/idna_spec.rb +300 -0
  32. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/net_http_compat_spec.rb +30 -0
  33. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/rack_mount_compat_spec.rb +106 -0
  34. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/security_spec.rb +59 -0
  35. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/template_spec.rb +1451 -0
  36. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/uri_spec.rb +6603 -0
  37. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/spec_helper.rb +24 -0
  38. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/clobber.rake +4 -0
  39. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/gem.rake +93 -0
  40. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/git.rake +47 -0
  41. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/metrics.rake +24 -0
  42. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/rspec.rake +23 -0
  43. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/yard.rake +29 -0
  44. data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack.rb +7 -0
  45. data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/json.rb +98 -0
  46. data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/util.rb +17 -0
  47. data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/version.rb +3 -0
  48. data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/xml.rb +238 -0
  49. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/Gemfile +8 -0
  50. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/LICENSE +19 -0
  51. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/README.md +276 -0
  52. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/Rakefile +18 -0
  53. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/changelog.md +100 -0
  54. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/hashdiff.gemspec +39 -0
  55. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff.rb +10 -0
  56. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/compare_hashes.rb +69 -0
  57. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/diff.rb +177 -0
  58. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/lcs.rb +66 -0
  59. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/lcs_compare_arrays.rb +32 -0
  60. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/linear_compare_array.rb +159 -0
  61. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/patch.rb +88 -0
  62. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/util.rb +155 -0
  63. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/version.rb +5 -0
  64. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/best_diff_spec.rb +75 -0
  65. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/diff_array_spec.rb +60 -0
  66. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/diff_spec.rb +360 -0
  67. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/lcs_spec.rb +76 -0
  68. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/linear_compare_array_spec.rb +50 -0
  69. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/patch_spec.rb +185 -0
  70. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/readme_spec.rb +15 -0
  71. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/util_spec.rb +116 -0
  72. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/spec_helper.rb +15 -0
  73. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/2.0-Upgrade.md +52 -0
  74. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/CHANGELOG.md +406 -0
  75. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/Gemfile +15 -0
  76. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/LICENSE.txt +22 -0
  77. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/README.md +207 -0
  78. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/Rakefile +51 -0
  79. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/SECURITY.md +104 -0
  80. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/bin/console +15 -0
  81. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/codecov.yml +12 -0
  82. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/data/list.txt +13380 -0
  83. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix.rb +179 -0
  84. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/domain.rb +235 -0
  85. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/errors.rb +41 -0
  86. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/list.rb +247 -0
  87. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/rule.rb +350 -0
  88. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/version.rb +13 -0
  89. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/public_suffix.gemspec +29 -0
  90. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/acceptance_test.rb +131 -0
  91. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb +66 -0
  92. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find_all.rb +102 -0
  93. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_names.rb +91 -0
  94. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_select.rb +26 -0
  95. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_select_incremental.rb +25 -0
  96. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_valid.rb +101 -0
  97. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/domain_profiler.rb +12 -0
  98. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/find_profiler.rb +12 -0
  99. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/find_profiler_jp.rb +12 -0
  100. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/initialization_profiler.rb +11 -0
  101. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/list_profsize.rb +11 -0
  102. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/object_binsize.rb +57 -0
  103. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/psl_test.rb +52 -0
  104. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/test_helper.rb +18 -0
  105. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/tests.txt +98 -0
  106. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/domain_test.rb +106 -0
  107. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/errors_test.rb +25 -0
  108. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/list_test.rb +241 -0
  109. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/public_suffix_test.rb +188 -0
  110. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/rule_test.rb +222 -0
  111. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/LICENSE.txt +22 -0
  112. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/NEWS.md +178 -0
  113. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/README.md +48 -0
  114. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/context.rdoc +143 -0
  115. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/child.rdoc +87 -0
  116. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/document.rdoc +276 -0
  117. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/element.rdoc +602 -0
  118. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/node.rdoc +97 -0
  119. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/parent.rdoc +267 -0
  120. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/child_toc.rdoc +12 -0
  121. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/document_toc.rdoc +30 -0
  122. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/element_toc.rdoc +55 -0
  123. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/master_toc.rdoc +135 -0
  124. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/node_toc.rdoc +16 -0
  125. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/parent_toc.rdoc +25 -0
  126. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml.rb +3 -0
  127. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/attlistdecl.rb +63 -0
  128. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/attribute.rb +205 -0
  129. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/cdata.rb +68 -0
  130. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/child.rb +97 -0
  131. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/comment.rb +80 -0
  132. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/doctype.rb +311 -0
  133. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/document.rb +451 -0
  134. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/attlistdecl.rb +11 -0
  135. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/dtd.rb +47 -0
  136. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/elementdecl.rb +18 -0
  137. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/entitydecl.rb +57 -0
  138. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/notationdecl.rb +40 -0
  139. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/element.rb +2599 -0
  140. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/encoding.rb +51 -0
  141. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/entity.rb +171 -0
  142. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/default.rb +116 -0
  143. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/pretty.rb +142 -0
  144. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/transitive.rb +58 -0
  145. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/functions.rb +447 -0
  146. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/instruction.rb +79 -0
  147. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/light/node.rb +188 -0
  148. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/namespace.rb +59 -0
  149. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/node.rb +76 -0
  150. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/output.rb +30 -0
  151. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parent.rb +166 -0
  152. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parseexception.rb +52 -0
  153. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb +694 -0
  154. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/lightparser.rb +59 -0
  155. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/pullparser.rb +197 -0
  156. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/sax2parser.rb +273 -0
  157. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/streamparser.rb +61 -0
  158. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/treeparser.rb +101 -0
  159. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/ultralightparser.rb +57 -0
  160. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/xpathparser.rb +689 -0
  161. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/quickpath.rb +266 -0
  162. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/rexml.rb +37 -0
  163. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/sax2listener.rb +98 -0
  164. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/security.rb +28 -0
  165. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/source.rb +298 -0
  166. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/streamlistener.rb +93 -0
  167. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/text.rb +424 -0
  168. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/undefinednamespaceexception.rb +9 -0
  169. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/relaxng.rb +539 -0
  170. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/validation.rb +144 -0
  171. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/validationexception.rb +10 -0
  172. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xmldecl.rb +130 -0
  173. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xmltokens.rb +85 -0
  174. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xpath.rb +81 -0
  175. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xpath_parser.rb +974 -0
  176. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/CHANGELOG.md +1894 -0
  177. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/Gemfile +9 -0
  178. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/LICENSE +20 -0
  179. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/README.md +1176 -0
  180. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/Rakefile +38 -0
  181. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock.rb +59 -0
  182. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/api.rb +109 -0
  183. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/assertion_failure.rb +11 -0
  184. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/callback_registry.rb +35 -0
  185. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/config.rb +18 -0
  186. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/cucumber.rb +10 -0
  187. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/deprecation.rb +9 -0
  188. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/errors.rb +17 -0
  189. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/async_http_client_adapter.rb +216 -0
  190. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/curb_adapter.rb +351 -0
  191. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +231 -0
  192. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/excon_adapter.rb +165 -0
  193. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_lib_adapter.rb +7 -0
  194. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb +19 -0
  195. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/client.rb +17 -0
  196. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/request.rb +16 -0
  197. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/response.rb +64 -0
  198. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/streamer.rb +29 -0
  199. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/webmock.rb +68 -0
  200. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb_adapter.rb +37 -0
  201. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/httpclient_adapter.rb +259 -0
  202. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/manticore_adapter.rb +145 -0
  203. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/net_http.rb +385 -0
  204. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/net_http_response.rb +34 -0
  205. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/patron_adapter.rb +130 -0
  206. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +174 -0
  207. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/any_arg_matcher.rb +13 -0
  208. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_argument_matcher.rb +21 -0
  209. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_excluding_matcher.rb +15 -0
  210. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_including_matcher.rb +17 -0
  211. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/minitest.rb +41 -0
  212. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rack_response.rb +69 -0
  213. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_body_diff.rb +64 -0
  214. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_execution_verifier.rb +77 -0
  215. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_pattern.rb +405 -0
  216. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_registry.rb +35 -0
  217. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_signature.rb +54 -0
  218. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_signature_snippet.rb +61 -0
  219. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_stub.rb +100 -0
  220. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/response.rb +159 -0
  221. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/responses_sequence.rb +40 -0
  222. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec.rb +42 -0
  223. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers.rb +27 -0
  224. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers/request_pattern_matcher.rb +78 -0
  225. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers/webmock_matcher.rb +67 -0
  226. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/stub_registry.rb +82 -0
  227. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/stub_request_snippet.rb +38 -0
  228. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/test_unit.rb +20 -0
  229. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_counter.rb +39 -0
  230. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_keys_stringifier.rb +25 -0
  231. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_validator.rb +17 -0
  232. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/headers.rb +64 -0
  233. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/json.rb +67 -0
  234. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/query_mapper.rb +281 -0
  235. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/uri.rb +111 -0
  236. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/values_stringifier.rb +20 -0
  237. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/version_checker.rb +111 -0
  238. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/version.rb +3 -0
  239. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/webmock.rb +163 -0
  240. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/test_helper.rb +34 -0
  241. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/test_webmock.rb +9 -0
  242. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/webmock_spec.rb +60 -0
  243. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/async_http_client/async_http_client_spec.rb +375 -0
  244. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/async_http_client/async_http_client_spec_helper.rb +73 -0
  245. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/curb/curb_spec.rb +499 -0
  246. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/curb/curb_spec_helper.rb +147 -0
  247. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/em_http_request/em_http_request_spec.rb +462 -0
  248. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/em_http_request/em_http_request_spec_helper.rb +77 -0
  249. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/excon/excon_spec.rb +77 -0
  250. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/excon/excon_spec_helper.rb +52 -0
  251. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/http_rb/http_rb_spec.rb +93 -0
  252. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/http_rb/http_rb_spec_helper.rb +54 -0
  253. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/httpclient/httpclient_spec.rb +217 -0
  254. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/httpclient/httpclient_spec_helper.rb +57 -0
  255. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec.rb +107 -0
  256. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb +35 -0
  257. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_shared.rb +153 -0
  258. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_spec.rb +369 -0
  259. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_spec_helper.rb +64 -0
  260. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/real_net_http_spec.rb +20 -0
  261. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/patron/patron_spec.rb +125 -0
  262. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/patron/patron_spec_helper.rb +54 -0
  263. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +313 -0
  264. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/callbacks.rb +148 -0
  265. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/complex_cross_concern_behaviors.rb +36 -0
  266. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/enabling_and_disabling_webmock.rb +95 -0
  267. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/precedence_of_stubs.rb +15 -0
  268. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/request_expectations.rb +930 -0
  269. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/returning_declared_responses.rb +409 -0
  270. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/stubbing_requests.rb +678 -0
  271. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +135 -0
  272. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +60 -0
  273. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/webmock_shared.rb +41 -0
  274. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/fixtures/test.txt +1 -0
  275. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/quality_spec.rb +84 -0
  276. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/spec_helper.rb +48 -0
  277. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/example_curl_output.txt +22 -0
  278. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/failures.rb +9 -0
  279. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/my_rack_app.rb +53 -0
  280. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/network_connection.rb +19 -0
  281. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/webmock_server.rb +70 -0
  282. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/api_spec.rb +175 -0
  283. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/errors_spec.rb +129 -0
  284. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb +17 -0
  285. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/http_lib_adapters/http_lib_adapter_spec.rb +12 -0
  286. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/matchers/hash_excluding_matcher_spec.rb +61 -0
  287. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/matchers/hash_including_matcher_spec.rb +87 -0
  288. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/rack_response_spec.rb +112 -0
  289. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_body_diff_spec.rb +90 -0
  290. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_execution_verifier_spec.rb +208 -0
  291. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_pattern_spec.rb +736 -0
  292. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_registry_spec.rb +95 -0
  293. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_signature_snippet_spec.rb +89 -0
  294. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_signature_spec.rb +155 -0
  295. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_stub_spec.rb +199 -0
  296. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/response_spec.rb +286 -0
  297. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/stub_registry_spec.rb +103 -0
  298. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/stub_request_snippet_spec.rb +115 -0
  299. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/hash_counter_spec.rb +39 -0
  300. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/hash_keys_stringifier_spec.rb +27 -0
  301. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/headers_spec.rb +28 -0
  302. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/json_spec.rb +33 -0
  303. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/query_mapper_spec.rb +157 -0
  304. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/uri_spec.rb +371 -0
  305. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/version_checker_spec.rb +65 -0
  306. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb +60 -0
  307. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/http_request.rb +24 -0
  308. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/shared_test.rb +108 -0
  309. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/test_helper.rb +23 -0
  310. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/test_webmock.rb +12 -0
  311. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/webmock.gemspec +54 -0
  312. data/vendor/bundle/jruby/2.5.0/specifications/addressable-2.7.0.gemspec +39 -0
  313. data/vendor/bundle/jruby/2.5.0/specifications/crack-0.4.5.gemspec +32 -0
  314. data/vendor/bundle/jruby/2.5.0/specifications/hashdiff-1.0.1.gemspec +46 -0
  315. data/vendor/bundle/jruby/2.5.0/specifications/public_suffix-4.0.6.gemspec +24 -0
  316. data/vendor/bundle/jruby/2.5.0/specifications/rexml-3.2.5.gemspec +42 -0
  317. data/vendor/bundle/jruby/2.5.0/specifications/webmock-3.13.0.gemspec +85 -0
  318. metadata +311 -4
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: false
2
+ module REXML
3
+ class ParseException < RuntimeError
4
+ attr_accessor :source, :parser, :continued_exception
5
+
6
+ def initialize( message, source=nil, parser=nil, exception=nil )
7
+ super(message)
8
+ @source = source
9
+ @parser = parser
10
+ @continued_exception = exception
11
+ end
12
+
13
+ def to_s
14
+ # Quote the original exception, if there was one
15
+ if @continued_exception
16
+ err = @continued_exception.inspect
17
+ err << "\n"
18
+ err << @continued_exception.backtrace.join("\n")
19
+ err << "\n...\n"
20
+ else
21
+ err = ""
22
+ end
23
+
24
+ # Get the stack trace and error message
25
+ err << super
26
+
27
+ # Add contextual information
28
+ if @source
29
+ err << "\nLine: #{line}\n"
30
+ err << "Position: #{position}\n"
31
+ err << "Last 80 unconsumed characters:\n"
32
+ err << @source.buffer[0..80].force_encoding("ASCII-8BIT").gsub(/\n/, ' ')
33
+ end
34
+
35
+ err
36
+ end
37
+
38
+ def position
39
+ @source.current_line[0] if @source and defined? @source.current_line and
40
+ @source.current_line
41
+ end
42
+
43
+ def line
44
+ @source.current_line[2] if @source and defined? @source.current_line and
45
+ @source.current_line
46
+ end
47
+
48
+ def context
49
+ @source.current_line
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,694 @@
1
+ # frozen_string_literal: false
2
+ require_relative '../parseexception'
3
+ require_relative '../undefinednamespaceexception'
4
+ require_relative '../source'
5
+ require 'set'
6
+ require "strscan"
7
+
8
+ module REXML
9
+ module Parsers
10
+ # = Using the Pull Parser
11
+ # <em>This API is experimental, and subject to change.</em>
12
+ # parser = PullParser.new( "<a>text<b att='val'/>txet</a>" )
13
+ # while parser.has_next?
14
+ # res = parser.next
15
+ # puts res[1]['att'] if res.start_tag? and res[0] == 'b'
16
+ # end
17
+ # See the PullEvent class for information on the content of the results.
18
+ # The data is identical to the arguments passed for the various events to
19
+ # the StreamListener API.
20
+ #
21
+ # Notice that:
22
+ # parser = PullParser.new( "<a>BAD DOCUMENT" )
23
+ # while parser.has_next?
24
+ # res = parser.next
25
+ # raise res[1] if res.error?
26
+ # end
27
+ #
28
+ # Nat Price gave me some good ideas for the API.
29
+ class BaseParser
30
+ LETTER = '[:alpha:]'
31
+ DIGIT = '[:digit:]'
32
+
33
+ COMBININGCHAR = '' # TODO
34
+ EXTENDER = '' # TODO
35
+
36
+ NCNAME_STR= "[#{LETTER}_][-[:alnum:]._#{COMBININGCHAR}#{EXTENDER}]*"
37
+ QNAME_STR= "(?:(#{NCNAME_STR}):)?(#{NCNAME_STR})"
38
+ QNAME = /(#{QNAME_STR})/
39
+
40
+ # Just for backward compatibility. For example, kramdown uses this.
41
+ # It's not used in REXML.
42
+ UNAME_STR= "(?:#{NCNAME_STR}:)?#{NCNAME_STR}"
43
+
44
+ NAMECHAR = '[\-\w\.:]'
45
+ NAME = "([\\w:]#{NAMECHAR}*)"
46
+ NMTOKEN = "(?:#{NAMECHAR})+"
47
+ NMTOKENS = "#{NMTOKEN}(\\s+#{NMTOKEN})*"
48
+ REFERENCE = "&(?:#{NAME};|#\\d+;|#x[0-9a-fA-F]+;)"
49
+ REFERENCE_RE = /#{REFERENCE}/
50
+
51
+ DOCTYPE_START = /\A\s*<!DOCTYPE\s/um
52
+ DOCTYPE_END = /\A\s*\]\s*>/um
53
+ ATTRIBUTE_PATTERN = /\s*(#{QNAME_STR})\s*=\s*(["'])(.*?)\4/um
54
+ COMMENT_START = /\A<!--/u
55
+ COMMENT_PATTERN = /<!--(.*?)-->/um
56
+ CDATA_START = /\A<!\[CDATA\[/u
57
+ CDATA_END = /\A\s*\]\s*>/um
58
+ CDATA_PATTERN = /<!\[CDATA\[(.*?)\]\]>/um
59
+ XMLDECL_START = /\A<\?xml\s/u;
60
+ XMLDECL_PATTERN = /<\?xml\s+(.*?)\?>/um
61
+ INSTRUCTION_START = /\A<\?/u
62
+ INSTRUCTION_PATTERN = /<\?#{NAME}(\s+.*?)?\?>/um
63
+ TAG_MATCH = /\A<((?>#{QNAME_STR}))/um
64
+ CLOSE_MATCH = /\A\s*<\/(#{QNAME_STR})\s*>/um
65
+
66
+ VERSION = /\bversion\s*=\s*["'](.*?)['"]/um
67
+ ENCODING = /\bencoding\s*=\s*["'](.*?)['"]/um
68
+ STANDALONE = /\bstandalone\s*=\s*["'](.*?)['"]/um
69
+
70
+ ENTITY_START = /\A\s*<!ENTITY/
71
+ ELEMENTDECL_START = /\A\s*<!ELEMENT/um
72
+ ELEMENTDECL_PATTERN = /\A\s*(<!ELEMENT.*?)>/um
73
+ SYSTEMENTITY = /\A\s*(%.*?;)\s*$/um
74
+ ENUMERATION = "\\(\\s*#{NMTOKEN}(?:\\s*\\|\\s*#{NMTOKEN})*\\s*\\)"
75
+ NOTATIONTYPE = "NOTATION\\s+\\(\\s*#{NAME}(?:\\s*\\|\\s*#{NAME})*\\s*\\)"
76
+ ENUMERATEDTYPE = "(?:(?:#{NOTATIONTYPE})|(?:#{ENUMERATION}))"
77
+ ATTTYPE = "(CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS|#{ENUMERATEDTYPE})"
78
+ ATTVALUE = "(?:\"((?:[^<&\"]|#{REFERENCE})*)\")|(?:'((?:[^<&']|#{REFERENCE})*)')"
79
+ DEFAULTDECL = "(#REQUIRED|#IMPLIED|(?:(#FIXED\\s+)?#{ATTVALUE}))"
80
+ ATTDEF = "\\s+#{NAME}\\s+#{ATTTYPE}\\s+#{DEFAULTDECL}"
81
+ ATTDEF_RE = /#{ATTDEF}/
82
+ ATTLISTDECL_START = /\A\s*<!ATTLIST/um
83
+ ATTLISTDECL_PATTERN = /\A\s*<!ATTLIST\s+#{NAME}(?:#{ATTDEF})*\s*>/um
84
+
85
+ TEXT_PATTERN = /\A([^<]*)/um
86
+
87
+ # Entity constants
88
+ PUBIDCHAR = "\x20\x0D\x0Aa-zA-Z0-9\\-()+,./:=?;!*@$_%#"
89
+ SYSTEMLITERAL = %Q{((?:"[^"]*")|(?:'[^']*'))}
90
+ PUBIDLITERAL = %Q{("[#{PUBIDCHAR}']*"|'[#{PUBIDCHAR}]*')}
91
+ EXTERNALID = "(?:(?:(SYSTEM)\\s+#{SYSTEMLITERAL})|(?:(PUBLIC)\\s+#{PUBIDLITERAL}\\s+#{SYSTEMLITERAL}))"
92
+ NDATADECL = "\\s+NDATA\\s+#{NAME}"
93
+ PEREFERENCE = "%#{NAME};"
94
+ ENTITYVALUE = %Q{((?:"(?:[^%&"]|#{PEREFERENCE}|#{REFERENCE})*")|(?:'([^%&']|#{PEREFERENCE}|#{REFERENCE})*'))}
95
+ PEDEF = "(?:#{ENTITYVALUE}|#{EXTERNALID})"
96
+ ENTITYDEF = "(?:#{ENTITYVALUE}|(?:#{EXTERNALID}(#{NDATADECL})?))"
97
+ PEDECL = "<!ENTITY\\s+(%)\\s+#{NAME}\\s+#{PEDEF}\\s*>"
98
+ GEDECL = "<!ENTITY\\s+#{NAME}\\s+#{ENTITYDEF}\\s*>"
99
+ ENTITYDECL = /\s*(?:#{GEDECL})|(?:#{PEDECL})/um
100
+
101
+ NOTATIONDECL_START = /\A\s*<!NOTATION/um
102
+ EXTERNAL_ID_PUBLIC = /\A\s*PUBLIC\s+#{PUBIDLITERAL}\s+#{SYSTEMLITERAL}\s*/um
103
+ EXTERNAL_ID_SYSTEM = /\A\s*SYSTEM\s+#{SYSTEMLITERAL}\s*/um
104
+ PUBLIC_ID = /\A\s*PUBLIC\s+#{PUBIDLITERAL}\s*/um
105
+
106
+ EREFERENCE = /&(?!#{NAME};)/
107
+
108
+ DEFAULT_ENTITIES = {
109
+ 'gt' => [/&gt;/, '&gt;', '>', />/],
110
+ 'lt' => [/&lt;/, '&lt;', '<', /</],
111
+ 'quot' => [/&quot;/, '&quot;', '"', /"/],
112
+ "apos" => [/&apos;/, "&apos;", "'", /'/]
113
+ }
114
+
115
+ def initialize( source )
116
+ self.stream = source
117
+ @listeners = []
118
+ end
119
+
120
+ def add_listener( listener )
121
+ @listeners << listener
122
+ end
123
+
124
+ attr_reader :source
125
+
126
+ def stream=( source )
127
+ @source = SourceFactory.create_from( source )
128
+ @closed = nil
129
+ @document_status = nil
130
+ @tags = []
131
+ @stack = []
132
+ @entities = []
133
+ @nsstack = []
134
+ end
135
+
136
+ def position
137
+ if @source.respond_to? :position
138
+ @source.position
139
+ else
140
+ # FIXME
141
+ 0
142
+ end
143
+ end
144
+
145
+ # Returns true if there are no more events
146
+ def empty?
147
+ return (@source.empty? and @stack.empty?)
148
+ end
149
+
150
+ # Returns true if there are more events. Synonymous with !empty?
151
+ def has_next?
152
+ return !(@source.empty? and @stack.empty?)
153
+ end
154
+
155
+ # Push an event back on the head of the stream. This method
156
+ # has (theoretically) infinite depth.
157
+ def unshift token
158
+ @stack.unshift(token)
159
+ end
160
+
161
+ # Peek at the +depth+ event in the stack. The first element on the stack
162
+ # is at depth 0. If +depth+ is -1, will parse to the end of the input
163
+ # stream and return the last event, which is always :end_document.
164
+ # Be aware that this causes the stream to be parsed up to the +depth+
165
+ # event, so you can effectively pre-parse the entire document (pull the
166
+ # entire thing into memory) using this method.
167
+ def peek depth=0
168
+ raise %Q[Illegal argument "#{depth}"] if depth < -1
169
+ temp = []
170
+ if depth == -1
171
+ temp.push(pull()) until empty?
172
+ else
173
+ while @stack.size+temp.size < depth+1
174
+ temp.push(pull())
175
+ end
176
+ end
177
+ @stack += temp if temp.size > 0
178
+ @stack[depth]
179
+ end
180
+
181
+ # Returns the next event. This is a +PullEvent+ object.
182
+ def pull
183
+ pull_event.tap do |event|
184
+ @listeners.each do |listener|
185
+ listener.receive event
186
+ end
187
+ end
188
+ end
189
+
190
+ def pull_event
191
+ if @closed
192
+ x, @closed = @closed, nil
193
+ return [ :end_element, x ]
194
+ end
195
+ return [ :end_document ] if empty?
196
+ return @stack.shift if @stack.size > 0
197
+ #STDERR.puts @source.encoding
198
+ #STDERR.puts "BUFFER = #{@source.buffer.inspect}"
199
+ if @document_status == nil
200
+ word = @source.match( /\A((?:\s+)|(?:<[^>]*>))/um )
201
+ word = word[1] unless word.nil?
202
+ #STDERR.puts "WORD = #{word.inspect}"
203
+ case word
204
+ when COMMENT_START
205
+ return [ :comment, @source.match( COMMENT_PATTERN, true )[1] ]
206
+ when XMLDECL_START
207
+ #STDERR.puts "XMLDECL"
208
+ results = @source.match( XMLDECL_PATTERN, true )[1]
209
+ version = VERSION.match( results )
210
+ version = version[1] unless version.nil?
211
+ encoding = ENCODING.match(results)
212
+ encoding = encoding[1] unless encoding.nil?
213
+ if need_source_encoding_update?(encoding)
214
+ @source.encoding = encoding
215
+ end
216
+ if encoding.nil? and /\AUTF-16(?:BE|LE)\z/i =~ @source.encoding
217
+ encoding = "UTF-16"
218
+ end
219
+ standalone = STANDALONE.match(results)
220
+ standalone = standalone[1] unless standalone.nil?
221
+ return [ :xmldecl, version, encoding, standalone ]
222
+ when INSTRUCTION_START
223
+ return process_instruction
224
+ when DOCTYPE_START
225
+ base_error_message = "Malformed DOCTYPE"
226
+ @source.match(DOCTYPE_START, true)
227
+ @nsstack.unshift(curr_ns=Set.new)
228
+ name = parse_name(base_error_message)
229
+ if @source.match(/\A\s*\[/um, true)
230
+ id = [nil, nil, nil]
231
+ @document_status = :in_doctype
232
+ elsif @source.match(/\A\s*>/um, true)
233
+ id = [nil, nil, nil]
234
+ @document_status = :after_doctype
235
+ else
236
+ id = parse_id(base_error_message,
237
+ accept_external_id: true,
238
+ accept_public_id: false)
239
+ if id[0] == "SYSTEM"
240
+ # For backward compatibility
241
+ id[1], id[2] = id[2], nil
242
+ end
243
+ if @source.match(/\A\s*\[/um, true)
244
+ @document_status = :in_doctype
245
+ elsif @source.match(/\A\s*>/um, true)
246
+ @document_status = :after_doctype
247
+ else
248
+ message = "#{base_error_message}: garbage after external ID"
249
+ raise REXML::ParseException.new(message, @source)
250
+ end
251
+ end
252
+ args = [:start_doctype, name, *id]
253
+ if @document_status == :after_doctype
254
+ @source.match(/\A\s*/um, true)
255
+ @stack << [ :end_doctype ]
256
+ end
257
+ return args
258
+ when /\A\s+/
259
+ else
260
+ @document_status = :after_doctype
261
+ if @source.encoding == "UTF-8"
262
+ @source.buffer.force_encoding(::Encoding::UTF_8)
263
+ end
264
+ end
265
+ end
266
+ if @document_status == :in_doctype
267
+ md = @source.match(/\A\s*(.*?>)/um)
268
+ case md[1]
269
+ when SYSTEMENTITY
270
+ match = @source.match( SYSTEMENTITY, true )[1]
271
+ return [ :externalentity, match ]
272
+
273
+ when ELEMENTDECL_START
274
+ return [ :elementdecl, @source.match( ELEMENTDECL_PATTERN, true )[1] ]
275
+
276
+ when ENTITY_START
277
+ match = @source.match( ENTITYDECL, true ).to_a.compact
278
+ match[0] = :entitydecl
279
+ ref = false
280
+ if match[1] == '%'
281
+ ref = true
282
+ match.delete_at 1
283
+ end
284
+ # Now we have to sort out what kind of entity reference this is
285
+ if match[2] == 'SYSTEM'
286
+ # External reference
287
+ match[3] = match[3][1..-2] # PUBID
288
+ match.delete_at(4) if match.size > 4 # Chop out NDATA decl
289
+ # match is [ :entity, name, SYSTEM, pubid(, ndata)? ]
290
+ elsif match[2] == 'PUBLIC'
291
+ # External reference
292
+ match[3] = match[3][1..-2] # PUBID
293
+ match[4] = match[4][1..-2] # HREF
294
+ match.delete_at(5) if match.size > 5 # Chop out NDATA decl
295
+ # match is [ :entity, name, PUBLIC, pubid, href(, ndata)? ]
296
+ else
297
+ match[2] = match[2][1..-2]
298
+ match.pop if match.size == 4
299
+ # match is [ :entity, name, value ]
300
+ end
301
+ match << '%' if ref
302
+ return match
303
+ when ATTLISTDECL_START
304
+ md = @source.match( ATTLISTDECL_PATTERN, true )
305
+ raise REXML::ParseException.new( "Bad ATTLIST declaration!", @source ) if md.nil?
306
+ element = md[1]
307
+ contents = md[0]
308
+
309
+ pairs = {}
310
+ values = md[0].scan( ATTDEF_RE )
311
+ values.each do |attdef|
312
+ unless attdef[3] == "#IMPLIED"
313
+ attdef.compact!
314
+ val = attdef[3]
315
+ val = attdef[4] if val == "#FIXED "
316
+ pairs[attdef[0]] = val
317
+ if attdef[0] =~ /^xmlns:(.*)/
318
+ @nsstack[0] << $1
319
+ end
320
+ end
321
+ end
322
+ return [ :attlistdecl, element, pairs, contents ]
323
+ when NOTATIONDECL_START
324
+ base_error_message = "Malformed notation declaration"
325
+ unless @source.match(/\A\s*<!NOTATION\s+/um, true)
326
+ if @source.match(/\A\s*<!NOTATION\s*>/um)
327
+ message = "#{base_error_message}: name is missing"
328
+ else
329
+ message = "#{base_error_message}: invalid declaration name"
330
+ end
331
+ raise REXML::ParseException.new(message, @source)
332
+ end
333
+ name = parse_name(base_error_message)
334
+ id = parse_id(base_error_message,
335
+ accept_external_id: true,
336
+ accept_public_id: true)
337
+ unless @source.match(/\A\s*>/um, true)
338
+ message = "#{base_error_message}: garbage before end >"
339
+ raise REXML::ParseException.new(message, @source)
340
+ end
341
+ return [:notationdecl, name, *id]
342
+ when DOCTYPE_END
343
+ @document_status = :after_doctype
344
+ @source.match( DOCTYPE_END, true )
345
+ return [ :end_doctype ]
346
+ end
347
+ end
348
+ if @document_status == :after_doctype
349
+ @source.match(/\A\s*/um, true)
350
+ end
351
+ begin
352
+ @source.read if @source.buffer.size<2
353
+ if @source.buffer[0] == ?<
354
+ if @source.buffer[1] == ?/
355
+ @nsstack.shift
356
+ last_tag = @tags.pop
357
+ md = @source.match( CLOSE_MATCH, true )
358
+ if md and !last_tag
359
+ message = "Unexpected top-level end tag (got '#{md[1]}')"
360
+ raise REXML::ParseException.new(message, @source)
361
+ end
362
+ if md.nil? or last_tag != md[1]
363
+ message = "Missing end tag for '#{last_tag}'"
364
+ message << " (got '#{md[1]}')" if md
365
+ raise REXML::ParseException.new(message, @source)
366
+ end
367
+ return [ :end_element, last_tag ]
368
+ elsif @source.buffer[1] == ?!
369
+ md = @source.match(/\A(\s*[^>]*>)/um)
370
+ #STDERR.puts "SOURCE BUFFER = #{source.buffer}, #{source.buffer.size}"
371
+ raise REXML::ParseException.new("Malformed node", @source) unless md
372
+ if md[0][2] == ?-
373
+ md = @source.match( COMMENT_PATTERN, true )
374
+
375
+ case md[1]
376
+ when /--/, /-\z/
377
+ raise REXML::ParseException.new("Malformed comment", @source)
378
+ end
379
+
380
+ return [ :comment, md[1] ] if md
381
+ else
382
+ md = @source.match( CDATA_PATTERN, true )
383
+ return [ :cdata, md[1] ] if md
384
+ end
385
+ raise REXML::ParseException.new( "Declarations can only occur "+
386
+ "in the doctype declaration.", @source)
387
+ elsif @source.buffer[1] == ??
388
+ return process_instruction
389
+ else
390
+ # Get the next tag
391
+ md = @source.match(TAG_MATCH, true)
392
+ unless md
393
+ raise REXML::ParseException.new("malformed XML: missing tag start", @source)
394
+ end
395
+ @document_status = :in_element
396
+ prefixes = Set.new
397
+ prefixes << md[2] if md[2]
398
+ @nsstack.unshift(curr_ns=Set.new)
399
+ attributes, closed = parse_attributes(prefixes, curr_ns)
400
+ # Verify that all of the prefixes have been defined
401
+ for prefix in prefixes
402
+ unless @nsstack.find{|k| k.member?(prefix)}
403
+ raise UndefinedNamespaceException.new(prefix,@source,self)
404
+ end
405
+ end
406
+
407
+ if closed
408
+ @closed = md[1]
409
+ @nsstack.shift
410
+ else
411
+ @tags.push( md[1] )
412
+ end
413
+ return [ :start_element, md[1], attributes ]
414
+ end
415
+ else
416
+ md = @source.match( TEXT_PATTERN, true )
417
+ if md[0].length == 0
418
+ @source.match( /(\s+)/, true )
419
+ end
420
+ #STDERR.puts "GOT #{md[1].inspect}" unless md[0].length == 0
421
+ #return [ :text, "" ] if md[0].length == 0
422
+ # unnormalized = Text::unnormalize( md[1], self )
423
+ # return PullEvent.new( :text, md[1], unnormalized )
424
+ return [ :text, md[1] ]
425
+ end
426
+ rescue REXML::UndefinedNamespaceException
427
+ raise
428
+ rescue REXML::ParseException
429
+ raise
430
+ rescue => error
431
+ raise REXML::ParseException.new( "Exception parsing",
432
+ @source, self, (error ? error : $!) )
433
+ end
434
+ return [ :dummy ]
435
+ end
436
+ private :pull_event
437
+
438
+ def entity( reference, entities )
439
+ value = nil
440
+ value = entities[ reference ] if entities
441
+ if not value
442
+ value = DEFAULT_ENTITIES[ reference ]
443
+ value = value[2] if value
444
+ end
445
+ unnormalize( value, entities ) if value
446
+ end
447
+
448
+ # Escapes all possible entities
449
+ def normalize( input, entities=nil, entity_filter=nil )
450
+ copy = input.clone
451
+ # Doing it like this rather than in a loop improves the speed
452
+ copy.gsub!( EREFERENCE, '&amp;' )
453
+ entities.each do |key, value|
454
+ copy.gsub!( value, "&#{key};" ) unless entity_filter and
455
+ entity_filter.include?(entity)
456
+ end if entities
457
+ copy.gsub!( EREFERENCE, '&amp;' )
458
+ DEFAULT_ENTITIES.each do |key, value|
459
+ copy.gsub!( value[3], value[1] )
460
+ end
461
+ copy
462
+ end
463
+
464
+ # Unescapes all possible entities
465
+ def unnormalize( string, entities=nil, filter=nil )
466
+ rv = string.clone
467
+ rv.gsub!( /\r\n?/, "\n" )
468
+ matches = rv.scan( REFERENCE_RE )
469
+ return rv if matches.size == 0
470
+ rv.gsub!( /&#0*((?:\d+)|(?:x[a-fA-F0-9]+));/ ) {
471
+ m=$1
472
+ m = "0#{m}" if m[0] == ?x
473
+ [Integer(m)].pack('U*')
474
+ }
475
+ matches.collect!{|x|x[0]}.compact!
476
+ if matches.size > 0
477
+ matches.each do |entity_reference|
478
+ unless filter and filter.include?(entity_reference)
479
+ entity_value = entity( entity_reference, entities )
480
+ if entity_value
481
+ re = /&#{entity_reference};/
482
+ rv.gsub!( re, entity_value )
483
+ else
484
+ er = DEFAULT_ENTITIES[entity_reference]
485
+ rv.gsub!( er[0], er[2] ) if er
486
+ end
487
+ end
488
+ end
489
+ rv.gsub!( /&amp;/, '&' )
490
+ end
491
+ rv
492
+ end
493
+
494
+ private
495
+ def need_source_encoding_update?(xml_declaration_encoding)
496
+ return false if xml_declaration_encoding.nil?
497
+ return false if /\AUTF-16\z/i =~ xml_declaration_encoding
498
+ true
499
+ end
500
+
501
+ def parse_name(base_error_message)
502
+ md = @source.match(/\A\s*#{NAME}/um, true)
503
+ unless md
504
+ if @source.match(/\A\s*\S/um)
505
+ message = "#{base_error_message}: invalid name"
506
+ else
507
+ message = "#{base_error_message}: name is missing"
508
+ end
509
+ raise REXML::ParseException.new(message, @source)
510
+ end
511
+ md[1]
512
+ end
513
+
514
+ def parse_id(base_error_message,
515
+ accept_external_id:,
516
+ accept_public_id:)
517
+ if accept_external_id and (md = @source.match(EXTERNAL_ID_PUBLIC, true))
518
+ pubid = system = nil
519
+ pubid_literal = md[1]
520
+ pubid = pubid_literal[1..-2] if pubid_literal # Remove quote
521
+ system_literal = md[2]
522
+ system = system_literal[1..-2] if system_literal # Remove quote
523
+ ["PUBLIC", pubid, system]
524
+ elsif accept_public_id and (md = @source.match(PUBLIC_ID, true))
525
+ pubid = system = nil
526
+ pubid_literal = md[1]
527
+ pubid = pubid_literal[1..-2] if pubid_literal # Remove quote
528
+ ["PUBLIC", pubid, nil]
529
+ elsif accept_external_id and (md = @source.match(EXTERNAL_ID_SYSTEM, true))
530
+ system = nil
531
+ system_literal = md[1]
532
+ system = system_literal[1..-2] if system_literal # Remove quote
533
+ ["SYSTEM", nil, system]
534
+ else
535
+ details = parse_id_invalid_details(accept_external_id: accept_external_id,
536
+ accept_public_id: accept_public_id)
537
+ message = "#{base_error_message}: #{details}"
538
+ raise REXML::ParseException.new(message, @source)
539
+ end
540
+ end
541
+
542
+ def parse_id_invalid_details(accept_external_id:,
543
+ accept_public_id:)
544
+ public = /\A\s*PUBLIC/um
545
+ system = /\A\s*SYSTEM/um
546
+ if (accept_external_id or accept_public_id) and @source.match(/#{public}/um)
547
+ if @source.match(/#{public}(?:\s+[^'"]|\s*[\[>])/um)
548
+ return "public ID literal is missing"
549
+ end
550
+ unless @source.match(/#{public}\s+#{PUBIDLITERAL}/um)
551
+ return "invalid public ID literal"
552
+ end
553
+ if accept_public_id
554
+ if @source.match(/#{public}\s+#{PUBIDLITERAL}\s+[^'"]/um)
555
+ return "system ID literal is missing"
556
+ end
557
+ unless @source.match(/#{public}\s+#{PUBIDLITERAL}\s+#{SYSTEMLITERAL}/um)
558
+ return "invalid system literal"
559
+ end
560
+ "garbage after system literal"
561
+ else
562
+ "garbage after public ID literal"
563
+ end
564
+ elsif accept_external_id and @source.match(/#{system}/um)
565
+ if @source.match(/#{system}(?:\s+[^'"]|\s*[\[>])/um)
566
+ return "system literal is missing"
567
+ end
568
+ unless @source.match(/#{system}\s+#{SYSTEMLITERAL}/um)
569
+ return "invalid system literal"
570
+ end
571
+ "garbage after system literal"
572
+ else
573
+ unless @source.match(/\A\s*(?:PUBLIC|SYSTEM)\s/um)
574
+ return "invalid ID type"
575
+ end
576
+ "ID type is missing"
577
+ end
578
+ end
579
+
580
+ def process_instruction
581
+ match_data = @source.match(INSTRUCTION_PATTERN, true)
582
+ unless match_data
583
+ message = "Invalid processing instruction node"
584
+ raise REXML::ParseException.new(message, @source)
585
+ end
586
+ [:processing_instruction, match_data[1], match_data[2]]
587
+ end
588
+
589
+ def parse_attributes(prefixes, curr_ns)
590
+ attributes = {}
591
+ closed = false
592
+ match_data = @source.match(/^(.*?)(\/)?>/um, true)
593
+ if match_data.nil?
594
+ message = "Start tag isn't ended"
595
+ raise REXML::ParseException.new(message, @source)
596
+ end
597
+
598
+ raw_attributes = match_data[1]
599
+ closed = !match_data[2].nil?
600
+ return attributes, closed if raw_attributes.nil?
601
+ return attributes, closed if raw_attributes.empty?
602
+
603
+ scanner = StringScanner.new(raw_attributes)
604
+ until scanner.eos?
605
+ if scanner.scan(/\s+/)
606
+ break if scanner.eos?
607
+ end
608
+
609
+ pos = scanner.pos
610
+ loop do
611
+ break if scanner.scan(ATTRIBUTE_PATTERN)
612
+ unless scanner.scan(QNAME)
613
+ message = "Invalid attribute name: <#{scanner.rest}>"
614
+ raise REXML::ParseException.new(message, @source)
615
+ end
616
+ name = scanner[0]
617
+ unless scanner.scan(/\s*=\s*/um)
618
+ message = "Missing attribute equal: <#{name}>"
619
+ raise REXML::ParseException.new(message, @source)
620
+ end
621
+ quote = scanner.scan(/['"]/)
622
+ unless quote
623
+ message = "Missing attribute value start quote: <#{name}>"
624
+ raise REXML::ParseException.new(message, @source)
625
+ end
626
+ unless scanner.scan(/.*#{Regexp.escape(quote)}/um)
627
+ match_data = @source.match(/^(.*?)(\/)?>/um, true)
628
+ if match_data
629
+ scanner << "/" if closed
630
+ scanner << ">"
631
+ scanner << match_data[1]
632
+ scanner.pos = pos
633
+ closed = !match_data[2].nil?
634
+ next
635
+ end
636
+ message =
637
+ "Missing attribute value end quote: <#{name}>: <#{quote}>"
638
+ raise REXML::ParseException.new(message, @source)
639
+ end
640
+ end
641
+ name = scanner[1]
642
+ prefix = scanner[2]
643
+ local_part = scanner[3]
644
+ # quote = scanner[4]
645
+ value = scanner[5]
646
+ if prefix == "xmlns"
647
+ if local_part == "xml"
648
+ if value != "http://www.w3.org/XML/1998/namespace"
649
+ msg = "The 'xml' prefix must not be bound to any other namespace "+
650
+ "(http://www.w3.org/TR/REC-xml-names/#ns-decl)"
651
+ raise REXML::ParseException.new( msg, @source, self )
652
+ end
653
+ elsif local_part == "xmlns"
654
+ msg = "The 'xmlns' prefix must not be declared "+
655
+ "(http://www.w3.org/TR/REC-xml-names/#ns-decl)"
656
+ raise REXML::ParseException.new( msg, @source, self)
657
+ end
658
+ curr_ns << local_part
659
+ elsif prefix
660
+ prefixes << prefix unless prefix == "xml"
661
+ end
662
+
663
+ if attributes.has_key?(name)
664
+ msg = "Duplicate attribute #{name.inspect}"
665
+ raise REXML::ParseException.new(msg, @source, self)
666
+ end
667
+
668
+ attributes[name] = value
669
+ end
670
+ return attributes, closed
671
+ end
672
+ end
673
+ end
674
+ end
675
+
676
+ =begin
677
+ case event[0]
678
+ when :start_element
679
+ when :text
680
+ when :end_element
681
+ when :processing_instruction
682
+ when :cdata
683
+ when :comment
684
+ when :xmldecl
685
+ when :start_doctype
686
+ when :end_doctype
687
+ when :externalentity
688
+ when :elementdecl
689
+ when :entity
690
+ when :attlistdecl
691
+ when :notationdecl
692
+ when :end_doctype
693
+ end
694
+ =end