nokogiri 1.6.5-java → 1.6.6.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/.cross_rubies +5 -0
- data/.travis.yml +10 -20
- data/CHANGELOG.ja.rdoc +28 -1
- data/CHANGELOG.rdoc +28 -1
- data/Gemfile +1 -1
- data/Manifest.txt +5 -1
- data/README.ja.rdoc +10 -9
- data/README.rdoc +6 -9
- data/ROADMAP.md +15 -3
- data/Rakefile +1 -3
- data/bin/nokogiri +48 -8
- data/ext/java/nokogiri/HtmlSaxParserContext.java +1 -1
- data/ext/java/nokogiri/HtmlSaxPushParser.java +244 -0
- data/ext/java/nokogiri/NokogiriService.java +9 -0
- data/ext/java/nokogiri/XmlComment.java +2 -0
- data/ext/java/nokogiri/XmlNode.java +57 -30
- data/ext/java/nokogiri/XmlSyntaxError.java +11 -9
- data/ext/nokogiri/extconf.rb +18 -3
- data/ext/nokogiri/xml_comment.c +17 -2
- data/ext/nokogiri/xml_node.c +66 -6
- data/ext/nokogiri/xml_syntax_error.c +4 -0
- data/ext/nokogiri/xml_syntax_error.h +1 -0
- data/lib/nokogiri.rb +2 -2
- data/lib/nokogiri/decorators/slop.rb +7 -8
- data/lib/nokogiri/html/document_fragment.rb +0 -2
- data/lib/nokogiri/html/sax/push_parser.rb +22 -2
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/version.rb +1 -1
- data/lib/nokogiri/xml.rb +1 -0
- data/lib/nokogiri/xml/document.rb +4 -4
- data/lib/nokogiri/xml/document_fragment.rb +39 -2
- data/lib/nokogiri/xml/node.rb +11 -181
- data/lib/nokogiri/xml/node_set.rb +41 -85
- data/lib/nokogiri/xml/searchable.rb +221 -0
- data/ports/patches/sort-patches-by-date +25 -0
- data/test/css/test_nthiness.rb +1 -1
- data/test/html/sax/test_push_parser.rb +87 -0
- data/test/html/test_document.rb +20 -5
- data/test/html/test_document_fragment.rb +25 -0
- data/test/xml/test_attr.rb +5 -2
- data/test/xml/test_builder.rb +27 -1
- data/test/xml/test_comment.rb +11 -0
- data/test/xml/test_document.rb +34 -0
- data/test/xml/test_document_fragment.rb +40 -9
- data/test/xml/test_namespace.rb +1 -0
- data/test/xml/test_node.rb +37 -1
- data/test/xml/test_node_set.rb +56 -36
- data/test/xml/test_xpath.rb +65 -19
- data/test_all +11 -1
- metadata +12 -7
- data/tasks/nokogiri.org.rb +0 -24
@@ -228,6 +228,9 @@ public class NokogiriService implements BasicLibraryService {
|
|
228
228
|
RubyClass xmlSaxPushParser = xmlSaxModule.defineClassUnder("PushParser", ruby.getObject(), XML_SAXPUSHPARSER_ALLOCATOR);
|
229
229
|
xmlSaxPushParser.defineAnnotatedMethods(XmlSaxPushParser.class);
|
230
230
|
|
231
|
+
RubyClass htmlSaxPushParser = htmlSaxModule.defineClassUnder("PushParser", ruby.getObject(), HTML_SAXPUSHPARSER_ALLOCATOR);
|
232
|
+
htmlSaxPushParser.defineAnnotatedMethods(HtmlSaxPushParser.class);
|
233
|
+
|
231
234
|
RubyClass htmlSaxParserContext = htmlSaxModule.defineClassUnder("ParserContext", xmlSaxParserContext, HTML_SAXPARSER_CONTEXT_ALLOCATOR);
|
232
235
|
htmlSaxParserContext.defineAnnotatedMethods(HtmlSaxParserContext.class);
|
233
236
|
}
|
@@ -536,6 +539,12 @@ public class NokogiriService implements BasicLibraryService {
|
|
536
539
|
return new XmlSaxPushParser(runtime, klazz);
|
537
540
|
}
|
538
541
|
};
|
542
|
+
|
543
|
+
private static ObjectAllocator HTML_SAXPUSHPARSER_ALLOCATOR = new ObjectAllocator() {
|
544
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
545
|
+
return new HtmlSaxPushParser(runtime, klazz);
|
546
|
+
}
|
547
|
+
};
|
539
548
|
|
540
549
|
public static final ObjectAllocator XML_SCHEMA_ALLOCATOR = new ObjectAllocator() {
|
541
550
|
private XmlSchema xmlSchema = null;
|
@@ -76,6 +76,8 @@ public class XmlComment extends XmlNode {
|
|
76
76
|
} else if (doc instanceof XmlNode) {
|
77
77
|
XmlNode xmlNode = (XmlNode) doc;
|
78
78
|
xmlDoc = (XmlDocument)xmlNode.document(context);
|
79
|
+
} else {
|
80
|
+
throw getRuntime().newArgumentError("first argument must be a XML::Document or XML::Node");
|
79
81
|
}
|
80
82
|
if (xmlDoc != null) {
|
81
83
|
Document document = xmlDoc.getDocument();
|
@@ -590,7 +590,18 @@ public class XmlNode extends RubyObject {
|
|
590
590
|
IRubyObject prefix,
|
591
591
|
IRubyObject href) {
|
592
592
|
String prefixString = rubyStringToString(prefix);
|
593
|
-
String hrefString
|
593
|
+
String hrefString ;
|
594
|
+
|
595
|
+
// try to search the namespace first
|
596
|
+
if (href.isNil()) {
|
597
|
+
hrefString = this.findNamespaceHref(context, rubyStringToString(prefix));
|
598
|
+
if (hrefString == null) {
|
599
|
+
return context.nil;
|
600
|
+
}
|
601
|
+
href = context.getRuntime().newString(hrefString);
|
602
|
+
} else {
|
603
|
+
hrefString = rubyStringToString(href);
|
604
|
+
}
|
594
605
|
|
595
606
|
NokogiriNamespaceCache nsCache = NokogiriHelpers.getNamespaceCacheFormNode(node);
|
596
607
|
XmlNamespace cachedNamespace = nsCache.get(prefixString, hrefString);
|
@@ -1156,6 +1167,25 @@ public class XmlNode extends RubyObject {
|
|
1156
1167
|
return content;
|
1157
1168
|
}
|
1158
1169
|
|
1170
|
+
@JRubyMethod
|
1171
|
+
public IRubyObject lang(ThreadContext context) {
|
1172
|
+
IRubyObject currentObj = this ;
|
1173
|
+
while (!currentObj.isNil()) {
|
1174
|
+
XmlNode currentNode = asXmlNode(context, currentObj);
|
1175
|
+
IRubyObject lang = currentNode.getAttribute(context.getRuntime(), "xml:lang");
|
1176
|
+
if (!lang.isNil()) { return lang ; }
|
1177
|
+
|
1178
|
+
currentObj = currentNode.parent(context);
|
1179
|
+
}
|
1180
|
+
return context.nil ;
|
1181
|
+
}
|
1182
|
+
|
1183
|
+
@JRubyMethod(name = "lang=")
|
1184
|
+
public IRubyObject set_lang(ThreadContext context, IRubyObject lang) {
|
1185
|
+
setAttribute(context, "xml:lang", rubyStringToString(lang));
|
1186
|
+
return context.nil ;
|
1187
|
+
}
|
1188
|
+
|
1159
1189
|
/**
|
1160
1190
|
* @param args {IRubyObject io,
|
1161
1191
|
* IRubyObject encoding,
|
@@ -1236,33 +1266,35 @@ public class XmlNode extends RubyObject {
|
|
1236
1266
|
@JRubyMethod(visibility = Visibility.PRIVATE)
|
1237
1267
|
public IRubyObject set(ThreadContext context, IRubyObject rbkey, IRubyObject rbval) {
|
1238
1268
|
if (node instanceof Element) {
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1269
|
+
setAttribute(context, rubyStringToString(rbkey), rubyStringToString(rbval));
|
1270
|
+
return this;
|
1271
|
+
} else {
|
1272
|
+
return rbval;
|
1273
|
+
}
|
1274
|
+
}
|
1275
|
+
|
1276
|
+
private void setAttribute(ThreadContext context, String key, String val) {
|
1277
|
+
Element element = (Element) node;
|
1242
1278
|
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1279
|
+
String uri = null;
|
1280
|
+
int colonIndex = key.indexOf(":");
|
1281
|
+
if (colonIndex > 0) {
|
1282
|
+
String prefix = key.substring(0, colonIndex);
|
1283
|
+
if (prefix.equals("xml")) {
|
1248
1284
|
uri = "http://www.w3.org/XML/1998/namespace";
|
1249
|
-
|
1285
|
+
} else if (prefix.equals("xmlns")) {
|
1250
1286
|
uri = "http://www.w3.org/2000/xmlns/";
|
1251
|
-
|
1287
|
+
} else {
|
1252
1288
|
uri = findNamespaceHref(context, prefix);
|
1253
|
-
}
|
1254
1289
|
}
|
1290
|
+
}
|
1255
1291
|
|
1256
|
-
|
1257
|
-
|
1258
|
-
} else {
|
1259
|
-
element.setAttribute(key, val);
|
1260
|
-
}
|
1261
|
-
clearXpathContext(node);
|
1262
|
-
return this;
|
1292
|
+
if (uri != null) {
|
1293
|
+
element.setAttributeNS(uri, key, val);
|
1263
1294
|
} else {
|
1264
|
-
|
1295
|
+
element.setAttribute(key, val);
|
1265
1296
|
}
|
1297
|
+
clearXpathContext(node);
|
1266
1298
|
}
|
1267
1299
|
|
1268
1300
|
private String findNamespaceHref(ThreadContext context, String prefix) {
|
@@ -1309,16 +1341,6 @@ public class XmlNode extends RubyObject {
|
|
1309
1341
|
return RubyFixnum.newFixnum(context.getRuntime(), this.node.hashCode());
|
1310
1342
|
}
|
1311
1343
|
|
1312
|
-
@JRubyMethod(name = {"remove_attribute", "delete"})
|
1313
|
-
public IRubyObject remove_attribute(ThreadContext context, IRubyObject name) {
|
1314
|
-
if (node instanceof Element) {
|
1315
|
-
String key = name.convertToString().asJavaString();
|
1316
|
-
Element element = (Element) node;
|
1317
|
-
element.removeAttribute(key);
|
1318
|
-
}
|
1319
|
-
return this;
|
1320
|
-
}
|
1321
|
-
|
1322
1344
|
@JRubyMethod(visibility=Visibility.PRIVATE)
|
1323
1345
|
public IRubyObject set_namespace(ThreadContext context, IRubyObject namespace) {
|
1324
1346
|
if (namespace.isNil()) {
|
@@ -1685,4 +1707,9 @@ public class XmlNode extends RubyObject {
|
|
1685
1707
|
return this;
|
1686
1708
|
}
|
1687
1709
|
|
1710
|
+
@JRubyMethod(visibility=Visibility.PRIVATE)
|
1711
|
+
public IRubyObject clear_xpath_context(ThreadContext context) {
|
1712
|
+
clearXpathContext(getNode());
|
1713
|
+
return context.nil ;
|
1714
|
+
}
|
1688
1715
|
}
|
@@ -17,10 +17,10 @@
|
|
17
17
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
18
18
|
* permit persons to whom the Software is furnished to do so, subject to
|
19
19
|
* the following conditions:
|
20
|
-
*
|
20
|
+
*
|
21
21
|
* The above copyright notice and this permission notice shall be
|
22
22
|
* included in all copies or substantial portions of the Software.
|
23
|
-
*
|
23
|
+
*
|
24
24
|
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
25
25
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
26
26
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
@@ -58,7 +58,7 @@ public class XmlSyntaxError extends RubyException {
|
|
58
58
|
public XmlSyntaxError(Ruby runtime, RubyClass klazz) {
|
59
59
|
super(runtime, klazz);
|
60
60
|
}
|
61
|
-
|
61
|
+
|
62
62
|
/**
|
63
63
|
* Create and return a copy of this object.
|
64
64
|
*
|
@@ -93,13 +93,13 @@ public class XmlSyntaxError extends RubyException {
|
|
93
93
|
}
|
94
94
|
|
95
95
|
public static XmlSyntaxError createNokogiriXmlSyntaxError(Ruby runtime) {
|
96
|
-
|
96
|
+
return (XmlSyntaxError) NokogiriService.XML_SYNTAXERROR_ALLOCATOR.allocate(runtime, getNokogiriClass(runtime, "Nokogiri::XML::SyntaxError"));
|
97
97
|
}
|
98
98
|
|
99
99
|
public void setException(Exception exception) {
|
100
100
|
this.exception = exception;
|
101
101
|
}
|
102
|
-
|
102
|
+
|
103
103
|
public void setException(Ruby runtime, Exception exception, int level) {
|
104
104
|
this.exception = exception;
|
105
105
|
setInstanceVariable("@level", runtime.newFixnum(level));
|
@@ -122,15 +122,17 @@ public class XmlSyntaxError extends RubyException {
|
|
122
122
|
if (exception != null && exception.getMessage() != null)
|
123
123
|
return context.getRuntime().newString(exception.getMessage());
|
124
124
|
else
|
125
|
-
return super.to_s(context);
|
125
|
+
return super.to_s(context);
|
126
126
|
}
|
127
|
-
|
127
|
+
|
128
128
|
//@Override
|
129
129
|
//"to_s" method was branched in 1.8 and 1.9 since JRuby 1.6.6
|
130
130
|
// to support older version of JRuby, the annotation is commented out
|
131
131
|
@JRubyMethod(name = "to_s", compat = CompatVersion.RUBY1_9)
|
132
132
|
public IRubyObject to_s19(ThreadContext context) {
|
133
|
-
|
133
|
+
if (exception != null && exception.getMessage() != null)
|
134
|
+
return context.getRuntime().newString(exception.getMessage());
|
135
|
+
else
|
136
|
+
return super.to_s19(context);
|
134
137
|
}
|
135
|
-
|
136
138
|
}
|
data/ext/nokogiri/extconf.rb
CHANGED
@@ -71,10 +71,19 @@ def do_clean
|
|
71
71
|
exit! 0
|
72
72
|
end
|
73
73
|
|
74
|
+
def nokogiri_try_compile
|
75
|
+
args = if defined?(RUBY_VERSION) && RUBY_VERSION <= "1.9.2"
|
76
|
+
["int main() {return 0;}"]
|
77
|
+
else
|
78
|
+
["int main() {return 0;}", "", {werror: true}]
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
|
74
83
|
def add_cflags(flags)
|
75
84
|
print "checking if the C compiler accepts #{flags}... "
|
76
85
|
with_cflags("#{$CFLAGS} #{flags}") do
|
77
|
-
if
|
86
|
+
if nokogiri_try_compile
|
78
87
|
puts 'yes'
|
79
88
|
true
|
80
89
|
else
|
@@ -225,7 +234,7 @@ def process_recipe(name, version, static_p, cross_p)
|
|
225
234
|
************************************************************************
|
226
235
|
IMPORTANT NOTICE:
|
227
236
|
|
228
|
-
|
237
|
+
Building Nokogiri with a packaged version of #{name}-#{version}#{'.' if recipe.patch_files.empty?}
|
229
238
|
EOS
|
230
239
|
|
231
240
|
unless recipe.patch_files.empty?
|
@@ -294,7 +303,7 @@ def monkey_patch_mini_portile
|
|
294
303
|
@patch_files.each do |full_path|
|
295
304
|
next unless File.exists?(full_path)
|
296
305
|
output "Running patch with #{full_path}..."
|
297
|
-
execute('patch', %Q(patch -p1 < #{full_path}))
|
306
|
+
execute('patch', %Q(patch -p1 < "#{full_path}"))
|
298
307
|
end
|
299
308
|
end
|
300
309
|
end
|
@@ -452,6 +461,12 @@ EOM
|
|
452
461
|
end
|
453
462
|
end
|
454
463
|
|
464
|
+
unless windows_p
|
465
|
+
preserving_globals {
|
466
|
+
have_library('z', 'gzdopen', 'zlib.h')
|
467
|
+
} or abort 'zlib is missing; necessary for building libxml2'
|
468
|
+
end
|
469
|
+
|
455
470
|
libxml2_recipe = process_recipe("libxml2", dependencies["libxml2"], static_p, cross_build_p) do |recipe|
|
456
471
|
recipe.files = ["ftp://ftp.xmlsoft.org/libxml2/#{recipe.name}-#{recipe.version}.tar.gz"]
|
457
472
|
recipe.configure_options += [
|
data/ext/nokogiri/xml_comment.c
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
#include <xml_comment.h>
|
2
2
|
|
3
|
+
static ID document_id ;
|
4
|
+
|
3
5
|
/*
|
4
6
|
* call-seq:
|
5
|
-
* new(
|
7
|
+
* new(document_or_node, content)
|
6
8
|
*
|
7
|
-
* Create a new Comment element on the +document+ with +content
|
9
|
+
* Create a new Comment element on the +document+ with +content+.
|
10
|
+
* Alternatively, if a +node+ is passed, the +node+'s document is used.
|
8
11
|
*/
|
9
12
|
static VALUE new(int argc, VALUE *argv, VALUE klass)
|
10
13
|
{
|
@@ -17,6 +20,16 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
|
|
17
20
|
|
18
21
|
rb_scan_args(argc, argv, "2*", &document, &content, &rest);
|
19
22
|
|
23
|
+
if (rb_obj_is_kind_of(document, cNokogiriXmlNode))
|
24
|
+
{
|
25
|
+
document = rb_funcall(document, document_id, 0);
|
26
|
+
}
|
27
|
+
else if ( !rb_obj_is_kind_of(document, cNokogiriXmlDocument)
|
28
|
+
&& !rb_obj_is_kind_of(document, cNokogiriXmlDocumentFragment))
|
29
|
+
{
|
30
|
+
rb_raise(rb_eArgError, "first argument must be a XML::Document or XML::Node");
|
31
|
+
}
|
32
|
+
|
20
33
|
Data_Get_Struct(document, xmlDoc, xml_doc);
|
21
34
|
|
22
35
|
node = xmlNewDocComment(
|
@@ -51,4 +64,6 @@ void init_xml_comment()
|
|
51
64
|
cNokogiriXmlComment = klass;
|
52
65
|
|
53
66
|
rb_define_singleton_method(klass, "new", new, -1);
|
67
|
+
|
68
|
+
document_id = rb_intern("document");
|
54
69
|
}
|
data/ext/nokogiri/xml_node.c
CHANGED
@@ -14,7 +14,7 @@ static void debug_node_dealloc(xmlNodePtr x)
|
|
14
14
|
|
15
15
|
static void mark(xmlNodePtr node)
|
16
16
|
{
|
17
|
-
|
17
|
+
xmlDocPtr doc = node->doc;
|
18
18
|
if(doc->type == XML_DOCUMENT_NODE || doc->type == XML_HTML_DOCUMENT_NODE) {
|
19
19
|
if(DOC_RUBY_OBJECT_TEST(doc)) {
|
20
20
|
rb_gc_mark(DOC_RUBY_OBJECT(doc));
|
@@ -234,7 +234,15 @@ ok:
|
|
234
234
|
* reparent the actual reparentee, so we reparent a duplicate.
|
235
235
|
*/
|
236
236
|
nokogiri_root_node(reparentee);
|
237
|
-
|
237
|
+
|
238
|
+
xmlResetLastError();
|
239
|
+
xmlSetStructuredErrorFunc((void *)rb_iv_get(DOC_RUBY_OBJECT(pivot->doc), "@errors"), Nokogiri_error_array_pusher);
|
240
|
+
|
241
|
+
reparentee = xmlDocCopyNode(reparentee, pivot->doc, 1) ;
|
242
|
+
|
243
|
+
xmlSetStructuredErrorFunc(NULL, NULL);
|
244
|
+
|
245
|
+
if (! reparentee) {
|
238
246
|
rb_raise(rb_eRuntimeError, "Could not reparent node (xmlDocCopyNode)");
|
239
247
|
}
|
240
248
|
}
|
@@ -473,7 +481,13 @@ static VALUE duplicate_node(int argc, VALUE *argv, VALUE self)
|
|
473
481
|
|
474
482
|
Data_Get_Struct(self, xmlNode, node);
|
475
483
|
|
484
|
+
xmlResetLastError();
|
485
|
+
xmlSetStructuredErrorFunc(NULL, Nokogiri_error_silencer);
|
486
|
+
|
476
487
|
dup = xmlDocCopyNode(node, node->doc, (int)NUM2INT(level));
|
488
|
+
|
489
|
+
xmlSetStructuredErrorFunc(NULL, NULL);
|
490
|
+
|
477
491
|
if(dup == NULL) return Qnil;
|
478
492
|
|
479
493
|
nokogiri_root_node(dup);
|
@@ -1012,7 +1026,7 @@ static VALUE node_type(VALUE self)
|
|
1012
1026
|
*
|
1013
1027
|
* Set the content for this Node
|
1014
1028
|
*/
|
1015
|
-
static VALUE
|
1029
|
+
static VALUE set_native_content(VALUE self, VALUE content)
|
1016
1030
|
{
|
1017
1031
|
xmlNodePtr node, child, next ;
|
1018
1032
|
Data_Get_Struct(self, xmlNode, node);
|
@@ -1035,7 +1049,7 @@ static VALUE native_content(VALUE self, VALUE content)
|
|
1035
1049
|
*
|
1036
1050
|
* Returns the content for this Node
|
1037
1051
|
*/
|
1038
|
-
static VALUE
|
1052
|
+
static VALUE get_native_content(VALUE self)
|
1039
1053
|
{
|
1040
1054
|
xmlNodePtr node;
|
1041
1055
|
xmlChar * content;
|
@@ -1051,6 +1065,50 @@ static VALUE get_content(VALUE self)
|
|
1051
1065
|
return Qnil;
|
1052
1066
|
}
|
1053
1067
|
|
1068
|
+
/*
|
1069
|
+
* call-seq:
|
1070
|
+
* lang=
|
1071
|
+
*
|
1072
|
+
* Set the language of a node, i.e. the values of the xml:lang attribute.
|
1073
|
+
*/
|
1074
|
+
static VALUE set_lang(VALUE self_rb, VALUE lang_rb)
|
1075
|
+
{
|
1076
|
+
xmlNodePtr self ;
|
1077
|
+
xmlChar* lang ;
|
1078
|
+
|
1079
|
+
Data_Get_Struct(self_rb, xmlNode, self);
|
1080
|
+
lang = (xmlChar*)StringValuePtr(lang_rb);
|
1081
|
+
|
1082
|
+
xmlNodeSetLang(self, lang);
|
1083
|
+
|
1084
|
+
return Qnil ;
|
1085
|
+
}
|
1086
|
+
|
1087
|
+
/*
|
1088
|
+
* call-seq:
|
1089
|
+
* lang
|
1090
|
+
*
|
1091
|
+
* Searches the language of a node, i.e. the values of the xml:lang attribute or
|
1092
|
+
* the one carried by the nearest ancestor.
|
1093
|
+
*/
|
1094
|
+
static VALUE get_lang(VALUE self_rb)
|
1095
|
+
{
|
1096
|
+
xmlNodePtr self ;
|
1097
|
+
xmlChar* lang ;
|
1098
|
+
VALUE lang_rb ;
|
1099
|
+
|
1100
|
+
Data_Get_Struct(self_rb, xmlNode, self);
|
1101
|
+
|
1102
|
+
lang = xmlNodeGetLang(self);
|
1103
|
+
if (lang) {
|
1104
|
+
lang_rb = NOKOGIRI_STR_NEW2(lang);
|
1105
|
+
xmlFree(lang);
|
1106
|
+
return lang_rb ;
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
return Qnil ;
|
1110
|
+
}
|
1111
|
+
|
1054
1112
|
/* :nodoc: */
|
1055
1113
|
static VALUE add_child(VALUE self, VALUE new_child)
|
1056
1114
|
{
|
@@ -1561,7 +1619,6 @@ void init_xml_node()
|
|
1561
1619
|
rb_define_method(klass, "next_element", next_element, 0);
|
1562
1620
|
rb_define_method(klass, "previous_element", previous_element, 0);
|
1563
1621
|
rb_define_method(klass, "node_type", node_type, 0);
|
1564
|
-
rb_define_method(klass, "content", get_content, 0);
|
1565
1622
|
rb_define_method(klass, "path", path, 0);
|
1566
1623
|
rb_define_method(klass, "key?", key_eh, 1);
|
1567
1624
|
rb_define_method(klass, "namespaced_key?", namespaced_key_eh, 2);
|
@@ -1581,7 +1638,10 @@ void init_xml_node()
|
|
1581
1638
|
rb_define_method(klass, "create_external_subset", create_external_subset, 3);
|
1582
1639
|
rb_define_method(klass, "pointer_id", pointer_id, 0);
|
1583
1640
|
rb_define_method(klass, "line", line, 0);
|
1584
|
-
rb_define_method(klass, "
|
1641
|
+
rb_define_method(klass, "content", get_native_content, 0);
|
1642
|
+
rb_define_method(klass, "native_content=", set_native_content, 1);
|
1643
|
+
rb_define_method(klass, "lang", get_lang, 0);
|
1644
|
+
rb_define_method(klass, "lang=", set_lang, 1);
|
1585
1645
|
|
1586
1646
|
rb_define_private_method(klass, "process_xincludes", process_xincludes, 1);
|
1587
1647
|
rb_define_private_method(klass, "in_context", in_context, 2);
|
@@ -7,6 +7,10 @@ void Nokogiri_error_array_pusher(void * ctx, xmlErrorPtr error)
|
|
7
7
|
rb_ary_push(list, Nokogiri_wrap_xml_syntax_error(error));
|
8
8
|
}
|
9
9
|
|
10
|
+
void Nokogiri_error_silencer(void * ctx, xmlErrorPtr error)
|
11
|
+
{
|
12
|
+
}
|
13
|
+
|
10
14
|
void Nokogiri_error_raise(void * ctx, xmlErrorPtr error)
|
11
15
|
{
|
12
16
|
rb_exc_raise(Nokogiri_wrap_xml_syntax_error(error));
|
@@ -6,6 +6,7 @@
|
|
6
6
|
void init_xml_syntax_error();
|
7
7
|
VALUE Nokogiri_wrap_xml_syntax_error(xmlErrorPtr error);
|
8
8
|
void Nokogiri_error_array_pusher(void * ctx, xmlErrorPtr error);
|
9
|
+
void Nokogiri_error_silencer(void * ctx, xmlErrorPtr error);
|
9
10
|
NORETURN(void Nokogiri_error_raise(void * ctx, xmlErrorPtr error));
|
10
11
|
|
11
12
|
extern VALUE cNokogiriXmlSyntaxError;
|