nokogiri 1.5.5.rc1-java → 1.5.5.rc2-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.

data/CHANGELOG.ja.rdoc CHANGED
@@ -6,6 +6,14 @@
6
6
 
7
7
  * JRuby Nokogiri の add_previous_sibling が以前は動いていたのに今は動かない(1.5.0 -> 1.5.1)。 #691 (ありがとう, John Shahid!)
8
8
  * JRuby バーションは URL が引数にあたえられると HTML ドキュメントを作れない。 #674 (ありがとう, John Shahid!)
9
+ * JRuby バージョンは HTMLとして nil か "" が与えられると NullPointerException を投げる。 #699
10
+ * JRuby 1.9 モードでエラー, uncaught throw 'encoding_found', が発生する。 #673
11
+ * JRuby で US-ASCII にエンコードされた文字列が正しくないエンコードを返してくる。 #583
12
+ * 512 文字以上が与えられたときに XmlSaxPushParser が IndexOutOfBoundsException を投げる。#567, #615
13
+ * Xpath を評価した結果、空の NodeSet が帰ってくる場合に、NodeSet が持っている Document の decorate に失敗して例外が投げられる。#514
14
+ * JRuby で xpath を namespace 付きで指定した場合に、エラーが発生する。pull request #681 (ありがとう, Piotr Szmielew)
15
+ * JRuby で Nokogiri::XML::Node を継承したクラスを定義すると、namespace が表示されない。 #695
16
+ * JRuby で RDF::RDFXML::Writer をインスタンス化しようとすると NAMESPACE_ERR (org.w3c.dom.DOMException) が発生する. #683
9
17
 
10
18
 
11
19
  == 1.5.4 / 2012年6月12日
data/CHANGELOG.rdoc CHANGED
@@ -4,8 +4,16 @@
4
4
 
5
5
  * Bugfixes
6
6
 
7
- * Regression in JRuby Nokogiri add_previous_sibling (1.5.0 -> 1.5.1) #691 (Thanks, Shahid!)
8
- * JRuby unable to create HTML doc if URL arg provided #674 (Thanks, Shahid!)
7
+ * Regression in JRuby Nokogiri add_previous_sibling (1.5.0 -> 1.5.1) #691 (Thanks, John Shahid!)
8
+ * JRuby unable to create HTML doc if URL arg provided #674 (Thanks, John Shahid!)
9
+ * JRuby raises NullPointerException when given HTML document is nil or empty string. #699
10
+ * JRuby 1.9 error, uncaught throw 'encoding_found', has been fixed. #673
11
+ * Invalid encoding returned in JRuby with US-ASCII. #583
12
+ * XmlSaxPushParser raises IndexOutOfBoundsException when over 512 characters are given. #567, #615
13
+ * When xpath evaluation returns empty NodeSet, decorating NodeSet's base document raises exception. #514
14
+ * JRuby raises exception when xpath with namespace is specified. pull request #681 (Thanks, Piotr Szmielew)
15
+ * JRuby renders nodes without their namespace when subclassing Node. #695
16
+ * JRuby raises NAMESPACE_ERR (org.w3c.dom.DOMException) while instantiating RDF::RDFXML::Writer. #683
9
17
 
10
18
 
11
19
  == 1.5.4 / 2012-06-12
data/Rakefile CHANGED
@@ -34,8 +34,8 @@ HOE = Hoe.spec 'nokogiri' do
34
34
  'nokogiri.gemspec',
35
35
  'lib/nokogiri/nokogiri.{bundle,jar,rb,so}',
36
36
  'lib/nokogiri/1.{8,9}',
37
- GENERATED_PARSER,
38
- GENERATED_TOKENIZER
37
+ # GENERATED_PARSER,
38
+ # GENERATED_TOKENIZER
39
39
  ]
40
40
 
41
41
  self.extra_dev_deps += [
@@ -45,11 +45,15 @@ HOE = Hoe.spec 'nokogiri' do
45
45
  ["hoe-git", ">= 1.4"],
46
46
  ["mini_portile", ">= 0.2.2"],
47
47
  ["minitest", "~> 2.2.2"],
48
- ["racc", ">= 1.4.6"],
49
48
  ["rake", ">= 0.9"],
50
- ["rake-compiler", "= 0.8.0"],
51
- ["rexical", ">= 1.0.5"],
49
+ ["rake-compiler", "= 0.8.0"]
52
50
  ]
