nokogiri 1.9.0.rc1-java → 1.9.1-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/lib/nokogiri/css/parser.rb +61 -61
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/version.rb +1 -1
- data/lib/nokogiri/xml/document_fragment.rb +1 -1
- metadata +4 -146
- data/.autotest +0 -22
- data/.cross_rubies +0 -8
- data/.editorconfig +0 -17
- data/.gemtest +0 -0
- data/.travis.yml +0 -63
- data/CHANGELOG.md +0 -1402
- data/CONTRIBUTING.md +0 -42
- data/C_CODING_STYLE.rdoc +0 -33
- data/Gemfile +0 -23
- data/Gemfile-libxml-ruby +0 -3
- data/Manifest.txt +0 -371
- data/ROADMAP.md +0 -111
- data/Rakefile +0 -358
- data/SECURITY.md +0 -19
- data/STANDARD_RESPONSES.md +0 -47
- data/Y_U_NO_GEMSPEC.md +0 -155
- data/appveyor.yml +0 -29
- data/build_all +0 -48
- data/patches/sort-patches-by-date +0 -25
- data/suppressions/README.txt +0 -1
- data/suppressions/nokogiri_ruby-2.supp +0 -10
- data/tasks/test.rb +0 -100
- data/test/css/test_nthiness.rb +0 -226
- data/test/css/test_parser.rb +0 -386
- data/test/css/test_tokenizer.rb +0 -215
- data/test/css/test_xpath_visitor.rb +0 -96
- data/test/decorators/test_slop.rb +0 -23
- data/test/files/2ch.html +0 -108
- data/test/files/GH_1042.html +0 -18
- data/test/files/address_book.rlx +0 -12
- data/test/files/address_book.xml +0 -10
- data/test/files/atom.xml +0 -344
- data/test/files/bar/bar.xsd +0 -4
- data/test/files/bogus.xml +0 -0
- data/test/files/dont_hurt_em_why.xml +0 -422
- data/test/files/encoding.html +0 -82
- data/test/files/encoding.xhtml +0 -84
- data/test/files/exslt.xml +0 -8
- data/test/files/exslt.xslt +0 -35
- data/test/files/foo/foo.xsd +0 -4
- data/test/files/metacharset.html +0 -10
- data/test/files/namespace_pressure_test.xml +0 -1684
- data/test/files/noencoding.html +0 -47
- data/test/files/po.xml +0 -32
- data/test/files/po.xsd +0 -66
- data/test/files/saml/saml20assertion_schema.xsd +0 -283
- data/test/files/saml/saml20protocol_schema.xsd +0 -302
- data/test/files/saml/xenc_schema.xsd +0 -146
- data/test/files/saml/xmldsig_schema.xsd +0 -318
- data/test/files/shift_jis.html +0 -10
- data/test/files/shift_jis.xml +0 -5
- data/test/files/shift_jis_no_charset.html +0 -9
- data/test/files/slow-xpath.xml +0 -25509
- data/test/files/snuggles.xml +0 -3
- data/test/files/staff.dtd +0 -10
- data/test/files/staff.xml +0 -59
- data/test/files/staff.xslt +0 -32
- data/test/files/test_document_url/bar.xml +0 -2
- data/test/files/test_document_url/document.dtd +0 -4
- data/test/files/test_document_url/document.xml +0 -6
- data/test/files/tlm.html +0 -851
- data/test/files/to_be_xincluded.xml +0 -2
- data/test/files/valid_bar.xml +0 -2
- data/test/files/xinclude.xml +0 -4
- data/test/helper.rb +0 -271
- data/test/html/sax/test_parser.rb +0 -168
- data/test/html/sax/test_parser_context.rb +0 -46
- data/test/html/sax/test_parser_text.rb +0 -163
- data/test/html/sax/test_push_parser.rb +0 -87
- data/test/html/test_attributes.rb +0 -85
- data/test/html/test_builder.rb +0 -164
- data/test/html/test_document.rb +0 -722
- data/test/html/test_document_encoding.rb +0 -143
- data/test/html/test_document_fragment.rb +0 -310
- data/test/html/test_element_description.rb +0 -105
- data/test/html/test_named_characters.rb +0 -14
- data/test/html/test_node.rb +0 -212
- data/test/html/test_node_encoding.rb +0 -91
- data/test/namespaces/test_additional_namespaces_in_builder_doc.rb +0 -14
- data/test/namespaces/test_namespaces_aliased_default.rb +0 -24
- data/test/namespaces/test_namespaces_in_builder_doc.rb +0 -75
- data/test/namespaces/test_namespaces_in_cloned_doc.rb +0 -31
- data/test/namespaces/test_namespaces_in_created_doc.rb +0 -75
- data/test/namespaces/test_namespaces_in_parsed_doc.rb +0 -80
- data/test/namespaces/test_namespaces_preservation.rb +0 -31
- data/test/test_convert_xpath.rb +0 -135
- data/test/test_css_cache.rb +0 -47
- data/test/test_encoding_handler.rb +0 -48
- data/test/test_memory_leak.rb +0 -226
- data/test/test_nokogiri.rb +0 -138
- data/test/test_soap4r_sax.rb +0 -52
- data/test/test_xslt_transforms.rb +0 -314
- data/test/xml/node/test_save_options.rb +0 -28
- data/test/xml/node/test_subclass.rb +0 -44
- data/test/xml/sax/test_parser.rb +0 -402
- data/test/xml/sax/test_parser_context.rb +0 -115
- data/test/xml/sax/test_parser_text.rb +0 -202
- data/test/xml/sax/test_push_parser.rb +0 -265
- data/test/xml/test_attr.rb +0 -96
- data/test/xml/test_attribute_decl.rb +0 -86
- data/test/xml/test_builder.rb +0 -353
- data/test/xml/test_c14n.rb +0 -180
- data/test/xml/test_cdata.rb +0 -54
- data/test/xml/test_comment.rb +0 -40
- data/test/xml/test_document.rb +0 -982
- data/test/xml/test_document_encoding.rb +0 -31
- data/test/xml/test_document_fragment.rb +0 -312
- data/test/xml/test_dtd.rb +0 -187
- data/test/xml/test_dtd_encoding.rb +0 -31
- data/test/xml/test_element_content.rb +0 -56
- data/test/xml/test_element_decl.rb +0 -73
- data/test/xml/test_entity_decl.rb +0 -122
- data/test/xml/test_entity_reference.rb +0 -262
- data/test/xml/test_namespace.rb +0 -96
- data/test/xml/test_node.rb +0 -1379
- data/test/xml/test_node_attributes.rb +0 -115
- data/test/xml/test_node_encoding.rb +0 -75
- data/test/xml/test_node_inheritance.rb +0 -32
- data/test/xml/test_node_reparenting.rb +0 -661
- data/test/xml/test_node_set.rb +0 -828
- data/test/xml/test_parse_options.rb +0 -64
- data/test/xml/test_processing_instruction.rb +0 -30
- data/test/xml/test_reader.rb +0 -620
- data/test/xml/test_reader_encoding.rb +0 -134
- data/test/xml/test_relax_ng.rb +0 -60
- data/test/xml/test_schema.rb +0 -142
- data/test/xml/test_syntax_error.rb +0 -36
- data/test/xml/test_text.rb +0 -69
- data/test/xml/test_unparented_node.rb +0 -483
- data/test/xml/test_xinclude.rb +0 -83
- data/test/xml/test_xpath.rb +0 -470
- data/test/xslt/test_custom_functions.rb +0 -133
- data/test/xslt/test_exception_handling.rb +0 -37
@@ -1,133 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require "helper"
|
4
|
-
|
5
|
-
module Nokogiri
|
6
|
-
module XSLT
|
7
|
-
class TestCustomFunctions < Nokogiri::TestCase
|
8
|
-
def setup
|
9
|
-
super
|
10
|
-
@xml = Nokogiri.XML(<<-EOXML)
|
11
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
12
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
|
13
|
-
"http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
|
14
|
-
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
15
|
-
<head>
|
16
|
-
<meta http-equiv="Content-type" content="application/xhtml+xml"/>
|
17
|
-
<title>Foo</title>
|
18
|
-
</head>
|
19
|
-
<body>
|
20
|
-
<h1>Foo</h1>
|
21
|
-
<p>Lorem ipsum.</p>
|
22
|
-
</body>
|
23
|
-
</html>
|
24
|
-
EOXML
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_function
|
28
|
-
skip("Pure Java version doesn't support this feature.") if !Nokogiri.uses_libxml?
|
29
|
-
foo = Class.new do
|
30
|
-
def capitalize nodes
|
31
|
-
nodes.first.content.upcase
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
XSLT.register "http://e.org/functions", foo
|
36
|
-
|
37
|
-
xsl = Nokogiri.XSLT(<<-EOXSL)
|
38
|
-
<?xml version="1.0"?>
|
39
|
-
<xsl:stylesheet version="1.0"
|
40
|
-
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
41
|
-
xmlns:f="http://e.org/functions"
|
42
|
-
extension-element-prefixes="f">
|
43
|
-
|
44
|
-
<xsl:template match="text()">
|
45
|
-
<xsl:copy-of select="f:capitalize(.)"/>
|
46
|
-
</xsl:template>
|
47
|
-
|
48
|
-
<xsl:template match="@*|node()">
|
49
|
-
<xsl:copy>
|
50
|
-
<xsl:apply-templates select="@*|node()"/>
|
51
|
-
<xsl:apply-imports/>
|
52
|
-
</xsl:copy>
|
53
|
-
</xsl:template>
|
54
|
-
|
55
|
-
</xsl:stylesheet>
|
56
|
-
EOXSL
|
57
|
-
result = xsl.transform @xml
|
58
|
-
assert_match(/FOO/, result.css('title').first.text)
|
59
|
-
end
|
60
|
-
|
61
|
-
|
62
|
-
def test_function_arguments
|
63
|
-
skip("Pure Java version doesn't support this feature.") if !Nokogiri.uses_libxml?
|
64
|
-
foo = Class.new do
|
65
|
-
include MiniTest::Assertions
|
66
|
-
# Minitest 5 uses `self.assertions` in `assert()` which is not
|
67
|
-
# defined in the Minitest::Assertions module :-(
|
68
|
-
attr_writer :assertions
|
69
|
-
def assertions; @assertions ||= 0; end
|
70
|
-
|
71
|
-
def multiarg *args
|
72
|
-
assert_equal ["abc", "xyz"], args
|
73
|
-
args.first
|
74
|
-
end
|
75
|
-
|
76
|
-
def numericarg arg
|
77
|
-
assert_equal 42, arg
|
78
|
-
arg
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
xsl = Nokogiri.XSLT(<<-EOXSL, "http://e.org/functions" => foo)
|
83
|
-
<?xml version="1.0"?>
|
84
|
-
<xsl:stylesheet version="1.0"
|
85
|
-
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
86
|
-
xmlns:f="http://e.org/functions"
|
87
|
-
extension-element-prefixes="f">
|
88
|
-
|
89
|
-
<xsl:template match="text()">
|
90
|
-
<xsl:copy-of select="f:multiarg('abc', 'xyz')"/>
|
91
|
-
<xsl:copy-of select="f:numericarg(42)"/>
|
92
|
-
</xsl:template>
|
93
|
-
</xsl:stylesheet>
|
94
|
-
EOXSL
|
95
|
-
|
96
|
-
xsl.transform @xml
|
97
|
-
end
|
98
|
-
|
99
|
-
|
100
|
-
def test_function_XSLT
|
101
|
-
skip("Pure Java version doesn't support this feature.") if !Nokogiri.uses_libxml?
|
102
|
-
foo = Class.new do
|
103
|
-
def america nodes
|
104
|
-
nodes.first.content.upcase
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
xsl = Nokogiri.XSLT(<<-EOXSL, "http://e.org/functions" => foo)
|
109
|
-
<?xml version="1.0"?>
|
110
|
-
<xsl:stylesheet version="1.0"
|
111
|
-
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
112
|
-
xmlns:f="http://e.org/functions"
|
113
|
-
extension-element-prefixes="f">
|
114
|
-
|
115
|
-
<xsl:template match="text()">
|
116
|
-
<xsl:copy-of select="f:america(.)"/>
|
117
|
-
</xsl:template>
|
118
|
-
|
119
|
-
<xsl:template match="@*|node()">
|
120
|
-
<xsl:copy>
|
121
|
-
<xsl:apply-templates select="@*|node()"/>
|
122
|
-
<xsl:apply-imports/>
|
123
|
-
</xsl:copy>
|
124
|
-
</xsl:template>
|
125
|
-
|
126
|
-
</xsl:stylesheet>
|
127
|
-
EOXSL
|
128
|
-
result = xsl.transform @xml
|
129
|
-
assert_match(/FOO/, result.css('title').first.text)
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
module Nokogiri
|
4
|
-
module XSLT
|
5
|
-
class TestExceptionHandling < Nokogiri::TestCase
|
6
|
-
def test_java_exception_handling
|
7
|
-
skip('This test is for Java only') if Nokogiri.uses_libxml?
|
8
|
-
|
9
|
-
xml = Nokogiri.XML(<<-EOXML)
|
10
|
-
<foo>
|
11
|
-
<bar/>
|
12
|
-
</foo>
|
13
|
-
EOXML
|
14
|
-
|
15
|
-
xsl = Nokogiri.XSLT(<<-EOXSL)
|
16
|
-
<?xml version="1.0"?>
|
17
|
-
<xsl:stylesheet version="1.0"
|
18
|
-
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
19
|
-
|
20
|
-
<xsl:template match="/">
|
21
|
-
<a/>
|
22
|
-
<b/>
|
23
|
-
</xsl:template>
|
24
|
-
</xsl:stylesheet>
|
25
|
-
EOXSL
|
26
|
-
|
27
|
-
begin
|
28
|
-
xsl.transform xml
|
29
|
-
fail('It should not get here')
|
30
|
-
rescue RuntimeError => e
|
31
|
-
assert_match(/Can't have more than one root/, e.to_s, 'The exception message does not contain the expected information')
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|