nokogiri 1.10.10-java → 1.11.0.rc1-java
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.
- checksums.yaml +4 -4
- data/README.md +19 -17
- data/ext/java/nokogiri/HtmlDocument.java +34 -46
- data/ext/java/nokogiri/HtmlSaxParserContext.java +87 -57
- data/ext/java/nokogiri/NokogiriService.java +1 -1
- data/ext/java/nokogiri/XmlAttr.java +13 -20
- data/ext/java/nokogiri/XmlAttributeDecl.java +11 -12
- data/ext/java/nokogiri/XmlCdata.java +3 -4
- data/ext/java/nokogiri/XmlComment.java +1 -1
- data/ext/java/nokogiri/XmlDocument.java +148 -175
- data/ext/java/nokogiri/XmlDocumentFragment.java +13 -31
- data/ext/java/nokogiri/XmlDtd.java +5 -8
- data/ext/java/nokogiri/XmlElement.java +1 -20
- data/ext/java/nokogiri/XmlElementDecl.java +23 -28
- data/ext/java/nokogiri/XmlEntityDecl.java +23 -27
- data/ext/java/nokogiri/XmlEntityReference.java +2 -2
- data/ext/java/nokogiri/XmlNamespace.java +72 -89
- data/ext/java/nokogiri/XmlNode.java +300 -401
- data/ext/java/nokogiri/XmlNodeSet.java +70 -76
- data/ext/java/nokogiri/XmlReader.java +10 -11
- data/ext/java/nokogiri/XmlSaxParserContext.java +7 -7
- data/ext/java/nokogiri/XmlSchema.java +3 -3
- data/ext/java/nokogiri/XmlText.java +12 -9
- data/ext/java/nokogiri/XmlXpathContext.java +7 -7
- data/ext/java/nokogiri/XsltStylesheet.java +7 -15
- data/ext/java/nokogiri/internals/HtmlDomParserContext.java +4 -10
- data/ext/java/nokogiri/internals/NokogiriHelpers.java +71 -135
- data/ext/java/nokogiri/internals/NokogiriNamespaceCache.java +90 -58
- data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +5 -4
- data/ext/java/nokogiri/internals/ParserContext.java +27 -73
- data/ext/java/nokogiri/internals/ReaderNode.java +2 -4
- data/ext/java/nokogiri/internals/XmlDomParserContext.java +17 -32
- data/ext/nokogiri/extconf.rb +44 -35
- data/ext/nokogiri/nokogiri.c +12 -6
- data/ext/nokogiri/nokogiri.h +1 -0
- data/ext/nokogiri/xml_document.c +10 -1
- data/ext/nokogiri/xml_node.c +20 -0
- data/ext/nokogiri/xml_schema.c +0 -29
- data/ext/nokogiri/xslt_stylesheet.c +0 -4
- data/lib/nokogiri.rb +2 -19
- data/lib/nokogiri/css.rb +1 -0
- data/lib/nokogiri/css/node.rb +1 -0
- data/lib/nokogiri/css/parser.rb +1 -0
- data/lib/nokogiri/css/parser_extras.rb +1 -0
- data/lib/nokogiri/css/syntax_error.rb +1 -0
- data/lib/nokogiri/css/tokenizer.rb +1 -0
- data/lib/nokogiri/css/xpath_visitor.rb +3 -1
- data/lib/nokogiri/decorators/slop.rb +1 -0
- data/lib/nokogiri/html.rb +1 -0
- data/lib/nokogiri/html/builder.rb +1 -0
- data/lib/nokogiri/html/document.rb +1 -0
- data/lib/nokogiri/html/document_fragment.rb +1 -0
- data/lib/nokogiri/html/element_description.rb +1 -0
- data/lib/nokogiri/html/element_description_defaults.rb +1 -0
- data/lib/nokogiri/html/entity_lookup.rb +1 -0
- data/lib/nokogiri/html/sax/parser.rb +1 -0
- data/lib/nokogiri/html/sax/parser_context.rb +1 -0
- data/lib/nokogiri/html/sax/push_parser.rb +1 -0
- data/lib/nokogiri/jruby/dependencies.rb +20 -0
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/syntax_error.rb +1 -0
- data/lib/nokogiri/version.rb +85 -45
- data/lib/nokogiri/xml.rb +1 -0
- data/lib/nokogiri/xml/attr.rb +1 -0
- data/lib/nokogiri/xml/attribute_decl.rb +1 -0
- data/lib/nokogiri/xml/builder.rb +1 -0
- data/lib/nokogiri/xml/cdata.rb +1 -0
- data/lib/nokogiri/xml/character_data.rb +1 -0
- data/lib/nokogiri/xml/document.rb +3 -8
- data/lib/nokogiri/xml/document_fragment.rb +1 -0
- data/lib/nokogiri/xml/dtd.rb +1 -0
- data/lib/nokogiri/xml/element_content.rb +1 -0
- data/lib/nokogiri/xml/element_decl.rb +1 -0
- data/lib/nokogiri/xml/entity_decl.rb +1 -0
- data/lib/nokogiri/xml/entity_reference.rb +1 -0
- data/lib/nokogiri/xml/namespace.rb +1 -0
- data/lib/nokogiri/xml/node.rb +26 -12
- data/lib/nokogiri/xml/node/save_options.rb +1 -0
- data/lib/nokogiri/xml/node_set.rb +1 -0
- data/lib/nokogiri/xml/notation.rb +1 -0
- data/lib/nokogiri/xml/parse_options.rb +4 -3
- data/lib/nokogiri/xml/pp.rb +1 -0
- data/lib/nokogiri/xml/pp/character_data.rb +1 -0
- data/lib/nokogiri/xml/pp/node.rb +1 -0
- data/lib/nokogiri/xml/processing_instruction.rb +1 -0
- data/lib/nokogiri/xml/reader.rb +7 -3
- data/lib/nokogiri/xml/relax_ng.rb +1 -0
- data/lib/nokogiri/xml/sax.rb +1 -0
- data/lib/nokogiri/xml/sax/document.rb +1 -0
- data/lib/nokogiri/xml/sax/parser.rb +1 -0
- data/lib/nokogiri/xml/sax/parser_context.rb +1 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +1 -0
- data/lib/nokogiri/xml/schema.rb +1 -0
- data/lib/nokogiri/xml/searchable.rb +1 -0
- data/lib/nokogiri/xml/syntax_error.rb +1 -0
- data/lib/nokogiri/xml/text.rb +1 -0
- data/lib/nokogiri/xml/xpath.rb +1 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +1 -0
- data/lib/nokogiri/xml/xpath_context.rb +1 -0
- data/lib/nokogiri/xslt.rb +1 -0
- data/lib/nokogiri/xslt/stylesheet.rb +1 -0
- data/lib/xsd/xmlparser/nokogiri.rb +1 -0
- metadata +26 -27
- data/ext/java/nokogiri/internals/NokogiriEncodingReaderWrapper.java +0 -107
- data/ext/java/nokogiri/internals/UncloseableInputStream.java +0 -102
data/lib/nokogiri/xml.rb
CHANGED
data/lib/nokogiri/xml/attr.rb
CHANGED
data/lib/nokogiri/xml/builder.rb
CHANGED
data/lib/nokogiri/xml/cdata.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Nokogiri
|
2
3
|
module XML
|
3
4
|
##
|
@@ -254,18 +255,12 @@ module Nokogiri
|
|
254
255
|
##
|
255
256
|
# +JRuby+
|
256
257
|
# Wraps Java's org.w3c.dom.document and returns Nokogiri::XML::Document
|
257
|
-
def self.wrap
|
258
|
-
raise "JRuby only method" unless Nokogiri.jruby?
|
259
|
-
return wrapJavaDocument(document)
|
260
|
-
end
|
258
|
+
def self.wrap(document) end if false # native-ext provides Document.wrap
|
261
259
|
|
262
260
|
##
|
263
261
|
# +JRuby+
|
264
262
|
# Returns Java's org.w3c.dom.document of this Document.
|
265
|
-
def to_java
|
266
|
-
raise "JRuby only method" unless Nokogiri.jruby?
|
267
|
-
return toJavaDocument()
|
268
|
-
end
|
263
|
+
def to_java; end if false # JRuby provides #to_java
|
269
264
|
|
270
265
|
private
|
271
266
|
def self.empty_doc? string_or_io
|
data/lib/nokogiri/xml/dtd.rb
CHANGED
data/lib/nokogiri/xml/node.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
require 'stringio'
|
3
4
|
require 'nokogiri/xml/node/save_options'
|
4
5
|
|
@@ -337,9 +338,9 @@ module Nokogiri
|
|
337
338
|
# If you need to distinguish attributes with the same name, with different namespaces
|
338
339
|
# use #attribute_nodes instead.
|
339
340
|
def attributes
|
340
|
-
|
341
|
-
[node.node_name
|
342
|
-
|
341
|
+
attribute_nodes.each_with_object({}) do |node, hash|
|
342
|
+
hash[node.node_name] = node
|
343
|
+
end
|
343
344
|
end
|
344
345
|
|
345
346
|
###
|
@@ -348,6 +349,12 @@ module Nokogiri
|
|
348
349
|
attribute_nodes.map(&:value)
|
349
350
|
end
|
350
351
|
|
352
|
+
###
|
353
|
+
# Does this Node's attributes include <value>
|
354
|
+
def value?(value)
|
355
|
+
values.include? value
|
356
|
+
end
|
357
|
+
|
351
358
|
###
|
352
359
|
# Get the attribute names for this Node.
|
353
360
|
def keys
|
@@ -509,10 +516,11 @@ module Nokogiri
|
|
509
516
|
# default namespaces set on ancestor will NOT be, even if self
|
510
517
|
# has no explicit default namespace.
|
511
518
|
def namespaces
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
519
|
+
namespace_scopes.each_with_object({}) do |ns, hash|
|
520
|
+
prefix = ns.prefix
|
521
|
+
key = prefix ? "xmlns:#{prefix}" : "xmlns"
|
522
|
+
hash[key] = ns.href
|
523
|
+
end
|
516
524
|
end
|
517
525
|
|
518
526
|
# Returns true if this is a Comment
|
@@ -761,10 +769,15 @@ module Nokogiri
|
|
761
769
|
end
|
762
770
|
indent_text = options[:indent_text] || ' '
|
763
771
|
|
772
|
+
# Any string times 0 returns an empty string. Therefore, use the same
|
773
|
+
# string instead of generating a new empty string for every node with
|
774
|
+
# zero indentation.
|
775
|
+
indentation = indent_times.zero? ? '' : (indent_text * indent_times)
|
776
|
+
|
764
777
|
config = SaveOptions.new(save_options.to_i)
|
765
778
|
yield config if block_given?
|
766
779
|
|
767
|
-
native_write_to(io, encoding,
|
780
|
+
native_write_to(io, encoding, indentation, config.options)
|
768
781
|
end
|
769
782
|
|
770
783
|
###
|
@@ -847,17 +860,18 @@ module Nokogiri
|
|
847
860
|
node_or_tags
|
848
861
|
end
|
849
862
|
|
863
|
+
USING_LIBXML_WITH_BROKEN_SERIALIZATION = Nokogiri.uses_libxml?("~> 2.6.0").freeze
|
864
|
+
private_constant :USING_LIBXML_WITH_BROKEN_SERIALIZATION
|
865
|
+
|
850
866
|
def to_format save_option, options
|
851
|
-
|
852
|
-
return dump_html if Nokogiri.uses_libxml? && %w[2 6] === LIBXML_VERSION.split('.')[0..1]
|
867
|
+
return dump_html if USING_LIBXML_WITH_BROKEN_SERIALIZATION
|
853
868
|
|
854
869
|
options[:save_with] = save_option unless options[:save_with]
|
855
870
|
serialize(options)
|
856
871
|
end
|
857
872
|
|
858
873
|
def write_format_to save_option, io, options
|
859
|
-
|
860
|
-
return (io << dump_html) if Nokogiri.uses_libxml? && %w[2 6] === LIBXML_VERSION.split('.')[0..1]
|
874
|
+
return (io << dump_html) if USING_LIBXML_WITH_BROKEN_SERIALIZATION
|
861
875
|
|
862
876
|
options[:save_with] ||= save_option
|
863
877
|
write_to io, options
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Nokogiri
|
2
3
|
module XML
|
3
4
|
###
|
@@ -5,11 +6,11 @@ module Nokogiri
|
|
5
6
|
#
|
6
7
|
# == Building combinations of parse options
|
7
8
|
# You can build your own combinations of these parse options by using any of the following methods:
|
8
|
-
# *Note*: All examples attempt to set the +RECOVER+ & +NOENT+ options.
|
9
|
+
# *Note*: All examples attempt to set the +RECOVER+ & +NOENT+ options.
|
9
10
|
# [Ruby's bitwise operators] You can use the Ruby bitwise operators to set various combinations.
|
10
|
-
# Nokogiri.XML('<content>Chapter 1</content',
|
11
|
+
# Nokogiri.XML('<content>Chapter 1</content', nil, nil, Nokogiri::XML::ParseOptions.new((1 << 0) | (1 << 1)))
|
11
12
|
# [Method chaining] Every option has an equivalent method in lowercase. You can chain these methods together to set various combinations.
|
12
|
-
# Nokogiri.XML('<content>Chapter 1</content',
|
13
|
+
# Nokogiri.XML('<content>Chapter 1</content', nil, nil, Nokogiri::XML::ParseOptions.new.recover.noent)
|
13
14
|
# [Using Ruby Blocks] You can also setup parse combinations in the block passed to Nokogiri.XML or Nokogiri.HTML
|
14
15
|
# Nokogiri.XML('<content>Chapter 1</content') {|config| config.recover.noent}
|
15
16
|
#
|
data/lib/nokogiri/xml/pp.rb
CHANGED
data/lib/nokogiri/xml/pp/node.rb
CHANGED
data/lib/nokogiri/xml/reader.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Nokogiri
|
2
3
|
module XML
|
3
4
|
###
|
@@ -87,9 +88,12 @@ module Nokogiri
|
|
87
88
|
###
|
88
89
|
# Get a list of attributes for the current node.
|
89
90
|
def attributes
|
90
|
-
|
91
|
-
|
92
|
-
|
91
|
+
attrs_hash = attribute_nodes.each_with_object({}) do |node, hash|
|
92
|
+
hash[node.name] = node.to_s
|
93
|
+
end
|
94
|
+
ns = namespaces
|
95
|
+
attrs_hash.merge!(ns) if ns
|
96
|
+
attrs_hash
|
93
97
|
end
|
94
98
|
|
95
99
|
###
|
data/lib/nokogiri/xml/sax.rb
CHANGED
data/lib/nokogiri/xml/schema.rb
CHANGED
data/lib/nokogiri/xml/text.rb
CHANGED
data/lib/nokogiri/xml/xpath.rb
CHANGED
data/lib/nokogiri/xslt.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nokogiri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0.rc1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
@@ -14,14 +14,14 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2020-
|
17
|
+
date: 2020-02-02 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
requirement: !ruby/object:Gem::Requirement
|
21
21
|
requirements:
|
22
22
|
- - "~>"
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: '0.
|
24
|
+
version: '0.30'
|
25
25
|
name: concourse
|
26
26
|
prerelease: false
|
27
27
|
type: :development
|
@@ -29,7 +29,21 @@ dependencies:
|
|
29
29
|
requirements:
|
30
30
|
- - "~>"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '0.
|
32
|
+
version: '0.30'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - "~>"
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '3.18'
|
39
|
+
name: hoe
|
40
|
+
prerelease: false
|
41
|
+
type: :development
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3.18'
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
requirement: !ruby/object:Gem::Requirement
|
35
49
|
requirements:
|
@@ -119,7 +133,7 @@ dependencies:
|
|
119
133
|
requirements:
|
120
134
|
- - "~>"
|
121
135
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
136
|
+
version: '13.0'
|
123
137
|
name: rake
|
124
138
|
prerelease: false
|
125
139
|
type: :development
|
@@ -127,13 +141,13 @@ dependencies:
|
|
127
141
|
requirements:
|
128
142
|
- - "~>"
|
129
143
|
- !ruby/object:Gem::Version
|
130
|
-
version: '
|
144
|
+
version: '13.0'
|
131
145
|
- !ruby/object:Gem::Dependency
|
132
146
|
requirement: !ruby/object:Gem::Requirement
|
133
147
|
requirements:
|
134
148
|
- - "~>"
|
135
149
|
- !ruby/object:Gem::Version
|
136
|
-
version: 1.1
|
150
|
+
version: '1.1'
|
137
151
|
name: rake-compiler
|
138
152
|
prerelease: false
|
139
153
|
type: :development
|
@@ -141,7 +155,7 @@ dependencies:
|
|
141
155
|
requirements:
|
142
156
|
- - "~>"
|
143
157
|
- !ruby/object:Gem::Version
|
144
|
-
version: 1.1
|
158
|
+
version: '1.1'
|
145
159
|
- !ruby/object:Gem::Dependency
|
146
160
|
requirement: !ruby/object:Gem::Requirement
|
147
161
|
requirements:
|
@@ -218,20 +232,6 @@ dependencies:
|
|
218
232
|
- - "<"
|
219
233
|
- !ruby/object:Gem::Version
|
220
234
|
version: '7'
|
221
|
-
- !ruby/object:Gem::Dependency
|
222
|
-
requirement: !ruby/object:Gem::Requirement
|
223
|
-
requirements:
|
224
|
-
- - "~>"
|
225
|
-
- !ruby/object:Gem::Version
|
226
|
-
version: '3.22'
|
227
|
-
name: hoe
|
228
|
-
prerelease: false
|
229
|
-
type: :development
|
230
|
-
version_requirements: !ruby/object:Gem::Requirement
|
231
|
-
requirements:
|
232
|
-
- - "~>"
|
233
|
-
- !ruby/object:Gem::Version
|
234
|
-
version: '3.22'
|
235
235
|
description: |-
|
236
236
|
Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser. Among
|
237
237
|
Nokogiri's many features is the ability to search documents via XPath
|
@@ -328,7 +328,6 @@ files:
|
|
328
328
|
- ext/java/nokogiri/internals/IgnoreSchemaErrorsErrorHandler.java
|
329
329
|
- ext/java/nokogiri/internals/NokogiriBlockingQueueInputStream.java
|
330
330
|
- ext/java/nokogiri/internals/NokogiriDomParser.java
|
331
|
-
- ext/java/nokogiri/internals/NokogiriEncodingReaderWrapper.java
|
332
331
|
- ext/java/nokogiri/internals/NokogiriEntityResolver.java
|
333
332
|
- ext/java/nokogiri/internals/NokogiriErrorHandler.java
|
334
333
|
- ext/java/nokogiri/internals/NokogiriHandler.java
|
@@ -346,7 +345,6 @@ files:
|
|
346
345
|
- ext/java/nokogiri/internals/ReaderNode.java
|
347
346
|
- ext/java/nokogiri/internals/SaveContextVisitor.java
|
348
347
|
- ext/java/nokogiri/internals/SchemaErrorHandler.java
|
349
|
-
- ext/java/nokogiri/internals/UncloseableInputStream.java
|
350
348
|
- ext/java/nokogiri/internals/XalanDTMManagerPatch.java
|
351
349
|
- ext/java/nokogiri/internals/XmlDeclHandler.java
|
352
350
|
- ext/java/nokogiri/internals/XmlDomParserContext.java
|
@@ -475,6 +473,7 @@ files:
|
|
475
473
|
- lib/nokogiri/html/sax/parser.rb
|
476
474
|
- lib/nokogiri/html/sax/parser_context.rb
|
477
475
|
- lib/nokogiri/html/sax/push_parser.rb
|
476
|
+
- lib/nokogiri/jruby/dependencies.rb
|
478
477
|
- lib/nokogiri/nokogiri.jar
|
479
478
|
- lib/nokogiri/syntax_error.rb
|
480
479
|
- lib/nokogiri/version.rb
|
@@ -541,12 +540,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
541
540
|
requirements:
|
542
541
|
- - ">="
|
543
542
|
- !ruby/object:Gem::Version
|
544
|
-
version: 2.
|
543
|
+
version: 2.4.0
|
545
544
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
546
545
|
requirements:
|
547
|
-
- - "
|
546
|
+
- - ">"
|
548
547
|
- !ruby/object:Gem::Version
|
549
|
-
version:
|
548
|
+
version: 1.3.1
|
550
549
|
requirements: []
|
551
550
|
rubyforge_project:
|
552
551
|
rubygems_version: 2.7.10
|