51
+ if ! java?
52
+ self.extra_dev_deps += [
53
+ ["racc", ">= 1.4.6"],
54
+ ["rexical", ">= 1.0.5"]
55
+ ]
56
+ end
53
57
 
54
58
  if java?
55
59
  self.spec_extras = { :platform => 'java' }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * (The MIT License)
3
3
  *
4
- * Copyright (c) 2008 - 2011:
4
+ * Copyright (c) 2008 - 2012:
5
5
  *
6
6
  * * {Aaron Patterson}[http://tenderlovemaking.com]
7
7
  * * {Mike Dalessio}[http://mike.daless.io]
@@ -80,24 +80,6 @@ public class XmlElement extends XmlNode {
80
80
  }
81
81
  }
82
82
 
83
- @Override
84
- @JRubyMethod(name = {"add_namespace_definition", "add_namespace"})
85
- public IRubyObject add_namespace_definition(ThreadContext context,
86
- IRubyObject prefix,
87
- IRubyObject href) {
88
- Element element = (Element) node;
89
-
90
- final String uri = "http://www.w3.org/2000/xmlns/";
91
- String qName =
92
- prefix.isNil() ? "xmlns" : "xmlns:" + rubyStringToString(prefix);
93
- element.setAttributeNS(uri, qName, rubyStringToString(href));
94
-
95
- XmlNamespace ns = (XmlNamespace) super.add_namespace_definition(context, prefix, href);
96
- updateNodeNamespaceIfNecessary(context, ns);
97
-
98
- return ns;
99
- }
100
-
101
83
  @Override
102
84
  public boolean isElement() { return true; }
103
85
 
@@ -323,7 +323,15 @@ public class XmlNode extends RubyObject {
323
323
  throw getRuntime().newArgumentError("node must have owner document");
324
324
  }
325
325
 
326
- Element element = document.createElementNS(null, rubyStringToString(name));
326
+ Element element = null;
327
+ String node_name = rubyStringToString(name);
328
+ try {
329
+ element = document.createElementNS(null, node_name);
330
+ } catch (org.w3c.dom.DOMException e) {
331
+ // issue#683 NAMESPACE_ERR is thrown from RDF::RDFXML::Writer.new
332
+ // retry without namespace
333
+ element = document.createElement(node_name);
334
+ }
327
335
  setNode(context, element);
328
336
  }
329
337
 
@@ -524,7 +532,15 @@ public class XmlNode extends RubyObject {
524
532
  IRubyObject prefix,
525
533
  IRubyObject href) {
526
534
  Node namespaceOwner;
527
- if (node.getNodeType() == Node.ELEMENT_NODE) namespaceOwner = node;
535
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
536
+ namespaceOwner = node;
537
+ Element element = (Element) node;
538
+
539
+ final String uri = "http://www.w3.org/2000/xmlns/";
540
+ String qName =
541
+ prefix.isNil() ? "xmlns" : "xmlns:" + rubyStringToString(prefix);
542
+ element.setAttributeNS(uri, qName, rubyStringToString(href));
543
+ }
528
544
  else if (node.getNodeType() == Node.ATTRIBUTE_NODE) namespaceOwner = ((Attr)node).getOwnerElement();
529
545
  else namespaceOwner = node.getParentNode();
530
546
  XmlNamespace ns = XmlNamespace.createFromPrefixAndHref(namespaceOwner, prefix, href);
