libxml-ruby 4.1.2 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY +17 -0
- data/README.rdoc +7 -16
- data/ext/libxml/ruby_libxml.h +43 -44
- data/ext/libxml/ruby_xml.c +0 -343
- data/ext/libxml/ruby_xml.h +9 -10
- data/ext/libxml/ruby_xml_attributes.h +2 -0
- data/ext/libxml/ruby_xml_document.c +6 -6
- data/ext/libxml/ruby_xml_document.h +11 -11
- data/ext/libxml/ruby_xml_dtd.c +85 -79
- data/ext/libxml/ruby_xml_encoding.h +20 -18
- data/ext/libxml/ruby_xml_error.c +9 -6
- data/ext/libxml/ruby_xml_error.h +2 -2
- data/ext/libxml/ruby_xml_html_parser_context.c +35 -21
- data/ext/libxml/ruby_xml_namespace.c +0 -3
- data/ext/libxml/ruby_xml_node.c +1394 -1398
- data/ext/libxml/ruby_xml_parser.h +1 -1
- data/ext/libxml/ruby_xml_parser_context.c +47 -39
- data/ext/libxml/ruby_xml_parser_options.c +9 -1
- data/ext/libxml/ruby_xml_parser_options.h +1 -1
- data/ext/libxml/ruby_xml_reader.c +15 -16
- data/ext/libxml/ruby_xml_sax2_handler.c +1 -1
- data/ext/libxml/ruby_xml_sax_parser.c +1 -9
- data/ext/libxml/ruby_xml_schema.c +4 -4
- data/ext/libxml/ruby_xml_version.h +5 -5
- data/ext/libxml/ruby_xml_writer.c +8 -8
- data/ext/libxml/ruby_xml_xpath.c +1 -1
- data/ext/libxml/ruby_xml_xpath_context.c +2 -2
- data/ext/libxml/ruby_xml_xpath_expression.c +1 -1
- data/lib/libxml/document.rb +15 -15
- data/lib/libxml/html_parser.rb +23 -23
- data/lib/libxml/parser.rb +26 -24
- data/test/test.rb +5 -0
- data/test/test_document.rb +8 -0
- data/test/test_document_write.rb +1 -4
- data/test/test_dtd.rb +5 -8
- data/test/test_encoding.rb +1 -4
- data/test/test_helper.rb +9 -2
- data/test/test_html_parser.rb +162 -162
- data/test/test_namespace.rb +1 -3
- data/test/test_node.rb +1 -3
- data/test/test_node_write.rb +1 -4
- data/test/test_parser.rb +26 -17
- data/test/test_reader.rb +4 -4
- data/test/test_sax_parser.rb +1 -1
- data/test/test_xml.rb +0 -99
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24e442a3a4f3343aaae6bc6b513309faccd90af0c9e985c6729d91821c9b29b4
|
4
|
+
data.tar.gz: 698be20e816f96b896c3b8bd7cc0bcf89e131d8b46466e16b9d804133b8f5af2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f90226185c4146bb9b0212d489e8913148408f09e315ebedbca43e44914534c595b89bd3238fa7bfabf9e21f1d3613e4b11980a82b8d4f844bbe07bd862b788
|
7
|
+
data.tar.gz: 9313c21dc1405b5d0b015120e37a2310a7d337ff0948b2f2ed54c105e276b090c246314315c937f25444fa187c4fe101b618a8dec24b774deba85cb8e0ad414f
|
data/HISTORY
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
= Release History
|
2
2
|
|
3
|
+
== 5.0.1 / 2024-01-08
|
4
|
+
|
5
|
+
* Fix broken Document#io method that was broken by switching Parsers to use keyword arguments
|
6
|
+
|
7
|
+
== 5.0.0 / 2024-01-07
|
8
|
+
|
9
|
+
* This release is major version bump because it removes access to global parser options
|
10
|
+
that libxml2 version 2.12.0 deprecated (see https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.12.0)
|
11
|
+
In the unlikely event your code uses these options, then you will need to update it.
|
12
|
+
Specifically, instead of setting global parser options, pass them directly to either Parsers
|
13
|
+
or ParserContexts when creating them. Options are defined as constants in
|
14
|
+
LibXML::XML::Parser::Options and LibXML::HTML::Parser::Options
|
15
|
+
* Update Parser initialize methods to take keyword parameters instead of a hash table (you may have to update your code due to this change)
|
16
|
+
* Fix broken compilation with libxml2 version 2.12.0 (due to libxml2 header changes)
|
17
|
+
* Add support for Ruby 3.3.*
|
18
|
+
* Remove support for Ruby 2.7.* (gem should still work but is no longer tested)
|
19
|
+
|
3
20
|
== 4.1.2 / 2023-11-04
|
4
21
|
|
5
22
|
* Fix Ruby warnings about undefined allocators (yuuji.yaginuma, Christopher Sahnwaldt)
|
data/README.rdoc
CHANGED
@@ -11,7 +11,7 @@ We think libxml-ruby is the best XML library for Ruby because:
|
|
11
11
|
* Conformance - It passes all 1800+ tests from the OASIS XML Tests Suite
|
12
12
|
|
13
13
|
== Requirements
|
14
|
-
libxml-ruby requires Ruby
|
14
|
+
libxml-ruby requires Ruby 3.0.0 or higher. It depends on libxml2 to
|
15
15
|
function properly. libxml2, in turn, depends on:
|
16
16
|
|
17
17
|
* libm (math routines: very standard)
|
@@ -20,9 +20,9 @@ function properly. libxml2, in turn, depends on:
|
|
20
20
|
|
21
21
|
If you are running Linux or Unix you'll need a C compiler so the
|
22
22
|
extension can be compiled when it is installed. If you are running
|
23
|
-
Windows, then install the x64-
|
24
|
-
|
25
|
-
|
23
|
+
Windows, then install the x64-mingw-ucr gem or build it yourself using (Ruby
|
24
|
+
for Windows)[https://rubyinstaller.org/] or directly with msys2[https://msys2.github.io/]
|
25
|
+
and ucrt64.
|
26
26
|
|
27
27
|
== Installation
|
28
28
|
The easiest way to install libxml-ruby is via RubyGems. To install:
|
@@ -46,13 +46,9 @@ Or bundler:
|
|
46
46
|
<tt>bundle install libxml-ruby</tt>
|
47
47
|
|
48
48
|
If you are running Windows, then install the libxml-ruby-x64-mingw32 gem.
|
49
|
-
The gem includes prebuilt extensions for Ruby 2.3.
|
50
|
-
extensions are built using MinGW64 and libxml2 version 2.9.3,
|
51
|
-
iconv version 1.14 and zlib version 1.2.8. Note these binaries
|
52
|
-
are available in the <tt>lib\\libs</tt> directory. To use them, put them
|
53
|
-
on your <tt>PATH</tt>.
|
49
|
+
The gem includes prebuilt extensions for Ruby 3.2 and 3.3.
|
54
50
|
|
55
|
-
The gem also includes a Microsoft VC++
|
51
|
+
The gem also includes a Microsoft VC++ solution and XCode project - these
|
56
52
|
are very useful for debugging.
|
57
53
|
|
58
54
|
libxml-ruby's source codes lives on GitHub[https://github.com/xml4r/libxml-ruby].
|
@@ -128,11 +124,6 @@ For example:
|
|
128
124
|
|
129
125
|
For simplicity's sake, the documentation uses the xml module in its examples.
|
130
126
|
|
131
|
-
== Threading
|
132
|
-
libxml-ruby fully supports native, background Ruby threads. This of course
|
133
|
-
only applies to Ruby 1.9.x and higher since earlier versions of Ruby do not
|
134
|
-
support native threads.
|
135
|
-
|
136
127
|
== Tests
|
137
128
|
|
138
129
|
To run tests you first need to build the shared libary:
|
@@ -143,7 +134,7 @@ Once you have build the shared libary, you can then run tests using rake:
|
|
143
134
|
|
144
135
|
rake test
|
145
136
|
|
146
|
-
+
|
137
|
+
+Build status: {rdoc-image:https://github.com/xml4r/libxml-ruby/actions/workflows/mri.yml/badge.svg}[https://github.com/xml4r/libxml-ruby/actions/workflows/mri.yml]
|
147
138
|
|
148
139
|
== Performance
|
149
140
|
|
data/ext/libxml/ruby_libxml.h
CHANGED
@@ -1,44 +1,43 @@
|
|
1
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
2
|
-
|
3
|
-
#ifndef __RUBY_LIBXML_H__
|
4
|
-
#define __RUBY_LIBXML_H__
|
5
|
-
|
6
|
-
#include <ruby.h>
|
7
|
-
|
8
|
-
|
9
|
-
#include "
|
10
|
-
#include "
|
11
|
-
#include "
|
12
|
-
#include "
|
13
|
-
#include "
|
14
|
-
#include "
|
15
|
-
#include "
|
16
|
-
#include "
|
17
|
-
#include "
|
18
|
-
#include "
|
19
|
-
#include "
|
20
|
-
#include "
|
21
|
-
#include "
|
22
|
-
#include "
|
23
|
-
#include "
|
24
|
-
#include "
|
25
|
-
#include "
|
26
|
-
#include "
|
27
|
-
#include "
|
28
|
-
#include "
|
29
|
-
#include "
|
30
|
-
#include "
|
31
|
-
#include "
|
32
|
-
#include "
|
33
|
-
#include "
|
34
|
-
#include "
|
35
|
-
#include "
|
36
|
-
#include "
|
37
|
-
#include "
|
38
|
-
#include "
|
39
|
-
#include "
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
#endif
|
1
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
2
|
+
|
3
|
+
#ifndef __RUBY_LIBXML_H__
|
4
|
+
#define __RUBY_LIBXML_H__
|
5
|
+
|
6
|
+
#include <ruby.h>
|
7
|
+
|
8
|
+
#include "ruby_xml_version.h"
|
9
|
+
#include "ruby_xml.h"
|
10
|
+
#include "ruby_xml_io.h"
|
11
|
+
#include "ruby_xml_error.h"
|
12
|
+
#include "ruby_xml_encoding.h"
|
13
|
+
#include "ruby_xml_attributes.h"
|
14
|
+
#include "ruby_xml_attr.h"
|
15
|
+
#include "ruby_xml_attr_decl.h"
|
16
|
+
#include "ruby_xml_document.h"
|
17
|
+
#include "ruby_xml_node.h"
|
18
|
+
#include "ruby_xml_namespace.h"
|
19
|
+
#include "ruby_xml_namespaces.h"
|
20
|
+
#include "ruby_xml_parser.h"
|
21
|
+
#include "ruby_xml_parser_options.h"
|
22
|
+
#include "ruby_xml_parser_context.h"
|
23
|
+
#include "ruby_xml_html_parser.h"
|
24
|
+
#include "ruby_xml_html_parser_options.h"
|
25
|
+
#include "ruby_xml_html_parser_context.h"
|
26
|
+
#include "ruby_xml_reader.h"
|
27
|
+
#include "ruby_xml_writer.h"
|
28
|
+
#include "ruby_xml_sax2_handler.h"
|
29
|
+
#include "ruby_xml_sax_parser.h"
|
30
|
+
#include "ruby_xml_writer.h"
|
31
|
+
#include "ruby_xml_xinclude.h"
|
32
|
+
#include "ruby_xml_xpath.h"
|
33
|
+
#include "ruby_xml_xpath_expression.h"
|
34
|
+
#include "ruby_xml_xpath_context.h"
|
35
|
+
#include "ruby_xml_xpath_object.h"
|
36
|
+
#include "ruby_xml_input_cbg.h"
|
37
|
+
#include "ruby_xml_dtd.h"
|
38
|
+
#include "ruby_xml_schema.h"
|
39
|
+
#include "ruby_xml_relaxng.h"
|
40
|
+
|
41
|
+
extern VALUE mLibXML;
|
42
|
+
|
43
|
+
#endif
|
data/ext/libxml/ruby_xml.c
CHANGED
@@ -328,264 +328,6 @@ static VALUE rxml_enabled_zlib_q(VALUE klass)
|
|
328
328
|
#endif
|
329
329
|
}
|
330
330
|
|
331
|
-
/*
|
332
|
-
* call-seq:
|
333
|
-
* XML.debug_entities -> (true|false)
|
334
|
-
*
|
335
|
-
* Determine whether included-entity debugging is enabled.
|
336
|
-
* (Requires Libxml to be compiled with debugging support)
|
337
|
-
*/
|
338
|
-
static VALUE rxml_debug_entities_get(VALUE klass)
|
339
|
-
{
|
340
|
-
#ifdef LIBXML_DEBUG_ENABLED
|
341
|
-
if (xmlParserDebugEntities)
|
342
|
-
return(Qtrue);
|
343
|
-
else
|
344
|
-
return(Qfalse);
|
345
|
-
#else
|
346
|
-
rb_warn("libxml was compiled with debugging turned off");
|
347
|
-
return (Qfalse);
|
348
|
-
#endif
|
349
|
-
}
|
350
|
-
|
351
|
-
/*
|
352
|
-
* call-seq:
|
353
|
-
* XML.debug_entities = true|false
|
354
|
-
*
|
355
|
-
* Enable or disable included-entity debugging.
|
356
|
-
* (Requires Libxml to be compiled with debugging support)
|
357
|
-
*/
|
358
|
-
static VALUE rxml_debug_entities_set(VALUE klass, VALUE value)
|
359
|
-
{
|
360
|
-
#ifdef LIBXML_DEBUG_ENABLED
|
361
|
-
if (value == Qfalse)
|
362
|
-
{
|
363
|
-
xmlParserDebugEntities = 0;
|
364
|
-
return(Qfalse);
|
365
|
-
}
|
366
|
-
else
|
367
|
-
{
|
368
|
-
xmlParserDebugEntities = 1;
|
369
|
-
return(Qtrue);
|
370
|
-
}
|
371
|
-
#else
|
372
|
-
rb_warn("libxml was compiled with debugging turned off");
|
373
|
-
#endif
|
374
|
-
}
|
375
|
-
|
376
|
-
/*
|
377
|
-
* call-seq:
|
378
|
-
* XML.default_keep_blanks -> (true|false)
|
379
|
-
*
|
380
|
-
* Determine whether parsers retain whitespace by default.
|
381
|
-
*/
|
382
|
-
static VALUE rxml_default_keep_blanks_get(VALUE klass)
|
383
|
-
{
|
384
|
-
if (xmlKeepBlanksDefaultValue)
|
385
|
-
return (Qtrue);
|
386
|
-
else
|
387
|
-
return (Qfalse);
|
388
|
-
}
|
389
|
-
|
390
|
-
/*
|
391
|
-
* call-seq:
|
392
|
-
* XML.default_keep_blanks = true|false
|
393
|
-
*
|
394
|
-
* Controls whether parsers retain whitespace by default.
|
395
|
-
*/
|
396
|
-
static VALUE rxml_default_keep_blanks_set(VALUE klass, VALUE value)
|
397
|
-
{
|
398
|
-
if (value == Qfalse)
|
399
|
-
{
|
400
|
-
xmlKeepBlanksDefaultValue = 0;
|
401
|
-
return (Qfalse);
|
402
|
-
}
|
403
|
-
else if (value == Qtrue)
|
404
|
-
{
|
405
|
-
xmlKeepBlanksDefaultValue = 1;
|
406
|
-
return (Qtrue);
|
407
|
-
}
|
408
|
-
else
|
409
|
-
{
|
410
|
-
rb_raise(rb_eArgError, "Invalid argument, must be a boolean");
|
411
|
-
}
|
412
|
-
}
|
413
|
-
|
414
|
-
/*
|
415
|
-
* call-seq:
|
416
|
-
* XML.default_load_external_dtd -> (true|false)
|
417
|
-
*
|
418
|
-
* Determine whether parsers load external DTDs by default.
|
419
|
-
*/
|
420
|
-
static VALUE rxml_default_load_external_dtd_get(VALUE klass)
|
421
|
-
{
|
422
|
-
if (xmlLoadExtDtdDefaultValue)
|
423
|
-
return (Qtrue);
|
424
|
-
else
|
425
|
-
return (Qfalse);
|
426
|
-
}
|
427
|
-
|
428
|
-
/*
|
429
|
-
* call-seq:
|
430
|
-
* XML.default_load_external_dtd = true|false
|
431
|
-
*
|
432
|
-
* Controls whether parsers load external DTDs by default.
|
433
|
-
*/
|
434
|
-
static VALUE rxml_default_load_external_dtd_set(VALUE klass, VALUE value)
|
435
|
-
{
|
436
|
-
if (value == Qfalse)
|
437
|
-
{
|
438
|
-
xmlLoadExtDtdDefaultValue = 0;
|
439
|
-
return (Qfalse);
|
440
|
-
}
|
441
|
-
else
|
442
|
-
{
|
443
|
-
xmlLoadExtDtdDefaultValue = 1;
|
444
|
-
return (Qtrue);
|
445
|
-
}
|
446
|
-
}
|
447
|
-
|
448
|
-
/*
|
449
|
-
* call-seq:
|
450
|
-
* XML.default_line_numbers -> (true|false)
|
451
|
-
*
|
452
|
-
* Determine whether parsers retain line-numbers by default.
|
453
|
-
*/
|
454
|
-
static VALUE rxml_default_line_numbers_get(VALUE klass)
|
455
|
-
{
|
456
|
-
if (xmlLineNumbersDefaultValue)
|
457
|
-
return (Qtrue);
|
458
|
-
else
|
459
|
-
return (Qfalse);
|
460
|
-
}
|
461
|
-
|
462
|
-
/*
|
463
|
-
* call-seq:
|
464
|
-
* XML.default_line_numbers = true|false
|
465
|
-
*
|
466
|
-
* Controls whether parsers retain line-numbers by default.
|
467
|
-
*/
|
468
|
-
static VALUE rxml_default_line_numbers_set(VALUE klass, VALUE value)
|
469
|
-
{
|
470
|
-
if (value == Qfalse)
|
471
|
-
{
|
472
|
-
xmlLineNumbersDefault(0);
|
473
|
-
return (Qfalse);
|
474
|
-
}
|
475
|
-
else
|
476
|
-
{
|
477
|
-
xmlLineNumbersDefault(1);
|
478
|
-
return (Qtrue);
|
479
|
-
}
|
480
|
-
}
|
481
|
-
|
482
|
-
int rxml_libxml_default_options(void)
|
483
|
-
{
|
484
|
-
int options = 0;
|
485
|
-
|
486
|
-
if (xmlLoadExtDtdDefaultValue)
|
487
|
-
options |= XML_PARSE_DTDLOAD;
|
488
|
-
|
489
|
-
if (xmlDoValidityCheckingDefaultValue)
|
490
|
-
options |= XML_PARSE_DTDVALID;
|
491
|
-
|
492
|
-
if (!xmlKeepBlanksDefaultValue)
|
493
|
-
options |= XML_PARSE_NOBLANKS;
|
494
|
-
|
495
|
-
if (xmlSubstituteEntitiesDefaultValue)
|
496
|
-
options |= XML_PARSE_NOENT;
|
497
|
-
|
498
|
-
if (!xmlGetWarningsDefaultValue)
|
499
|
-
options |= XML_PARSE_NOWARNING;
|
500
|
-
|
501
|
-
if (xmlPedanticParserDefaultValue)
|
502
|
-
options |= XML_PARSE_PEDANTIC;
|
503
|
-
|
504
|
-
return options;
|
505
|
-
}
|
506
|
-
|
507
|
-
/*
|
508
|
-
* call-seq:
|
509
|
-
* XML.default_options -> int
|
510
|
-
*
|
511
|
-
* Returns an integer that summarize libxml2's default options.
|
512
|
-
*/
|
513
|
-
static VALUE rxml_default_options_get(VALUE klass)
|
514
|
-
{
|
515
|
-
int options = rxml_libxml_default_options();
|
516
|
-
return INT2NUM(options);
|
517
|
-
}
|
518
|
-
|
519
|
-
/*
|
520
|
-
* call-seq:
|
521
|
-
* XML.default_pedantic_parser -> (true|false)
|
522
|
-
*
|
523
|
-
* Determine whether parsers are pedantic by default.
|
524
|
-
*/
|
525
|
-
static VALUE rxml_default_pedantic_parser_get(VALUE klass)
|
526
|
-
{
|
527
|
-
if (xmlPedanticParserDefaultValue)
|
528
|
-
return (Qtrue);
|
529
|
-
else
|
530
|
-
return (Qfalse);
|
531
|
-
}
|
532
|
-
|
533
|
-
/*
|
534
|
-
* call-seq:
|
535
|
-
* XML.default_pedantic_parser = true|false
|
536
|
-
*
|
537
|
-
* Controls whether parsers are pedantic by default.
|
538
|
-
*/
|
539
|
-
static VALUE rxml_default_pedantic_parser_set(VALUE klass, VALUE value)
|
540
|
-
{
|
541
|
-
if (value == Qfalse)
|
542
|
-
{
|
543
|
-
xmlPedanticParserDefault(0);
|
544
|
-
return (Qfalse);
|
545
|
-
}
|
546
|
-
else
|
547
|
-
{
|
548
|
-
xmlPedanticParserDefault(1);
|
549
|
-
return (Qtrue);
|
550
|
-
}
|
551
|
-
}
|
552
|
-
|
553
|
-
/*
|
554
|
-
* call-seq:
|
555
|
-
* XML.default_substitute_entities -> (true|false)
|
556
|
-
*
|
557
|
-
* Determine whether parsers perform inline entity substitution
|
558
|
-
* (for external entities) by default.
|
559
|
-
*/
|
560
|
-
static VALUE rxml_default_substitute_entities_get(VALUE klass)
|
561
|
-
{
|
562
|
-
if (xmlSubstituteEntitiesDefaultValue)
|
563
|
-
return (Qtrue);
|
564
|
-
else
|
565
|
-
return (Qfalse);
|
566
|
-
}
|
567
|
-
|
568
|
-
/*
|
569
|
-
* call-seq:
|
570
|
-
* XML.default_substitute_entities = true|false
|
571
|
-
*
|
572
|
-
* Controls whether parsers perform inline entity substitution
|
573
|
-
* (for external entities) by default.
|
574
|
-
*/
|
575
|
-
static VALUE rxml_default_substitute_entities_set(VALUE klass, VALUE value)
|
576
|
-
{
|
577
|
-
if (value == Qfalse)
|
578
|
-
{
|
579
|
-
xmlSubstituteEntitiesDefault(0);
|
580
|
-
return (Qfalse);
|
581
|
-
}
|
582
|
-
else
|
583
|
-
{
|
584
|
-
xmlSubstituteEntitiesDefault(1);
|
585
|
-
return (Qtrue);
|
586
|
-
}
|
587
|
-
}
|
588
|
-
|
589
331
|
/*
|
590
332
|
* call-seq:
|
591
333
|
* XML.default_tree_indent_string -> "string"
|
@@ -615,74 +357,6 @@ static VALUE rxml_default_tree_indent_string_set(VALUE klass, VALUE string)
|
|
615
357
|
return (string);
|
616
358
|
}
|
617
359
|
|
618
|
-
/*
|
619
|
-
* call-seq:
|
620
|
-
* XML.default_validity_checking -> (true|false)
|
621
|
-
*
|
622
|
-
* Determine whether parsers perform XML validation by default.
|
623
|
-
*/
|
624
|
-
static VALUE rxml_default_validity_checking_get(VALUE klass)
|
625
|
-
{
|
626
|
-
if (xmlDoValidityCheckingDefaultValue)
|
627
|
-
return (Qtrue);
|
628
|
-
else
|
629
|
-
return (Qfalse);
|
630
|
-
}
|
631
|
-
|
632
|
-
/*
|
633
|
-
* call-seq:
|
634
|
-
* XML.default_validity_checking = true|false
|
635
|
-
*
|
636
|
-
* Controls whether parsers perform XML validation by default.
|
637
|
-
*/
|
638
|
-
static VALUE rxml_default_validity_checking_set(VALUE klass, VALUE value)
|
639
|
-
{
|
640
|
-
if (value == Qfalse)
|
641
|
-
{
|
642
|
-
xmlDoValidityCheckingDefaultValue = 0;
|
643
|
-
return (Qfalse);
|
644
|
-
}
|
645
|
-
else
|
646
|
-
{
|
647
|
-
xmlDoValidityCheckingDefaultValue = 1;
|
648
|
-
return (Qtrue);
|
649
|
-
}
|
650
|
-
}
|
651
|
-
|
652
|
-
/*
|
653
|
-
* call-seq:
|
654
|
-
* XML.default_warnings -> (true|false)
|
655
|
-
*
|
656
|
-
* Determine whether parsers output warnings by default.
|
657
|
-
*/
|
658
|
-
static VALUE rxml_default_warnings_get(VALUE klass)
|
659
|
-
{
|
660
|
-
if (xmlGetWarningsDefaultValue)
|
661
|
-
return (Qtrue);
|
662
|
-
else
|
663
|
-
return (Qfalse);
|
664
|
-
}
|
665
|
-
|
666
|
-
/*
|
667
|
-
* call-seq:
|
668
|
-
* XML.default_warnings = true|false
|
669
|
-
*
|
670
|
-
* Controls whether parsers output warnings by default.
|
671
|
-
*/
|
672
|
-
static VALUE rxml_default_warnings_set(VALUE klass, VALUE value)
|
673
|
-
{
|
674
|
-
if (value == Qfalse)
|
675
|
-
{
|
676
|
-
xmlGetWarningsDefaultValue = 0;
|
677
|
-
return (Qfalse);
|
678
|
-
}
|
679
|
-
else
|
680
|
-
{
|
681
|
-
xmlGetWarningsDefaultValue = 1;
|
682
|
-
return (Qtrue);
|
683
|
-
}
|
684
|
-
}
|
685
|
-
|
686
360
|
/*
|
687
361
|
* call-seq:
|
688
362
|
* XML.default_compression -> (true|false)
|
@@ -869,27 +543,10 @@ void rxml_init_xml(void)
|
|
869
543
|
rb_define_module_function(mXML, "catalog_dump", rxml_catalog_dump, 0);
|
870
544
|
rb_define_module_function(mXML, "catalog_remove", rxml_catalog_remove, 1);
|
871
545
|
rb_define_module_function(mXML, "check_lib_versions", rxml_check_lib_versions, 0);
|
872
|
-
rb_define_module_function(mXML, "debug_entities", rxml_debug_entities_get, 0);
|
873
|
-
rb_define_module_function(mXML, "debug_entities=", rxml_debug_entities_set, 1);
|
874
546
|
rb_define_module_function(mXML, "default_compression", rxml_default_compression_get, 0);
|
875
547
|
rb_define_module_function(mXML, "default_compression=", rxml_default_compression_set, 1);
|
876
|
-
rb_define_module_function(mXML, "default_keep_blanks", rxml_default_keep_blanks_get, 0);
|
877
|
-
rb_define_module_function(mXML, "default_keep_blanks=", rxml_default_keep_blanks_set, 1);
|
878
|
-
rb_define_module_function(mXML, "default_load_external_dtd", rxml_default_load_external_dtd_get, 0);
|
879
|
-
rb_define_module_function(mXML, "default_load_external_dtd=", rxml_default_load_external_dtd_set, 1);
|
880
|
-
rb_define_module_function(mXML, "default_line_numbers", rxml_default_line_numbers_get, 0);
|
881
|
-
rb_define_module_function(mXML, "default_line_numbers=", rxml_default_line_numbers_set, 1);
|
882
|
-
rb_define_module_function(mXML, "default_options", rxml_default_options_get, 0);
|
883
|
-
rb_define_module_function(mXML, "default_pedantic_parser", rxml_default_pedantic_parser_get, 0);
|
884
|
-
rb_define_module_function(mXML, "default_pedantic_parser=", rxml_default_pedantic_parser_set, 1);
|
885
|
-
rb_define_module_function(mXML, "default_substitute_entities", rxml_default_substitute_entities_get, 0);
|
886
|
-
rb_define_module_function(mXML, "default_substitute_entities=", rxml_default_substitute_entities_set, 1);
|
887
548
|
rb_define_module_function(mXML, "default_tree_indent_string", rxml_default_tree_indent_string_get, 0);
|
888
549
|
rb_define_module_function(mXML, "default_tree_indent_string=", rxml_default_tree_indent_string_set, 1);
|
889
|
-
rb_define_module_function(mXML, "default_validity_checking", rxml_default_validity_checking_get, 0);
|
890
|
-
rb_define_module_function(mXML, "default_validity_checking=", rxml_default_validity_checking_set, 1);
|
891
|
-
rb_define_module_function(mXML, "default_warnings", rxml_default_warnings_get, 0);
|
892
|
-
rb_define_module_function(mXML, "default_warnings=", rxml_default_warnings_set, 1);
|
893
550
|
rb_define_module_function(mXML, "default_save_no_empty_tags", rxml_default_save_no_empty_tags_get, 0);
|
894
551
|
rb_define_module_function(mXML, "default_save_no_empty_tags=", rxml_default_save_no_empty_tags_set, 1);
|
895
552
|
rb_define_module_function(mXML, "indent_tree_output", rxml_indent_tree_output_get, 0);
|
data/ext/libxml/ruby_xml.h
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
2
|
-
|
3
|
-
#ifndef __RUBY_XML_H__
|
4
|
-
#define __RUBY_XML_H__
|
5
|
-
|
6
|
-
extern VALUE mXML;
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
#endif
|
1
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
2
|
+
|
3
|
+
#ifndef __RUBY_XML_H__
|
4
|
+
#define __RUBY_XML_H__
|
5
|
+
|
6
|
+
extern VALUE mXML;
|
7
|
+
void rxml_init_xml(void);
|
8
|
+
|
9
|
+
#endif
|
@@ -542,7 +542,7 @@ static VALUE rxml_document_import(VALUE self, VALUE node)
|
|
542
542
|
xresult = xmlDocCopyNode(xnode, xdoc, 1);
|
543
543
|
|
544
544
|
if (xresult == NULL)
|
545
|
-
rxml_raise(
|
545
|
+
rxml_raise(xmlGetLastError());
|
546
546
|
|
547
547
|
return rxml_node_wrap(xresult);
|
548
548
|
}
|
@@ -808,7 +808,7 @@ static VALUE rxml_document_save(int argc, VALUE *argv, VALUE self)
|
|
808
808
|
length = xmlSaveFormatFileEnc(xfilename, xdoc, (const char*)xencoding, indent);
|
809
809
|
|
810
810
|
if (length == -1)
|
811
|
-
rxml_raise(
|
811
|
+
rxml_raise(xmlGetLastError());
|
812
812
|
|
813
813
|
return (INT2NUM(length));
|
814
814
|
}
|
@@ -958,7 +958,7 @@ static VALUE rxml_document_xinclude(VALUE self)
|
|
958
958
|
}
|
959
959
|
else
|
960
960
|
{
|
961
|
-
rxml_raise(
|
961
|
+
rxml_raise(xmlGetLastError());
|
962
962
|
return Qnil;
|
963
963
|
}
|
964
964
|
#else
|
@@ -1007,7 +1007,7 @@ static VALUE rxml_document_validate_schema(VALUE self, VALUE schema)
|
|
1007
1007
|
xmlSchemaFreeValidCtxt(vptr);
|
1008
1008
|
if (is_invalid)
|
1009
1009
|
{
|
1010
|
-
rxml_raise(
|
1010
|
+
rxml_raise(xmlGetLastError());
|
1011
1011
|
return Qfalse;
|
1012
1012
|
}
|
1013
1013
|
else
|
@@ -1040,7 +1040,7 @@ static VALUE rxml_document_validate_relaxng(VALUE self, VALUE relaxng)
|
|
1040
1040
|
xmlRelaxNGFreeValidCtxt(vptr);
|
1041
1041
|
if (is_invalid)
|
1042
1042
|
{
|
1043
|
-
rxml_raise(
|
1043
|
+
rxml_raise(xmlGetLastError());
|
1044
1044
|
return Qfalse;
|
1045
1045
|
}
|
1046
1046
|
else
|
@@ -1075,7 +1075,7 @@ static VALUE rxml_document_validate_dtd(VALUE self, VALUE dtd)
|
|
1075
1075
|
}
|
1076
1076
|
else
|
1077
1077
|
{
|
1078
|
-
rxml_raise(
|
1078
|
+
rxml_raise(xmlGetLastError());
|
1079
1079
|
return Qfalse;
|
1080
1080
|
}
|
1081
1081
|
}
|
@@ -1,11 +1,11 @@
|
|
1
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
2
|
-
|
3
|
-
#ifndef __RXML_DOCUMENT__
|
4
|
-
#define __RXML_DOCUMENT__
|
5
|
-
|
6
|
-
extern VALUE cXMLDocument;
|
7
|
-
void rxml_init_document();
|
8
|
-
VALUE rxml_document_wrap(xmlDocPtr xnode);
|
9
|
-
|
10
|
-
typedef xmlChar * xmlCharPtr;
|
11
|
-
#endif
|
1
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
2
|
+
|
3
|
+
#ifndef __RXML_DOCUMENT__
|
4
|
+
#define __RXML_DOCUMENT__
|
5
|
+
|
6
|
+
extern VALUE cXMLDocument;
|
7
|
+
void rxml_init_document(void);
|
8
|
+
VALUE rxml_document_wrap(xmlDocPtr xnode);
|
9
|
+
|
10
|
+
typedef xmlChar * xmlCharPtr;
|
11
|
+
#endif
|