nokogiri 1.18.0.rc1-x86_64-linux-musl

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

Files changed (203) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +38 -0
  3. data/LICENSE-DEPENDENCIES.md +2224 -0
  4. data/LICENSE.md +9 -0
  5. data/README.md +293 -0
  6. data/bin/nokogiri +131 -0
  7. data/dependencies.yml +42 -0
  8. data/ext/nokogiri/depend +38 -0
  9. data/ext/nokogiri/extconf.rb +1173 -0
  10. data/ext/nokogiri/gumbo.c +610 -0
  11. data/ext/nokogiri/html4_document.c +171 -0
  12. data/ext/nokogiri/html4_element_description.c +299 -0
  13. data/ext/nokogiri/html4_entity_lookup.c +37 -0
  14. data/ext/nokogiri/html4_sax_parser.c +40 -0
  15. data/ext/nokogiri/html4_sax_parser_context.c +98 -0
  16. data/ext/nokogiri/html4_sax_push_parser.c +96 -0
  17. data/ext/nokogiri/include/libexslt/exslt.h +108 -0
  18. data/ext/nokogiri/include/libexslt/exsltconfig.h +70 -0
  19. data/ext/nokogiri/include/libexslt/exsltexports.h +63 -0
  20. data/ext/nokogiri/include/libxml2/libxml/HTMLparser.h +336 -0
  21. data/ext/nokogiri/include/libxml2/libxml/HTMLtree.h +147 -0
  22. data/ext/nokogiri/include/libxml2/libxml/SAX.h +202 -0
  23. data/ext/nokogiri/include/libxml2/libxml/SAX2.h +171 -0
  24. data/ext/nokogiri/include/libxml2/libxml/c14n.h +115 -0
  25. data/ext/nokogiri/include/libxml2/libxml/catalog.h +182 -0
  26. data/ext/nokogiri/include/libxml2/libxml/chvalid.h +230 -0
  27. data/ext/nokogiri/include/libxml2/libxml/debugXML.h +217 -0
  28. data/ext/nokogiri/include/libxml2/libxml/dict.h +82 -0
  29. data/ext/nokogiri/include/libxml2/libxml/encoding.h +244 -0
  30. data/ext/nokogiri/include/libxml2/libxml/entities.h +166 -0
  31. data/ext/nokogiri/include/libxml2/libxml/globals.h +41 -0
  32. data/ext/nokogiri/include/libxml2/libxml/hash.h +251 -0
  33. data/ext/nokogiri/include/libxml2/libxml/list.h +137 -0
  34. data/ext/nokogiri/include/libxml2/libxml/nanoftp.h +186 -0
  35. data/ext/nokogiri/include/libxml2/libxml/nanohttp.h +98 -0
  36. data/ext/nokogiri/include/libxml2/libxml/parser.h +1390 -0
  37. data/ext/nokogiri/include/libxml2/libxml/parserInternals.h +671 -0
  38. data/ext/nokogiri/include/libxml2/libxml/pattern.h +106 -0
  39. data/ext/nokogiri/include/libxml2/libxml/relaxng.h +219 -0
  40. data/ext/nokogiri/include/libxml2/libxml/schemasInternals.h +959 -0
  41. data/ext/nokogiri/include/libxml2/libxml/schematron.h +143 -0
  42. data/ext/nokogiri/include/libxml2/libxml/threads.h +87 -0
  43. data/ext/nokogiri/include/libxml2/libxml/tree.h +1382 -0
  44. data/ext/nokogiri/include/libxml2/libxml/uri.h +106 -0
  45. data/ext/nokogiri/include/libxml2/libxml/valid.h +477 -0
  46. data/ext/nokogiri/include/libxml2/libxml/xinclude.h +136 -0
  47. data/ext/nokogiri/include/libxml2/libxml/xlink.h +189 -0
  48. data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +438 -0
  49. data/ext/nokogiri/include/libxml2/libxml/xmlautomata.h +146 -0
  50. data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +962 -0
  51. data/ext/nokogiri/include/libxml2/libxml/xmlexports.h +146 -0
  52. data/ext/nokogiri/include/libxml2/libxml/xmlmemory.h +188 -0
  53. data/ext/nokogiri/include/libxml2/libxml/xmlmodule.h +57 -0
  54. data/ext/nokogiri/include/libxml2/libxml/xmlreader.h +436 -0
  55. data/ext/nokogiri/include/libxml2/libxml/xmlregexp.h +215 -0
  56. data/ext/nokogiri/include/libxml2/libxml/xmlsave.h +102 -0
  57. data/ext/nokogiri/include/libxml2/libxml/xmlschemas.h +249 -0
  58. data/ext/nokogiri/include/libxml2/libxml/xmlschemastypes.h +152 -0
  59. data/ext/nokogiri/include/libxml2/libxml/xmlstring.h +140 -0
  60. data/ext/nokogiri/include/libxml2/libxml/xmlunicode.h +366 -0
  61. data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +347 -0
  62. data/ext/nokogiri/include/libxml2/libxml/xmlwriter.h +489 -0
  63. data/ext/nokogiri/include/libxml2/libxml/xpath.h +579 -0
  64. data/ext/nokogiri/include/libxml2/libxml/xpathInternals.h +633 -0
  65. data/ext/nokogiri/include/libxml2/libxml/xpointer.h +138 -0
  66. data/ext/nokogiri/include/libxslt/attributes.h +39 -0
  67. data/ext/nokogiri/include/libxslt/documents.h +93 -0
  68. data/ext/nokogiri/include/libxslt/extensions.h +262 -0
  69. data/ext/nokogiri/include/libxslt/extra.h +72 -0
  70. data/ext/nokogiri/include/libxslt/functions.h +78 -0
  71. data/ext/nokogiri/include/libxslt/imports.h +75 -0
  72. data/ext/nokogiri/include/libxslt/keys.h +53 -0
  73. data/ext/nokogiri/include/libxslt/namespaces.h +68 -0
  74. data/ext/nokogiri/include/libxslt/numbersInternals.h +73 -0
  75. data/ext/nokogiri/include/libxslt/pattern.h +84 -0
  76. data/ext/nokogiri/include/libxslt/preproc.h +43 -0
  77. data/ext/nokogiri/include/libxslt/security.h +104 -0
  78. data/ext/nokogiri/include/libxslt/templates.h +77 -0
  79. data/ext/nokogiri/include/libxslt/transform.h +207 -0
  80. data/ext/nokogiri/include/libxslt/variables.h +118 -0
  81. data/ext/nokogiri/include/libxslt/xslt.h +110 -0
  82. data/ext/nokogiri/include/libxslt/xsltInternals.h +1995 -0
  83. data/ext/nokogiri/include/libxslt/xsltconfig.h +146 -0
  84. data/ext/nokogiri/include/libxslt/xsltexports.h +64 -0
  85. data/ext/nokogiri/include/libxslt/xsltlocale.h +44 -0
  86. data/ext/nokogiri/include/libxslt/xsltutils.h +343 -0
  87. data/ext/nokogiri/libxml2_polyfill.c +114 -0
  88. data/ext/nokogiri/nokogiri.c +294 -0
  89. data/ext/nokogiri/nokogiri.h +238 -0
  90. data/ext/nokogiri/test_global_handlers.c +40 -0
  91. data/ext/nokogiri/xml_attr.c +103 -0
  92. data/ext/nokogiri/xml_attribute_decl.c +70 -0
  93. data/ext/nokogiri/xml_cdata.c +62 -0
  94. data/ext/nokogiri/xml_comment.c +57 -0
  95. data/ext/nokogiri/xml_document.c +784 -0
  96. data/ext/nokogiri/xml_document_fragment.c +29 -0
  97. data/ext/nokogiri/xml_dtd.c +208 -0
  98. data/ext/nokogiri/xml_element_content.c +131 -0
  99. data/ext/nokogiri/xml_element_decl.c +69 -0
  100. data/ext/nokogiri/xml_encoding_handler.c +112 -0
  101. data/ext/nokogiri/xml_entity_decl.c +112 -0
  102. data/ext/nokogiri/xml_entity_reference.c +50 -0
  103. data/ext/nokogiri/xml_namespace.c +181 -0
  104. data/ext/nokogiri/xml_node.c +2459 -0
  105. data/ext/nokogiri/xml_node_set.c +518 -0
  106. data/ext/nokogiri/xml_processing_instruction.c +54 -0
  107. data/ext/nokogiri/xml_reader.c +777 -0
  108. data/ext/nokogiri/xml_relax_ng.c +149 -0
  109. data/ext/nokogiri/xml_sax_parser.c +403 -0
  110. data/ext/nokogiri/xml_sax_parser_context.c +390 -0
  111. data/ext/nokogiri/xml_sax_push_parser.c +206 -0
  112. data/ext/nokogiri/xml_schema.c +226 -0
  113. data/ext/nokogiri/xml_syntax_error.c +93 -0
  114. data/ext/nokogiri/xml_text.c +59 -0
  115. data/ext/nokogiri/xml_xpath_context.c +502 -0
  116. data/ext/nokogiri/xslt_stylesheet.c +421 -0
  117. data/gumbo-parser/CHANGES.md +63 -0
  118. data/gumbo-parser/Makefile +129 -0
  119. data/gumbo-parser/THANKS +27 -0
  120. data/lib/nokogiri/3.1/nokogiri.so +0 -0
  121. data/lib/nokogiri/3.2/nokogiri.so +0 -0
  122. data/lib/nokogiri/3.3/nokogiri.so +0 -0
  123. data/lib/nokogiri/3.4/nokogiri.so +0 -0
  124. data/lib/nokogiri/class_resolver.rb +67 -0
  125. data/lib/nokogiri/css/node.rb +58 -0
  126. data/lib/nokogiri/css/parser.rb +772 -0
  127. data/lib/nokogiri/css/parser.y +277 -0
  128. data/lib/nokogiri/css/parser_extras.rb +36 -0
  129. data/lib/nokogiri/css/selector_cache.rb +38 -0
  130. data/lib/nokogiri/css/syntax_error.rb +9 -0
  131. data/lib/nokogiri/css/tokenizer.rb +155 -0
  132. data/lib/nokogiri/css/tokenizer.rex +57 -0
  133. data/lib/nokogiri/css/xpath_visitor.rb +375 -0
  134. data/lib/nokogiri/css.rb +132 -0
  135. data/lib/nokogiri/decorators/slop.rb +42 -0
  136. data/lib/nokogiri/encoding_handler.rb +57 -0
  137. data/lib/nokogiri/extension.rb +32 -0
  138. data/lib/nokogiri/gumbo.rb +15 -0
  139. data/lib/nokogiri/html.rb +48 -0
  140. data/lib/nokogiri/html4/builder.rb +37 -0
  141. data/lib/nokogiri/html4/document.rb +235 -0
  142. data/lib/nokogiri/html4/document_fragment.rb +166 -0
  143. data/lib/nokogiri/html4/element_description.rb +25 -0
  144. data/lib/nokogiri/html4/element_description_defaults.rb +2040 -0
  145. data/lib/nokogiri/html4/encoding_reader.rb +121 -0
  146. data/lib/nokogiri/html4/entity_lookup.rb +15 -0
  147. data/lib/nokogiri/html4/sax/parser.rb +48 -0
  148. data/lib/nokogiri/html4/sax/parser_context.rb +15 -0
  149. data/lib/nokogiri/html4/sax/push_parser.rb +37 -0
  150. data/lib/nokogiri/html4.rb +42 -0
  151. data/lib/nokogiri/html5/builder.rb +40 -0
  152. data/lib/nokogiri/html5/document.rb +199 -0
  153. data/lib/nokogiri/html5/document_fragment.rb +200 -0
  154. data/lib/nokogiri/html5/node.rb +103 -0
  155. data/lib/nokogiri/html5.rb +368 -0
  156. data/lib/nokogiri/jruby/dependencies.rb +3 -0
  157. data/lib/nokogiri/jruby/nokogiri_jars.rb +43 -0
  158. data/lib/nokogiri/syntax_error.rb +6 -0
  159. data/lib/nokogiri/version/constant.rb +6 -0
  160. data/lib/nokogiri/version/info.rb +224 -0
  161. data/lib/nokogiri/version.rb +4 -0
  162. data/lib/nokogiri/xml/attr.rb +66 -0
  163. data/lib/nokogiri/xml/attribute_decl.rb +22 -0
  164. data/lib/nokogiri/xml/builder.rb +494 -0
  165. data/lib/nokogiri/xml/cdata.rb +13 -0
  166. data/lib/nokogiri/xml/character_data.rb +9 -0
  167. data/lib/nokogiri/xml/document.rb +514 -0
  168. data/lib/nokogiri/xml/document_fragment.rb +276 -0
  169. data/lib/nokogiri/xml/dtd.rb +34 -0
  170. data/lib/nokogiri/xml/element_content.rb +46 -0
  171. data/lib/nokogiri/xml/element_decl.rb +17 -0
  172. data/lib/nokogiri/xml/entity_decl.rb +23 -0
  173. data/lib/nokogiri/xml/entity_reference.rb +20 -0
  174. data/lib/nokogiri/xml/namespace.rb +57 -0
  175. data/lib/nokogiri/xml/node/save_options.rb +76 -0
  176. data/lib/nokogiri/xml/node.rb +1650 -0
  177. data/lib/nokogiri/xml/node_set.rb +449 -0
  178. data/lib/nokogiri/xml/notation.rb +19 -0
  179. data/lib/nokogiri/xml/parse_options.rb +213 -0
  180. data/lib/nokogiri/xml/pp/character_data.rb +21 -0
  181. data/lib/nokogiri/xml/pp/node.rb +73 -0
  182. data/lib/nokogiri/xml/pp.rb +4 -0
  183. data/lib/nokogiri/xml/processing_instruction.rb +11 -0
  184. data/lib/nokogiri/xml/reader.rb +139 -0
  185. data/lib/nokogiri/xml/relax_ng.rb +75 -0
  186. data/lib/nokogiri/xml/sax/document.rb +258 -0
  187. data/lib/nokogiri/xml/sax/parser.rb +199 -0
  188. data/lib/nokogiri/xml/sax/parser_context.rb +129 -0
  189. data/lib/nokogiri/xml/sax/push_parser.rb +64 -0
  190. data/lib/nokogiri/xml/sax.rb +54 -0
  191. data/lib/nokogiri/xml/schema.rb +140 -0
  192. data/lib/nokogiri/xml/searchable.rb +297 -0
  193. data/lib/nokogiri/xml/syntax_error.rb +94 -0
  194. data/lib/nokogiri/xml/text.rb +11 -0
  195. data/lib/nokogiri/xml/xpath/syntax_error.rb +13 -0
  196. data/lib/nokogiri/xml/xpath.rb +21 -0
  197. data/lib/nokogiri/xml/xpath_context.rb +49 -0
  198. data/lib/nokogiri/xml.rb +65 -0
  199. data/lib/nokogiri/xslt/stylesheet.rb +49 -0
  200. data/lib/nokogiri/xslt.rb +129 -0
  201. data/lib/nokogiri.rb +128 -0
  202. data/lib/xsd/xmlparser/nokogiri.rb +105 -0
  203. metadata +324 -0