@@ -763,7 +779,12 @@ public class XmlNode extends RubyObject {
763
779
  String textContent;
764
780
  if (content != null) textContent = rubyStringToString(content);
765
781
  else if (this instanceof XmlDocument) {
766
- textContent = ((Document)this.node).getDocumentElement().getTextContent().trim();
782
+ Node node = ((Document)this.node).getDocumentElement();
783
+ if (node == null) {
784
+ textContent = "";
785
+ } else {
786
+ textContent = ((Document)this.node).getDocumentElement().getTextContent().trim();
787
+ }
767
788
  } else {
768
789
  textContent = this.node.getTextContent();
769
790
  }
@@ -93,7 +93,7 @@ public class XmlNodeSet extends RubyObject implements NodeList {
93
93
  setNodes(nodeListToRubyArray(getRuntime(), nodeList));
94
94
  }
95
95
 
96
- private void initialize(Ruby ruby, IRubyObject refNode) {
96
+ public void initialize(Ruby ruby, IRubyObject refNode) {
97
97
  if (refNode instanceof XmlNode) {
98
98
  XmlNode n = (XmlNode)refNode;
99
99
  doc = n.document(ruby.getCurrentContext());
@@ -94,16 +94,16 @@ public class XmlXpathContext extends RubyObject {
94
94
  }
95
95
 
96
96
  @JRubyMethod(name = "new", meta = true)
97
- public static IRubyObject rbNew(ThreadContext context, IRubyObject klazz, IRubyObject node) {
97
+ public static IRubyObject rbNew(ThreadContext thread_context, IRubyObject klazz, IRubyObject node) {
98
98
  XmlNode xmlNode = (XmlNode)node;
99
- XmlXpathContext xmlXpathContext = (XmlXpathContext) NokogiriService.XML_XPATHCONTEXT_ALLOCATOR.allocate(context.getRuntime(), (RubyClass)klazz);
99
+ XmlXpathContext xmlXpathContext = (XmlXpathContext) NokogiriService.XML_XPATHCONTEXT_ALLOCATOR.allocate(thread_context.getRuntime(), (RubyClass)klazz);
100
100
  xmlXpathContext.xpath = XPathFactory.newInstance().newXPath();
101
101
  xmlXpathContext.setNode(xmlNode);
102
102
  return xmlXpathContext;
103
103
  }
104
104
 
105
105
  @JRubyMethod
106
- public IRubyObject evaluate(ThreadContext context, IRubyObject expr, IRubyObject handler) {
106
+ public IRubyObject evaluate(ThreadContext thread_context, IRubyObject expr, IRubyObject handler) {
107
107
  String src = (String) expr.toJava(String.class);
108
108
  try {
109
109
  if(!handler.isNil()) {
@@ -116,7 +116,7 @@ public class XmlXpathContext extends RubyObject {
116
116
  xpath.setXPathFunctionResolver(NokogiriXPathFunctionResolver.create(handler));
117
117
  }
118
118
  XPathExpression xpathExpression = xpath.compile(src);
119
- return node_set(context, xpathExpression);
119
+ return node_set(thread_context, xpathExpression);
120
120
  } catch (XPathExpressionException xpee) {
121
121
  xpee = new XPathExpressionException(src);
122
122
  RubyException e = XmlSyntaxError.createXPathSyntaxError(getRuntime(), xpee);
@@ -124,10 +124,10 @@ public class XmlXpathContext extends RubyObject {
124
124
  }
125
125
  }
126
126
 
127
- protected IRubyObject node_set(ThreadContext rbctx, XPathExpression xpathExpression) {
127
+ protected IRubyObject node_set(ThreadContext thread_context, XPathExpression xpathExpression) {
128
128
  XmlNodeSet result = null;
129
129
  try {
130
- result = tryGetNodeSet(xpathExpression);
130
+ result = tryGetNodeSet(thread_context, xpathExpression);
131
131
  return result;
132
132
  } catch (XPathExpressionException xpee) {
133
133
  try {
@@ -139,10 +139,11 @@ public class XmlXpathContext extends RubyObject {
139
139
  }
140
140
  }
141
141
 
142
- private XmlNodeSet tryGetNodeSet(XPathExpression xpathExpression) throws XPathExpressionException {
142
+ private XmlNodeSet tryGetNodeSet(ThreadContext thread_context, XPathExpression xpathExpression) throws XPathExpressionException {
143
143
  NodeList nodeList = (NodeList)xpathExpression.evaluate(context.node, XPathConstants.NODESET);
144
144
  XmlNodeSet xmlNodeSet = (XmlNodeSet) NokogiriService.XML_NODESET_ALLOCATOR.allocate(getRuntime(), getNokogiriClass(getRuntime(), "Nokogiri::XML::NodeSet"));
145
145
  xmlNodeSet.setNodeList(nodeList);
146
+ xmlNodeSet.initialize(thread_context.getRuntime(), context);
146
147
  return xmlNodeSet;
147
148
  }
148
149
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * (The MIT License)
3
3
  *
4
- * Copyright (c) 2008 - 2011:
4
+ * Copyright (c) 2008 - 2012:
5
5
  *
6
6
  * * {Aaron Patterson}[http://tenderlovemaking.com]
7
7
  * * {Mike Dalessio}[http://mike.daless.io]
@@ -32,7 +32,6 @@
32
32
 
33
33
  package nokogiri.internals;
34
34
 
35
- import static nokogiri.internals.NokogiriHelpers.getNokogiriClass;
36
35
  import static nokogiri.internals.NokogiriHelpers.isNamespace;
37
36
 
38
37
  import java.util.ArrayList;
@@ -40,11 +39,8 @@ import java.util.LinkedHashMap;
40
39
  import java.util.List;
41
40
  import java.util.Map;
42
41
 
43
- import nokogiri.NokogiriService;
44
- import nokogiri.XmlDocument;
45
42
  import nokogiri.XmlNamespace;
46
43
 
47
- import org.jruby.Ruby;
48
44
  import org.w3c.dom.Attr;
49
45
  import org.w3c.dom.NamedNodeMap;
50
46
  import org.w3c.dom.Node;
@@ -14,100 +14,96 @@ module Nokogiri
14
14
  ##### State transition tables begin ###
15
15
 
16
16
  racc_action_table = [
17
- 6, 62, 7, 63, 14, 19, 23, 26, 20, 2,
18
- 71, 14, 6, 63, 85, 17, 14, 22, 25, 28,
19
- 83, 2, 7, 72, 11, 13, 15, -26, 20, 7,
20
- 49, 28, 13, 70, 7, 20, 11, 13, 15, 6,
21
- 20, 64, 65, 14, 19, 23, 26, 64, 2, 36,
22
- 59, 6, 60, 67, 17, 14, 22, 25, 28, 90,
23
- 2, 7, 6, 11, 13, 15, 14, 20, 66, 67,
24
- 28, 2, 91, 7, 14, 11, 13, 15, 14, 20,
25
- 69, 28, 6, 2, 7, 68, 11, 13, 15, 14,
26
- 20, 37, 7, 39, 94, 13, 7, 14, 20, 13,
27
- 15, 28, 20, 6, 49, 14, 11, 7, 36, 59,
28
- 13, 60, 53, 20, 14, 7, 36, 59, 13, 60,
29
- 95, 20, 28, 7, 101, 100, 13, 11, 49, 20,
30
- 74, 76, 7, 36, 31, 13, 33, 50, 20, 74,
31
- 76, 75, 77, 79, 98, 80, 32, 99, 42, 73,
32
- 75, 77, 79, 102, 80, 19, 23, 26, 73, 36,
33
- 59, -26, 60, 104, 105, 17, nil, 22, 25 ]
17
+ 21, 4, 5, 7, 29, 4, 5, 7, 30, 19,
18
+ -26, 6, 21, 9, 8, 6, 29, 9, 8, 22,
19
+ 31, 19, 20, 21, 23, 15, 17, 29, 24, 83,
20
+ 31, 22, 19, 84, 20, 21, 23, 15, 17, 29,
21
+ 24, 92, 22, 85, 19, 20, 21, 23, 15, 17,
22
+ 20, 24, 82, 90, 22, 59, 24, 20, 89, 23,
23
+ 15, 17, 21, 24, 88, 22, 29, 4, 5, 7,
24
+ 23, 19, 71, 29, 91, 29, 86, 6, 19, 9,
25
+ 8, 22, 29, 29, 20, 89, 23, 15, 17, 35,
26
+ 24, 20, 29, 20, 15, 17, 15, 24, 35, 24,
27
+ 20, 20, 29, 15, 15, 93, 24, 24, 21, 64,
28
+ 20, 95, 29, 15, 97, 96, 24, 43, -26, 46,
29
+ 20, 52, 53, 15, 51, 98, 24, 22, 79, 80,
30
+ 20, 99, 23, 15, 48, 42, 24, 79, 80, 75,
31
+ 76, 77, 101, 78, 87, 86, 41, 74, 75, 76,
32
+ 77, 35, 78, 104, 52, 56, 74, 55, 52, 56,
33
+ 105, 55, 52, 56, nil, 55, 52, 56, nil, 55 ]
34
34
 
35
35
  racc_action_check = [
36
- 0, 29, 21, 45, 0, 0, 0, 0, 21, 0,
37
- 38, 24, 63, 29, 45, 0, 63, 0, 0, 0,
38
- 42, 63, 0, 39, 0, 0, 0, 37, 0, 24,
39
- 47, 63, 24, 36, 63, 24, 63, 63, 63, 11,
40
- 63, 59, 31, 11, 11, 11, 11, 31, 11, 70,
41
- 70, 9, 70, 60, 11, 9, 11, 11, 11, 61,
42
- 9, 11, 44, 11, 11, 11, 44, 11, 33, 33,
43
- 9, 44, 62, 9, 87, 9, 9, 9, 49, 9,
44
- 35, 44, 7, 49, 44, 34, 44, 44, 44, 12,
45
- 44, 7, 87, 7, 65, 87, 49, 27, 87, 49,
46
- 49, 7, 49, 20, 12, 18, 7, 12, 64, 64,
47
- 12, 64, 20, 12, 1, 27, 28, 28, 27, 28,
48
- 66, 27, 20, 18, 81, 81, 18, 20, 16, 18,
49
- 41, 41, 1, 6, 6, 1, 6, 13, 1, 40,
50
- 40, 41, 41, 41, 71, 41, 6, 78, 8, 41,
51
- 40, 40, 40, 82, 40, 10, 10, 10, 40, 67,
52
- 67, 2, 67, 89, 95, 10, nil, 10, 10 ]
36
+ 0, 14, 14, 14, 0, 0, 0, 0, 1, 0,
37
+ 43, 14, 40, 14, 14, 0, 40, 0, 0, 0,
38
+ 1, 40, 0, 31, 0, 0, 0, 31, 0, 47,
39
+ 57, 40, 31, 49, 40, 13, 40, 40, 40, 13,
40
+ 40, 57, 31, 50, 13, 31, 24, 31, 31, 31,
41
+ 11, 31, 46, 53, 13, 24, 11, 13, 53, 13,
42
+ 13, 13, 23, 13, 52, 24, 23, 23, 23, 23,
43
+ 24, 23, 42, 35, 54, 28, 55, 23, 35, 23,
44
+ 23, 23, 27, 10, 23, 56, 23, 23, 23, 33,
45
+ 23, 35, 26, 28, 35, 35, 28, 35, 10, 28,
46
+ 27, 10, 25, 27, 10, 67, 27, 10, 20, 30,
47
+ 26, 72, 68, 26, 73, 73, 26, 20, 19, 20,
48
+ 25, 21, 21, 25, 21, 81, 25, 20, 45, 45,
49
+ 68, 83, 20, 68, 21, 18, 68, 44, 44, 45,
50
+ 45, 45, 87, 45, 51, 51, 15, 45, 44, 44,
51
+ 44, 12, 44, 90, 89, 89, 44, 89, 86, 86,
52
+ 101, 86, 88, 88, nil, 88, 22, 22, nil, 22 ]
53
53
 
54
54
  racc_action_pointer = [
55
- -2, 108, 132, nil, nil, nil, 123, 80, 119, 49,
56
- 148, 37, 83, 126, nil, nil, 107, nil, 99, nil,
57
- 101, -22, nil, nil, 5, nil, nil, 91, 106, 1,
58
- nil, 35, nil, 57, 62, 57, 21, -2, -19, -2,
59
- 136, 127, 9, nil, 60, -9, nil, 9, nil, 72,
60
- nil, nil, nil, nil, nil, nil, nil, nil, nil, 29,
61
- 41, 36, 72, 10, 98, 81, 113, 149, nil, nil,
62
- 39, 133, nil, nil, nil, nil, nil, nil, 122, nil,
63
- nil, 114, 128, nil, nil, nil, nil, 68, nil, 140,
64
- nil, nil, nil, nil, nil, 151, nil, nil, nil, nil,
65
- nil, nil, nil, nil, nil, nil ]
55
+ -2, 8, nil, nil, nil, nil, nil, nil, nil, nil,
56
+ 77, 26, 130, 33, -6, 135, nil, nil, 106, 89,
57
+ 106, 111, 156, 60, 44, 96, 86, 76, 69, nil,
58
+ 109, 21, nil, 68, nil, 67, nil, nil, nil, nil,
59
+ 10, nil, 61, -19, 134, 125, 27, 0, nil, 10,
60
+ 20, 133, 52, 46, 51, 64, 73, 18, nil, nil,
61
+ nil, nil, nil, nil, nil, nil, nil, 82, 106, nil,
62
+ nil, nil, 86, 104, nil, nil, nil, nil, nil, nil,
63
+ nil, 100, nil, 120, nil, nil, 148, 135, 152, 144,
64
+ 140, nil, nil, nil, nil, nil, nil, nil, nil, nil,
65
+ nil, 147, nil, nil, nil, nil ]
66
66
 
67
67
  racc_action_default = [
68
- -27, -56, -25, -3, -22, -2, -74, -27, -74, -27,
69
- -20, -27, -50, -74, -59, -23, -17, -6, -55, -4,
70
- -74, -13, -9, -5, -58, -8, -7, -57, -74, -74,
71
- -52, -43, -33, -41, -74, -74, -42, -32, -74, -74,
72
- -62, -62, -74, -18, -27, -74, -10, -49, -12, -27,
73
- -21, -16, -51, -48, -47, -14, -15, -54, -53, -43,
74
- -41, -74, -74, -27, -74, -74, -46, -74, -34, -35,
75
- -74, -74, -30, -63, -68, -64, -69, -65, -74, -66,
76
- -67, -74, -74, -24, -19, -37, -11, -71, -73, -74,
77
- -36, 106, -1, -40, -45, -74, -38, -39, -31, -28,
78
- -60, -61, -29, -72, -70, -44 ]
68
+ -27, -74, -2, -3, -4, -5, -6, -7, -8, -9,
69
+ -50, -13, -17, -27, -20, -74, -22, -23, -74, -25,
70
+ -27, -74, -74, -27, -74, -55, -56, -57, -58, -59,
71
+ -74, -27, -10, -49, -12, -27, -14, -15, -16, -18,
72
+ -27, -21, -74, -32, -62, -62, -74, -74, -33, -74,
73
+ -74, -41, -42, -43, -74, -41, -43, -74, -47, -48,
74
+ -51, -52, -53, -54, 106, -1, -11, -74, -71, -73,
75
+ -19, -24, -74, -74, -63, -64, -65, -66, -67, -68,
76
+ -69, -74, -30, -74, -34, -35, -74, -46, -74, -74,
77
+ -74, -36, -37, -70, -72, -28, -60, -61, -29, -31,
78
+ -38, -74, -39, -40, -45, -44 ]
79
79
 
80
80
  racc_goto_table = [
81
- 30, 43, 34, 48, 29, 41, 55, 51, 78, 82,
82
- 46, 47, 56, 38, 40, 45, 87, 52, 54, 44,
83
- 35, 89, nil, 57, 61, nil, 58, nil, nil, nil,
84
- nil, nil, nil, nil, nil, nil, 84, nil, 86, nil,
85
- nil, nil, nil, nil, nil, nil, nil, nil, 88, nil,
86
- nil, nil, nil, nil, nil, 92, nil, nil, nil, nil,
87
- 93, nil, nil, 96, nil, nil, 97, nil, nil, nil,
81
+ 49, 54, 33, 39, 36, 1, 34, 45, 38, 72,
82
+ 81, 58, 32, 37, 47, 44, 68, 60, 61, 62,
83
+ 63, 65, 40, 50, 67, nil, nil, 69, 57, 66,
84
+ 70, nil, nil, nil, nil, nil, nil, nil, nil, nil,
88
85
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
89
- nil, nil, nil, nil, nil, nil, 103 ]
86
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
87
+ 94, nil, nil, nil, nil, 100, nil, 102, 103 ]
90
88
 
91
89
  racc_goto_check = [
92
- 8, 2, 18, 9, 1, 10, 11, 9, 17, 17,
93
- 7, 8, 12, 15, 16, 1, 6, 8, 10, 4,
94
- 19, 22, nil, 8, 18, nil, 8, nil, nil, nil,
95
- nil, nil, nil, nil, nil, nil, 2, nil, 9, nil,
96
- nil, nil, nil, nil, nil, nil, nil, nil, 8, nil,
97
- nil, nil, nil, nil, nil, 2, nil, nil, nil, nil,
98
- 18, nil, nil, 18, nil, nil, 18, nil, nil, nil,
90
+ 18, 18, 8, 2, 11, 1, 9, 10, 9, 17,
91
+ 17, 10, 7, 12, 15, 16, 6, 8, 8, 8,
92
+ 8, 2, 4, 19, 22, nil, nil, 8, 1, 9,
93
+ 2, nil, nil, nil, nil, nil, nil, nil, nil, nil,
94
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
99
95
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
100
- nil, nil, nil, nil, nil, nil, 8 ]
96
+ 8, nil, nil, nil, nil, 18, nil, 18, 18 ]
101
97
 
102
98
  racc_goto_pointer = [
103
- nil, 4, -8, nil, 9, nil, -33, -2, -1, -9,
104
- -2, -15, -9, nil, nil, 6, 7, -32, -4, 14,
105
- nil, nil, -28 ]
99
+ nil, 5, -10, nil, 8, nil, -19, 2, -8, -4,
100
+ -13, -7, 2, nil, nil, -6, -5, -35, -21, 2,
101
+ nil, nil, -11 ]
106
102
 
107
103
  racc_goto_default = [
108
- nil, nil, 3, 5, 9, 10, 12, nil, 16, nil,
109
- 21, 24, 27, 1, 4, 8, nil, nil, nil, nil,
110
- 18, 81, nil ]
104
+ nil, nil, 3, 2, 13, 14, 10, nil, 12, nil,
105
+ 11, 28, 27, 26, 16, 18, nil, nil, nil, nil,
106
+ 25, 73, nil ]
111
107
 
112
108
  racc_reduce_table = [
113
109
  0, 0, :racc_error,
@@ -180,7 +180,7 @@ module Nokogiri
180
180
  m = chunk.match(/(<meta\s)(.*)(charset\s*=\s*([\w-]+))(.*)/i) and
181
181
  return m[4]
182
182
  catch(:encoding_found) {
183
- Nokogiri::HTML::SAX::Parser.new(JumpSAXHandler.new(:encoding_found.to_s)).parse(chunk)
183
+ Nokogiri::HTML::SAX::Parser.new(JumpSAXHandler.new(:encoding_found)).parse(chunk)
184
184
  nil
185
185
  }
186
186
  else
Binary file
@@ -1,6 +1,6 @@
1
1
  module Nokogiri
2
2
  # The version of Nokogiri you are using
3
- VERSION = '1.5.5.rc1'
3
+ VERSION = '1.5.5.rc2'
4
4
 
5
5
  class VersionInfo # :nodoc:
6
6
  def jruby?
@@ -150,7 +150,7 @@ module Nokogiri
150
150
  sets = paths.map { |path|
151
151
  ctx = XPathContext.new(self)
152
152
  ctx.register_namespaces(ns)
153
- path = path.gsub(/\/xmlns:/,'/:') unless Nokogiri.uses_libxml?
153
+ path = path.gsub(/xmlns:/, ' :') unless Nokogiri.uses_libxml?
154
154
 
155
155
  binds.each do |key,value|
156
156
  ctx.register_variable key.to_s, value
@@ -517,6 +517,12 @@ eohtml
517
517
  assert @html.serialize
518
518
  assert @html.to_html
519
519
  end
520
+
521
+ def test_empty_document
522
+ # empty document should return "" #699
523
+ assert_equal "", Nokogiri::HTML.parse(nil).text
524
+ assert_equal "", Nokogiri::HTML.parse("").text
525
+ end
520
526
  end
521
527
  end
522
528
  end
@@ -263,6 +263,33 @@ module Nokogiri
263
263
  }.new)
264
264
  assert_equal foo, doc.xpath("//foo")
265
265
  end
266
+
267
+ def test_node_set_should_be_decorated
268
+ # "called decorate on nill" exception in JRuby issue#514
269
+ process_output= <<END
270
+ <test>
271
+ <track type="Image">
272
+ <Format>LZ77</Format>
273
+ </test>
274
+ END
275
+ doc = Nokogiri::XML.parse(process_output)
276
+ node = doc.xpath(%{//track[@type='Video']})
277
+ assert_equal "[]", node.xpath("Format").inspect
278
+ end
279
+
280
+ def test_very_specific_xml_xpath_making_problems_in_jruby
281
+ # manually merges pull request #681
282
+ xml_string = %q{<?xml version="1.0" encoding="UTF-8"?>
283
+ <ONIXMessage xmlns:elibri="http://elibri.com.pl/ns/extensions" release="3.0" xmlns="http://www.editeur.org/onix/3.0/reference">
284
+ <Product>
285
+ <RecordReference>a</RecordReference>
286
+ </Product>
287
+ </ONIXMessage>}
288
+
289
+ xml_doc = Nokogiri::XML(xml_string)
290
+ onix = xml_doc.children.first
291
+ assert_equal 'a', onix.at_xpath('xmlns:Product').at_xpath('xmlns:RecordReference').text
292
+ end
266
293
  end
267
294
  end
268
295
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: nokogiri
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 1.5.5.rc1
5
+ version: 1.5.5.rc2
6
6
  platform: java
7
7
  authors:
8
8
  - Aaron Patterson
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2012-06-12 00:00:00 Z
16
+ date: 2012-06-14 00:00:00 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: hoe-bundler
@@ -81,70 +81,48 @@ dependencies:
81
81
  requirement: *id006
82
82
  prerelease: false
83
83
  type: :development
84
- - !ruby/object:Gem::Dependency
85
- name: racc
86
- version_requirements: &id007 !ruby/object:Gem::Requirement
87
- none: false
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- version: 1.4.6
92
- requirement: *id007
93
- prerelease: false
94
- type: :development
95
84
  - !ruby/object:Gem::Dependency
96
85
  name: rake
97
- version_requirements: &id008 !ruby/object:Gem::Requirement
86
+ version_requirements: &id007 !ruby/object:Gem::Requirement
98
87
  none: false
99
88
  requirements:
100
89
  - - ">="
101
90
  - !ruby/object:Gem::Version
102
91
  version: "0.9"
103
- requirement: *id008
92
+ requirement: *id007
104
93
  prerelease: false
105
94
  type: :development
106
95
  - !ruby/object:Gem::Dependency
107
96
  name: rake-compiler
108
- version_requirements: &id009 !ruby/object:Gem::Requirement
97
+ version_requirements: &id008 !ruby/object:Gem::Requirement
109
98
  none: false
110
99
  requirements:
111
100
  - - "="
112
101
  - !ruby/object:Gem::Version
113
102
  version: 0.8.0
114
- requirement: *id009
115
- prerelease: false
116
- type: :development
117
- - !ruby/object:Gem::Dependency
118
- name: rexical
119
- version_requirements: &id010 !ruby/object:Gem::Requirement
120
- none: false
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: 1.0.5
125
- requirement: *id010
103
+ requirement: *id008
126
104
  prerelease: false
127
105
  type: :development
128
106
  - !ruby/object:Gem::Dependency
129
107
  name: rdoc
130
- version_requirements: &id011 !ruby/object:Gem::Requirement
108
+ version_requirements: &id009 !ruby/object:Gem::Requirement
131
109
  none: false
132
110
  requirements:
133
111
  - - ~>
134
112
  - !ruby/object:Gem::Version
135
113
  version: "3.10"
136
- requirement: *id011
114
+ requirement: *id009
137
115
  prerelease: false
138
116
  type: :development
139
117
  - !ruby/object:Gem::Dependency
140
118
  name: hoe
141
- version_requirements: &id012 !ruby/object:Gem::Requirement
119
+ version_requirements: &id010 !ruby/object:Gem::Requirement
142
120
  none: false
143
121
  requirements:
144
122
  - - ~>
145
123
  - !ruby/object:Gem::Version
146
124
  version: "2.16"
147
- requirement: *id012
125
+ requirement: *id010
148
126
  prerelease: false
149
127
  type: :development
150
128
  description: "Nokogiri (\xE9\x8B\xB8) is an HTML, XML, SAX, and Reader parser. Among Nokogiri's\n\