@@ -0,0 +1,129 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ module Nokogiri
5
+ class << self
6
+ # Convenience method for Nokogiri::XSLT.parse
7
+ def XSLT(...)
8
+ XSLT.parse(...)
9
+ end
10
+ end
11
+
12
+ ###
13
+ # See Nokogiri::XSLT::Stylesheet for creating and manipulating
14
+ # Stylesheet object.
15
+ module XSLT
16
+ class << self
17
+ # :call-seq:
18
+ # parse(xsl) → Nokogiri::XSLT::Stylesheet
19
+ # parse(xsl, modules) → Nokogiri::XSLT::Stylesheet
20
+ #
21
+ # Parse the stylesheet in +xsl+, registering optional +modules+ as custom class handlers.
22
+ #
23
+ # [Parameters]
24
+ # - +xsl+ (String) XSL content to be parsed into a stylesheet
25
+ # - +modules+ (Hash<String ⇒ Class>) A hash of URI-to-handler relations for linking a
26
+ # namespace to a custom function handler.
27
+ #
28
+ # ⚠ The XSLT handler classes are registered *globally*.
29
+ #
30
+ # Also see Nokogiri::XSLT.register
31
+ #
32
+ # *Example*
33
+ #
34
+ # xml = Nokogiri.XML(<<~XML)
35
+ # <nodes>
36
+ # <node>Foo</node>
37
+ # <node>Bar</node>
38
+ # </nodes>
39
+ # XML
40
+ #
41
+ # handler = Class.new do
42
+ # def reverse(node)
43
+ # node.text.reverse
44
+ # end
45
+ # end
46
+ #
47
+ # xsl = <<~XSL
48
+ # <xsl:stylesheet version="1.0"
49
+ # xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
50
+ # xmlns:myfuncs="http://nokogiri.org/xslt/myfuncs"
51
+ # extension-element-prefixes="myfuncs">
52
+ # <xsl:template match="/">
53
+ # <reversed>
54
+ # <xsl:for-each select="nodes/node">
55
+ # <reverse><xsl:copy-of select="myfuncs:reverse(.)"/></reverse>
56
+ # </xsl:for-each>
57
+ # </reversed>
58
+ # </xsl:template>
59
+ # </xsl:stylesheet>
60
+ # XSL
61
+ #
62
+ # xsl = Nokogiri.XSLT(xsl, "http://nokogiri.org/xslt/myfuncs" => handler)
63
+ # xsl.transform(xml).to_xml
64
+ # # => "<?xml version=\"1.0\"?>\n" +
65
+ # # "<reversed>\n" +
66
+ # # " <reverse>ooF</reverse>\n" +
67
+ # # " <reverse>raB</reverse>\n" +
68
+ # # "</reversed>\n"
69
+ #
70
+ def parse(string, modules = {})
71
+ modules.each do |url, klass|
72
+ XSLT.register(url, klass)
73
+ end
74
+
75
+ doc = XML::Document.parse(string, nil, nil, XML::ParseOptions::DEFAULT_XSLT)
76
+ if Nokogiri.jruby?
77
+ Stylesheet.parse_stylesheet_doc(doc, string)
78
+ else
79
+ Stylesheet.parse_stylesheet_doc(doc)
80
+ end
81
+ end
82
+
83
+ # :call-seq:
84
+ # quote_params(params) → Array
85
+ #
86
+ # Quote parameters in +params+ for stylesheet safety.
87
+ # See Nokogiri::XSLT::Stylesheet.transform for example usage.
88
+ #
89
+ # [Parameters]
90
+ # - +params+ (Hash, Array) XSLT parameters (key->value, or tuples of [key, value])
91
+ #
92
+ # [Returns] Array of string parameters, with quotes correctly escaped for use with XSLT::Stylesheet.transform
93
+ #
94
+ def quote_params(params)
95
+ params.flatten.each_slice(2).with_object([]) do |kv, quoted_params|
96
+ key, value = kv.map(&:to_s)
97
+ value = if value.include?("'")
98
+ "concat('#{value.gsub("'", %q{', "'", '})}')"
99
+ else
100
+ "'#{value}'"
101
+ end
102
+ quoted_params << key
103
+ quoted_params << value
104
+ end
105
+ end
106
+
107
+ # call-seq:
108
+ # register(uri, custom_handler_class)
109
+ #
110
+ # Register a class that implements custom XSLT transformation functions.
111
+ #
112
+ # ⚠ The XSLT handler classes are registered *globally*.
113
+ #
114
+ # [Parameters}
115
+ # - +uri+ (String) The namespace for the custom handlers
116
+ # - +custom_handler_class+ (Class) A class with ruby methods that can be called during
117
+ # transformation
118
+ #
119
+ # See Nokogiri::XSLT.parse for usage.
120
+ #
121
+ def register(uri, custom_handler_class)
122
+ # NOTE: this is implemented in the C extension, see ext/nokogiri/xslt_stylesheet.c
123
+ raise NotImplementedError, "Nokogiri::XSLT.register is not implemented on JRuby"
124
+ end if Nokogiri.jruby?
125
+ end
126
+ end
127
+ end
128
+
129
+ require_relative "xslt/stylesheet"
data/lib/nokogiri.rb ADDED
@@ -0,0 +1,128 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
5
+ require_relative "nokogiri/jruby/dependencies"
6
+ end
7
+
8
+ require_relative "nokogiri/extension"
9
+
10
+ # Nokogiri parses and searches XML/HTML very quickly, and also has
11
+ # correctly implemented CSS3 selector support as well as XPath 1.0
12
+ # support.
13
+ #
14
+ # Parsing a document returns either a Nokogiri::XML::Document, or a
15
+ # Nokogiri::HTML4::Document depending on the kind of document you parse.
16
+ #
17
+ # Here is an example:
18
+ #
19
+ # require 'nokogiri'
20
+ # require 'open-uri'
21
+ #
22
+ # # Get a Nokogiri::HTML4::Document for the page we’re interested in...
23
+ #
24
+ # doc = Nokogiri::HTML4(URI.open('http://www.google.com/search?q=tenderlove'))
25
+ #
26
+ # # Do funky things with it using Nokogiri::XML::Node methods...
27
+ #
28
+ # ####
29
+ # # Search for nodes by css
30
+ # doc.css('h3.r a.l').each do |link|
31
+ # puts link.content
32
+ # end
33
+ #
34
+ # See also:
35
+ #
36
+ # - Nokogiri::XML::Searchable#css for more information about CSS searching
37
+ # - Nokogiri::XML::Searchable#xpath for more information about XPath searching
38
+ module Nokogiri
39
+ class << self
40
+ ###
41
+ # Parse an HTML or XML document. +string+ contains the document.
42
+ def parse(string, url = nil, encoding = nil, options = nil)
43
+ if string.respond_to?(:read) ||
44
+ /^\s*<(?:!DOCTYPE\s+)?html[\s>]/i.match?(string[0, 512])
45
+ # Expect an HTML indicator to appear within the first 512
46
+ # characters of a document. (<?xml ?> + <?xml-stylesheet ?>
47
+ # shouldn't be that long)
48
+ Nokogiri.HTML4(
49
+ string,
50
+ url,
51
+ encoding,
52
+ options || XML::ParseOptions::DEFAULT_HTML,
53
+ )
54
+ else
55
+ Nokogiri.XML(
56
+ string,
57
+ url,
58
+ encoding,
59
+ options || XML::ParseOptions::DEFAULT_XML,
60
+ )
61
+ end.tap do |doc|
62
+ yield doc if block_given?
63
+ end
64
+ end
65
+
66
+ ###
67
+ # Create a new Nokogiri::XML::DocumentFragment
68
+ def make(input = nil, opts = {}, &blk)
69
+ if input
70
+ Nokogiri::HTML4.fragment(input).children.first
71
+ else
72
+ Nokogiri(&blk)
73
+ end
74
+ end
75
+
76
+ ###
77
+ # Parse a document and add the Slop decorator. The Slop decorator
78
+ # implements method_missing such that methods may be used instead of CSS
79
+ # or XPath. For example:
80
+ #
81
+ # doc = Nokogiri::Slop(<<-eohtml)
82
+ # <html>
83
+ # <body>
84
+ # <p>first</p>
85
+ # <p>second</p>
86
+ # </body>
87
+ # </html>
88
+ # eohtml
89
+ # assert_equal('second', doc.html.body.p[1].text)
90
+ #
91
+ def Slop(*args, &block)
92
+ Nokogiri(*args, &block).slop!
93
+ end
94
+
95
+ # :nodoc:
96
+ def install_default_aliases
97
+ warn("Nokogiri.install_default_aliases is deprecated. Please call Nokogiri::EncodingHandler.install_default_aliases instead. This will become an error in Nokogiri v1.17.0.", uplevel: 1, category: :deprecated) # deprecated in v1.14.0, remove in v1.17.0
98
+ Nokogiri::EncodingHandler.install_default_aliases
99
+ end
100
+ end
101
+ end
102
+
103
+ ###
104
+ # Parse a document contained in +args+. Nokogiri will try to guess what type of document you are
105
+ # attempting to parse. For more information, see Nokogiri.parse
106
+ #
107
+ # To specify the type of document, use {Nokogiri.XML}, {Nokogiri.HTML4}, or {Nokogiri.HTML5}.
108
+ def Nokogiri(*args, &block)
109
+ if block
110
+ Nokogiri::HTML4::Builder.new(&block).doc.root
111
+ else
112
+ Nokogiri.parse(*args)
113
+ end
114
+ end
115
+
116
+ require_relative "nokogiri/version"
117
+ require_relative "nokogiri/class_resolver"
118
+ require_relative "nokogiri/syntax_error"
119
+ require_relative "nokogiri/xml"
120
+ require_relative "nokogiri/xslt"
121
+ require_relative "nokogiri/html4"
122
+ require_relative "nokogiri/html"
123
+ require_relative "nokogiri/decorators/slop"
124
+ require_relative "nokogiri/css"
125
+ require_relative "nokogiri/html4/builder"
126
+ require_relative "nokogiri/encoding_handler"
127
+
128
+ require_relative "nokogiri/html5" if Nokogiri.uses_gumbo?
@@ -0,0 +1,105 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "nokogiri"
4
+
5
+ module XSD
6
+ module XMLParser
7
+ ###
8
+ # Nokogiri XML parser for soap4r.
9
+ #
10
+ # Nokogiri may be used as the XML parser in soap4r. Require 'xsd/xmlparser/nokogiri' in your
11
+ # soap4r applications, and soap4r will use Nokogiri as its XML parser. No other changes should
12
+ # be required to use Nokogiri as the XML parser.
13
+ #
14
+ # Example (using UW ITS Web Services):
15
+ #
16
+ # require 'rubygems'
17
+ # require 'nokogiri'
18
+ # gem 'soap4r'
19
+ # require 'defaultDriver'
20
+ # require 'xsd/xmlparser/nokogiri'
21
+ #
22
+ # obj = AvlPortType.new
23
+ # obj.getLatestByRoute(obj.getAgencies.first, 8).each do |bus|
24
+ # p "#{bus.routeID}, #{bus.longitude}, #{bus.latitude}"
25
+ # end
26
+ #
27
+ class Nokogiri < XSD::XMLParser::Parser
28
+ ###
29
+ # Create a new XSD parser with +host+ and +opt+
30
+ def initialize(host, opt = {})
31
+ super
32
+ @parser = ::Nokogiri::XML::SAX::Parser.new(self, @charset || "UTF-8")
33
+ end
34
+
35
+ ###
36
+ # Start parsing +string_or_readable+
37
+ def do_parse(string_or_readable)
38
+ @parser.parse(string_or_readable)
39
+ end
40
+
41
+ ###
42
+ # Handle the start_element event with +name+ and +attrs+
43
+ def start_element(name, attrs = [])
44
+ super(name, Hash[*attrs.flatten])
45
+ end
46
+
47
+ ###
48
+ # Handle the end_element event with +name+
49
+ def end_element(name)
50
+ super
51
+ end
52
+
53
+ ###
54
+ # Handle errors with message +msg+
55
+ def error(msg)
56
+ raise ParseError, msg
57
+ end
58
+ alias_method :warning, :error
59
+
60
+ ###
61
+ # Handle cdata_blocks containing +string+
62
+ def cdata_block(string)
63
+ characters(string)
64
+ end
65
+
66
+ ###
67
+ # Called at the beginning of an element
68
+ # +name+ is the element name
69
+ # +attrs+ is a list of attributes
70
+ # +prefix+ is the namespace prefix for the element
71
+ # +uri+ is the associated namespace URI
72
+ # +ns+ is a hash of namespace prefix:urls associated with the element
73
+ def start_element_namespace(name, attrs = [], prefix = nil, uri = nil, ns = []) # rubocop:disable Metrics/ParameterLists
74
+ ###
75
+ # Deal with SAX v1 interface
76
+ name = [prefix, name].compact.join(":")
77
+ attributes = ns.map do |ns_prefix, ns_uri|
78
+ [["xmlns", ns_prefix].compact.join(":"), ns_uri]
79
+ end + attrs.map do |attr|
80
+ [[attr.prefix, attr.localname].compact.join(":"), attr.value]
81
+ end.flatten
82
+ start_element(name, attributes)
83
+ end
84
+
85
+ ###
86
+ # Called at the end of an element
87
+ # +name+ is the element's name
88
+ # +prefix+ is the namespace prefix associated with the element
89
+ # +uri+ is the associated namespace URI
90
+ def end_element_namespace(name, prefix = nil, uri = nil)
91
+ ###
92
+ # Deal with SAX v1 interface
93
+ end_element([prefix, name].compact.join(":"))
94
+ end
95
+
96
+ ["xmldecl", "start_document", "end_document", "comment"].each do |name|
97
+ class_eval <<~RUBY, __FILE__, __LINE__ + 1
98
+ def #{name}(*args); end
99
+ RUBY
100
+ end
101
+
102
+ add_factory(self)
103
+ end
104
+ end
105
+ end
metadata ADDED
@@ -0,0 +1,324 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nokogiri
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.18.0.rc1
5
+ platform: x86_64-linux-musl
6
+ authors:
7
+ - Mike Dalessio
8
+ - Aaron Patterson
9
+ - Yoko Harada
10
+ - Akinori MUSHA
11
+ - John Shahid
12
+ - Karol Bucek
13
+ - Sam Ruby
14
+ - Craig Barnes
15
+ - Stephen Checkoway
16
+ - Lars Kanis
17
+ - Sergio Arbeo
18
+ - Timothy Elliott
19
+ - Nobuyoshi Nakada
20
+ autorequire:
21
+ bindir: bin
22
+ cert_chain: []
23
+ date: 2024-12-16 00:00:00.000000000 Z
24
+ dependencies:
25
+ - !ruby/object:Gem::Dependency
26
+ name: racc
27
+ requirement: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - "~>"
30
+ - !ruby/object:Gem::Version
31
+ version: '1.4'
32
+ type: :runtime
33
+ prerelease: false
34
+ version_requirements: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - "~>"
37
+ - !ruby/object:Gem::Version
38
+ version: '1.4'
39
+ description: |
40
+ Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. It provides a
41
+ sensible, easy-to-understand API for reading, writing, modifying, and querying documents. It is
42
+ fast and standards-compliant by relying on native parsers like libxml2, libgumbo, or xerces.
43
+ email: nokogiri-talk@googlegroups.com
44
+ executables:
45
+ - nokogiri
46
+ extensions: []
47
+ extra_rdoc_files:
48
+ - ext/nokogiri/gumbo.c
49
+ - ext/nokogiri/html4_document.c
50
+ - ext/nokogiri/html4_element_description.c
51
+ - ext/nokogiri/html4_entity_lookup.c
52
+ - ext/nokogiri/html4_sax_parser.c
53
+ - ext/nokogiri/html4_sax_parser_context.c
54
+ - ext/nokogiri/html4_sax_push_parser.c
55
+ - ext/nokogiri/libxml2_polyfill.c
56
+ - ext/nokogiri/nokogiri.c
57
+ - ext/nokogiri/test_global_handlers.c
58
+ - ext/nokogiri/xml_attr.c
59
+ - ext/nokogiri/xml_attribute_decl.c
60
+ - ext/nokogiri/xml_cdata.c
61
+ - ext/nokogiri/xml_comment.c
62
+ - ext/nokogiri/xml_document.c
63
+ - ext/nokogiri/xml_document_fragment.c
64
+ - ext/nokogiri/xml_dtd.c
65
+ - ext/nokogiri/xml_element_content.c
66
+ - ext/nokogiri/xml_element_decl.c
67
+ - ext/nokogiri/xml_encoding_handler.c
68
+ - ext/nokogiri/xml_entity_decl.c
69
+ - ext/nokogiri/xml_entity_reference.c
70
+ - ext/nokogiri/xml_namespace.c
71
+ - ext/nokogiri/xml_node.c
72
+ - ext/nokogiri/xml_node_set.c
73
+ - ext/nokogiri/xml_processing_instruction.c
74
+ - ext/nokogiri/xml_reader.c
75
+ - ext/nokogiri/xml_relax_ng.c
76
+ - ext/nokogiri/xml_sax_parser.c
77
+ - ext/nokogiri/xml_sax_parser_context.c
78
+ - ext/nokogiri/xml_sax_push_parser.c
79
+ - ext/nokogiri/xml_schema.c
80
+ - ext/nokogiri/xml_syntax_error.c
81
+ - ext/nokogiri/xml_text.c
82
+ - ext/nokogiri/xml_xpath_context.c
83
+ - ext/nokogiri/xslt_stylesheet.c
84
+ - README.md
85
+ files:
86
+ - Gemfile
87
+ - LICENSE-DEPENDENCIES.md
88
+ - LICENSE.md
89
+ - README.md
90
+ - bin/nokogiri
91
+ - dependencies.yml
92
+ - ext/nokogiri/depend
93
+ - ext/nokogiri/extconf.rb
94
+ - ext/nokogiri/gumbo.c
95
+ - ext/nokogiri/html4_document.c
96
+ - ext/nokogiri/html4_element_description.c
97
+ - ext/nokogiri/html4_entity_lookup.c
98
+ - ext/nokogiri/html4_sax_parser.c
99
+ - ext/nokogiri/html4_sax_parser_context.c
100
+ - ext/nokogiri/html4_sax_push_parser.c
101
+ - ext/nokogiri/include/libexslt/exslt.h
102
+ - ext/nokogiri/include/libexslt/exsltconfig.h
103
+ - ext/nokogiri/include/libexslt/exsltexports.h
104
+ - ext/nokogiri/include/libxml2/libxml/HTMLparser.h
105
+ - ext/nokogiri/include/libxml2/libxml/HTMLtree.h
106
+ - ext/nokogiri/include/libxml2/libxml/SAX.h
107
+ - ext/nokogiri/include/libxml2/libxml/SAX2.h
108
+ - ext/nokogiri/include/libxml2/libxml/c14n.h
109
+ - ext/nokogiri/include/libxml2/libxml/catalog.h
110
+ - ext/nokogiri/include/libxml2/libxml/chvalid.h
111
+ - ext/nokogiri/include/libxml2/libxml/debugXML.h
112
+ - ext/nokogiri/include/libxml2/libxml/dict.h
113
+ - ext/nokogiri/include/libxml2/libxml/encoding.h
114
+ - ext/nokogiri/include/libxml2/libxml/entities.h
115
+ - ext/nokogiri/include/libxml2/libxml/globals.h
116
+ - ext/nokogiri/include/libxml2/libxml/hash.h
117
+ - ext/nokogiri/include/libxml2/libxml/list.h
118
+ - ext/nokogiri/include/libxml2/libxml/nanoftp.h
119
+ - ext/nokogiri/include/libxml2/libxml/nanohttp.h
120
+ - ext/nokogiri/include/libxml2/libxml/parser.h
121
+ - ext/nokogiri/include/libxml2/libxml/parserInternals.h
122
+ - ext/nokogiri/include/libxml2/libxml/pattern.h
123
+ - ext/nokogiri/include/libxml2/libxml/relaxng.h
124
+ - ext/nokogiri/include/libxml2/libxml/schemasInternals.h
125
+ - ext/nokogiri/include/libxml2/libxml/schematron.h
126
+ - ext/nokogiri/include/libxml2/libxml/threads.h
127
+ - ext/nokogiri/include/libxml2/libxml/tree.h
128
+ - ext/nokogiri/include/libxml2/libxml/uri.h
129
+ - ext/nokogiri/include/libxml2/libxml/valid.h
130
+ - ext/nokogiri/include/libxml2/libxml/xinclude.h
131
+ - ext/nokogiri/include/libxml2/libxml/xlink.h
132
+ - ext/nokogiri/include/libxml2/libxml/xmlIO.h
133
+ - ext/nokogiri/include/libxml2/libxml/xmlautomata.h
134
+ - ext/nokogiri/include/libxml2/libxml/xmlerror.h
135
+ - ext/nokogiri/include/libxml2/libxml/xmlexports.h
136
+ - ext/nokogiri/include/libxml2/libxml/xmlmemory.h
137
+ - ext/nokogiri/include/libxml2/libxml/xmlmodule.h
138
+ - ext/nokogiri/include/libxml2/libxml/xmlreader.h
139
+ - ext/nokogiri/include/libxml2/libxml/xmlregexp.h
140
+ - ext/nokogiri/include/libxml2/libxml/xmlsave.h
141
+ - ext/nokogiri/include/libxml2/libxml/xmlschemas.h
142
+ - ext/nokogiri/include/libxml2/libxml/xmlschemastypes.h
143
+ - ext/nokogiri/include/libxml2/libxml/xmlstring.h
144
+ - ext/nokogiri/include/libxml2/libxml/xmlunicode.h
145
+ - ext/nokogiri/include/libxml2/libxml/xmlversion.h
146
+ - ext/nokogiri/include/libxml2/libxml/xmlwriter.h
147
+ - ext/nokogiri/include/libxml2/libxml/xpath.h
148
+ - ext/nokogiri/include/libxml2/libxml/xpathInternals.h
149
+ - ext/nokogiri/include/libxml2/libxml/xpointer.h
150
+ - ext/nokogiri/include/libxslt/attributes.h
151
+ - ext/nokogiri/include/libxslt/documents.h
152
+ - ext/nokogiri/include/libxslt/extensions.h
153
+ - ext/nokogiri/include/libxslt/extra.h
154
+ - ext/nokogiri/include/libxslt/functions.h
155
+ - ext/nokogiri/include/libxslt/imports.h
156
+ - ext/nokogiri/include/libxslt/keys.h
157
+ - ext/nokogiri/include/libxslt/namespaces.h
158
+ - ext/nokogiri/include/libxslt/numbersInternals.h
159
+ - ext/nokogiri/include/libxslt/pattern.h
160
+ - ext/nokogiri/include/libxslt/preproc.h
161
+ - ext/nokogiri/include/libxslt/security.h
162
+ - ext/nokogiri/include/libxslt/templates.h
163
+ - ext/nokogiri/include/libxslt/transform.h
164
+ - ext/nokogiri/include/libxslt/variables.h
165
+ - ext/nokogiri/include/libxslt/xslt.h
166
+ - ext/nokogiri/include/libxslt/xsltInternals.h
167
+ - ext/nokogiri/include/libxslt/xsltconfig.h
168
+ - ext/nokogiri/include/libxslt/xsltexports.h
169
+ - ext/nokogiri/include/libxslt/xsltlocale.h
170
+ - ext/nokogiri/include/libxslt/xsltutils.h
171
+ - ext/nokogiri/libxml2_polyfill.c
172
+ - ext/nokogiri/nokogiri.c
173
+ - ext/nokogiri/nokogiri.h
174
+ - ext/nokogiri/test_global_handlers.c
175
+ - ext/nokogiri/xml_attr.c
176
+ - ext/nokogiri/xml_attribute_decl.c
177
+ - ext/nokogiri/xml_cdata.c
178
+ - ext/nokogiri/xml_comment.c
179
+ - ext/nokogiri/xml_document.c
180
+ - ext/nokogiri/xml_document_fragment.c
181
+ - ext/nokogiri/xml_dtd.c
182
+ - ext/nokogiri/xml_element_content.c
183
+ - ext/nokogiri/xml_element_decl.c
184
+ - ext/nokogiri/xml_encoding_handler.c
185
+ - ext/nokogiri/xml_entity_decl.c
186
+ - ext/nokogiri/xml_entity_reference.c
187
+ - ext/nokogiri/xml_namespace.c
188
+ - ext/nokogiri/xml_node.c
189
+ - ext/nokogiri/xml_node_set.c
190
+ - ext/nokogiri/xml_processing_instruction.c
191
+ - ext/nokogiri/xml_reader.c
192
+ - ext/nokogiri/xml_relax_ng.c
193
+ - ext/nokogiri/xml_sax_parser.c
194
+ - ext/nokogiri/xml_sax_parser_context.c
195
+ - ext/nokogiri/xml_sax_push_parser.c
196
+ - ext/nokogiri/xml_schema.c
197
+ - ext/nokogiri/xml_syntax_error.c
198
+ - ext/nokogiri/xml_text.c
199
+ - ext/nokogiri/xml_xpath_context.c
200
+ - ext/nokogiri/xslt_stylesheet.c
201
+ - gumbo-parser/CHANGES.md
202
+ - gumbo-parser/Makefile
203
+ - gumbo-parser/THANKS
204
+ - lib/nokogiri.rb
205
+ - lib/nokogiri/3.1/nokogiri.so
206
+ - lib/nokogiri/3.2/nokogiri.so
207
+ - lib/nokogiri/3.3/nokogiri.so
208
+ - lib/nokogiri/3.4/nokogiri.so
209
+ - lib/nokogiri/class_resolver.rb
210
+ - lib/nokogiri/css.rb
211
+ - lib/nokogiri/css/node.rb
212
+ - lib/nokogiri/css/parser.rb
213
+ - lib/nokogiri/css/parser.y
214
+ - lib/nokogiri/css/parser_extras.rb
215
+ - lib/nokogiri/css/selector_cache.rb
216
+ - lib/nokogiri/css/syntax_error.rb
217
+ - lib/nokogiri/css/tokenizer.rb
218
+ - lib/nokogiri/css/tokenizer.rex
219
+ - lib/nokogiri/css/xpath_visitor.rb
220
+ - lib/nokogiri/decorators/slop.rb
221
+ - lib/nokogiri/encoding_handler.rb
222
+ - lib/nokogiri/extension.rb
223
+ - lib/nokogiri/gumbo.rb
224
+ - lib/nokogiri/html.rb
225
+ - lib/nokogiri/html4.rb
226
+ - lib/nokogiri/html4/builder.rb
227
+ - lib/nokogiri/html4/document.rb
228
+ - lib/nokogiri/html4/document_fragment.rb
229
+ - lib/nokogiri/html4/element_description.rb
230
+ - lib/nokogiri/html4/element_description_defaults.rb
231
+ - lib/nokogiri/html4/encoding_reader.rb
232
+ - lib/nokogiri/html4/entity_lookup.rb
233
+ - lib/nokogiri/html4/sax/parser.rb
234
+ - lib/nokogiri/html4/sax/parser_context.rb
235
+ - lib/nokogiri/html4/sax/push_parser.rb
236
+ - lib/nokogiri/html5.rb
237
+ - lib/nokogiri/html5/builder.rb
238
+ - lib/nokogiri/html5/document.rb
239
+ - lib/nokogiri/html5/document_fragment.rb
240
+ - lib/nokogiri/html5/node.rb
241
+ - lib/nokogiri/jruby/dependencies.rb
242
+ - lib/nokogiri/jruby/nokogiri_jars.rb
243
+ - lib/nokogiri/syntax_error.rb
244
+ - lib/nokogiri/version.rb
245
+ - lib/nokogiri/version/constant.rb
246
+ - lib/nokogiri/version/info.rb
247
+ - lib/nokogiri/xml.rb
248
+ - lib/nokogiri/xml/attr.rb
249
+ - lib/nokogiri/xml/attribute_decl.rb
250
+ - lib/nokogiri/xml/builder.rb
251
+ - lib/nokogiri/xml/cdata.rb
252
+ - lib/nokogiri/xml/character_data.rb
253
+ - lib/nokogiri/xml/document.rb
254
+ - lib/nokogiri/xml/document_fragment.rb
255
+ - lib/nokogiri/xml/dtd.rb
256
+ - lib/nokogiri/xml/element_content.rb
257
+ - lib/nokogiri/xml/element_decl.rb
258
+ - lib/nokogiri/xml/entity_decl.rb
259
+ - lib/nokogiri/xml/entity_reference.rb
260
+ - lib/nokogiri/xml/namespace.rb
261
+ - lib/nokogiri/xml/node.rb
262
+ - lib/nokogiri/xml/node/save_options.rb
263
+ - lib/nokogiri/xml/node_set.rb
264
+ - lib/nokogiri/xml/notation.rb
265
+ - lib/nokogiri/xml/parse_options.rb
266
+ - lib/nokogiri/xml/pp.rb
267
+ - lib/nokogiri/xml/pp/character_data.rb
268
+ - lib/nokogiri/xml/pp/node.rb
269
+ - lib/nokogiri/xml/processing_instruction.rb
270
+ - lib/nokogiri/xml/reader.rb
271
+ - lib/nokogiri/xml/relax_ng.rb
272
+ - lib/nokogiri/xml/sax.rb
273
+ - lib/nokogiri/xml/sax/document.rb
274
+ - lib/nokogiri/xml/sax/parser.rb
275
+ - lib/nokogiri/xml/sax/parser_context.rb
276
+ - lib/nokogiri/xml/sax/push_parser.rb
277
+ - lib/nokogiri/xml/schema.rb
278
+ - lib/nokogiri/xml/searchable.rb
279
+ - lib/nokogiri/xml/syntax_error.rb
280
+ - lib/nokogiri/xml/text.rb
281
+ - lib/nokogiri/xml/xpath.rb
282
+ - lib/nokogiri/xml/xpath/syntax_error.rb
283
+ - lib/nokogiri/xml/xpath_context.rb
284
+ - lib/nokogiri/xslt.rb
285
+ - lib/nokogiri/xslt/stylesheet.rb
286
+ - lib/xsd/xmlparser/nokogiri.rb
287
+ homepage: https://nokogiri.org
288
+ licenses:
289
+ - MIT
290
+ metadata:
291
+ homepage_uri: https://nokogiri.org
292
+ bug_tracker_uri: https://github.com/sparklemotion/nokogiri/issues
293
+ documentation_uri: https://nokogiri.org/rdoc/index.html
294
+ changelog_uri: https://nokogiri.org/CHANGELOG.html
295
+ source_code_uri: https://github.com/sparklemotion/nokogiri
296
+ rubygems_mfa_required: 'true'
297
+ post_install_message:
298
+ rdoc_options:
299
+ - "--main"
300
+ - README.md
301
+ require_paths:
302
+ - lib
303
+ required_ruby_version: !ruby/object:Gem::Requirement
304
+ requirements:
305
+ - - ">="
306
+ - !ruby/object:Gem::Version
307
+ version: '3.1'
308
+ - - "<"
309
+ - !ruby/object:Gem::Version
310
+ version: 3.5.dev
311
+ required_rubygems_version: !ruby/object:Gem::Requirement
312
+ requirements:
313
+ - - ">"
314
+ - !ruby/object:Gem::Version
315
+ version: 1.3.1
316
+ - - ">="
317
+ - !ruby/object:Gem::Version
318
+ version: 3.3.22
319
+ requirements: []
320
+ rubygems_version: 3.3.26
321
+ signing_key:
322
+ specification_version: 4
323
+ summary: Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby.
324
+ test_files: []