libxml-ruby 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/CHANGES +28 -0
  2. data/README +8 -12
  3. data/ext/libxml/cbg.c +86 -86
  4. data/ext/libxml/libxml.c +875 -899
  5. data/ext/libxml/ruby_libxml.h +91 -65
  6. data/ext/libxml/ruby_xml_attr.c +485 -485
  7. data/ext/libxml/ruby_xml_attr.h +3 -3
  8. data/ext/libxml/ruby_xml_attributes.h +2 -2
  9. data/ext/libxml/ruby_xml_document.c +124 -307
  10. data/ext/libxml/ruby_xml_document.h +3 -3
  11. data/ext/libxml/ruby_xml_dtd.c +119 -119
  12. data/ext/libxml/ruby_xml_dtd.h +2 -2
  13. data/ext/libxml/ruby_xml_error.c +1 -1
  14. data/ext/libxml/ruby_xml_error.h +2 -2
  15. data/ext/libxml/ruby_xml_html_parser.c +119 -119
  16. data/ext/libxml/ruby_xml_html_parser.h +3 -3
  17. data/ext/libxml/ruby_xml_input.c +13 -11
  18. data/ext/libxml/ruby_xml_input.h +3 -3
  19. data/ext/libxml/ruby_xml_input_cbg.c +197 -197
  20. data/ext/libxml/ruby_xml_namespace.c +158 -0
  21. data/ext/libxml/ruby_xml_namespace.h +12 -0
  22. data/ext/libxml/ruby_xml_namespaces.c +303 -0
  23. data/ext/libxml/{ruby_xml_ns.h → ruby_xml_namespaces.h} +4 -5
  24. data/ext/libxml/ruby_xml_node.c +88 -293
  25. data/ext/libxml/ruby_xml_node.h +4 -4
  26. data/ext/libxml/ruby_xml_parser.c +152 -152
  27. data/ext/libxml/ruby_xml_parser.h +3 -3
  28. data/ext/libxml/ruby_xml_parser_context.c +630 -657
  29. data/ext/libxml/ruby_xml_parser_context.h +3 -3
  30. data/ext/libxml/ruby_xml_reader.c +899 -904
  31. data/ext/libxml/ruby_xml_reader.h +2 -2
  32. data/ext/libxml/ruby_xml_relaxng.h +2 -2
  33. data/ext/libxml/ruby_xml_sax_parser.c +175 -175
  34. data/ext/libxml/ruby_xml_sax_parser.h +3 -3
  35. data/ext/libxml/ruby_xml_schema.c +165 -165
  36. data/ext/libxml/ruby_xml_schema.h +2 -2
  37. data/ext/libxml/ruby_xml_state.h +2 -2
  38. data/ext/libxml/ruby_xml_xinclude.c +24 -24
  39. data/ext/libxml/ruby_xml_xinclude.h +3 -3
  40. data/ext/libxml/ruby_xml_xpath.c +108 -108
  41. data/ext/libxml/ruby_xml_xpath.h +3 -3
  42. data/ext/libxml/ruby_xml_xpath_context.c +84 -35
  43. data/ext/libxml/ruby_xml_xpath_context.h +3 -3
  44. data/ext/libxml/ruby_xml_xpath_expression.c +5 -7
  45. data/ext/libxml/ruby_xml_xpath_expression.h +2 -2
  46. data/ext/libxml/ruby_xml_xpath_object.c +7 -7
  47. data/ext/libxml/ruby_xml_xpath_object.h +2 -2
  48. data/ext/libxml/ruby_xml_xpointer.c +107 -107
  49. data/ext/libxml/ruby_xml_xpointer.h +3 -3
  50. data/ext/libxml/version.h +2 -2
  51. data/ext/vc/libxml_ruby.vcproj +13 -5
  52. data/lib/libxml.rb +4 -1
  53. data/lib/libxml/document.rb +40 -6
  54. data/lib/libxml/hpricot.rb +76 -76
  55. data/lib/libxml/namespace.rb +60 -0
  56. data/lib/libxml/namespaces.rb +36 -0
  57. data/lib/libxml/node.rb +90 -26
  58. data/lib/libxml/ns.rb +20 -0
  59. data/test/model/bands.xml +5 -0
  60. data/test/tc_attributes.rb +1 -1
  61. data/test/tc_document.rb +24 -41
  62. data/test/tc_document_write.rb +87 -115
  63. data/test/tc_namespace.rb +59 -0
  64. data/test/tc_namespaces.rb +174 -0
  65. data/test/tc_node.rb +41 -33
  66. data/test/tc_node_copy.rb +1 -1
  67. data/test/tc_node_edit.rb +6 -0
  68. data/test/tc_node_write.rb +76 -0
  69. data/test/tc_xinclude.rb +2 -9
  70. data/test/tc_xpath.rb +38 -11
  71. data/test/test_suite.rb +3 -1
  72. metadata +16 -9
  73. data/ext/libxml/ruby_xml_ns.c +0 -150
  74. data/test/ets_copy_bug.rb +0 -21
  75. data/test/ets_copy_bug3.rb +0 -38
  76. data/test/model/default_validation_bug.rb +0 -0
  77. data/test/tc_ns.rb +0 -18
@@ -1,9 +1,9 @@
1
- /* $Id: ruby_xml_attr.h 612 2008-11-21 08:01:29Z cfis $ */
1
+ /* $Id: ruby_xml_attr.h 666 2008-12-07 00:16:50Z cfis $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
5
- #ifndef __rxml_ATTR__
6
- #define __rxml_ATTR__
5
+ #ifndef __RXML_ATTR__
6
+ #define __RXML_ATTR__
7
7
 
8
8
  extern VALUE cXMLAttr;
9
9
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
5
- #ifndef __rxml_ATTRIBUTES__
6
- #define __rxml_ATTRIBUTES__
5
+ #ifndef __RXML_ATTRIBUTES__
6
+ #define __RXML_ATTRIBUTES__
7
7
 
8
8
  extern VALUE cXMLAttributesibutes;
9
9
 
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_document.c 650 2008-11-30 03:40:22Z cfis $ */
1
+ /* $Id: ruby_xml_document.c 671 2008-12-08 06:06:10Z cfis $ */
2
2
 
3
3
  /*
4
4
  * Document-class: LibXML::XML::Document
@@ -60,6 +60,21 @@
60
60
 
61
61
  VALUE cXMLDocument;
62
62
 
63
+ static void LibXML_validity_warning(void * ctxt, const char * msg, va_list ap)
64
+ {
65
+ if (rb_block_given_p())
66
+ {
67
+ char buff[1024];
68
+ snprintf(buff, 1024, msg, ap);
69
+ rb_yield(rb_ary_new3(2, rb_str_new2(buff), Qfalse));
70
+ }
71
+ else
72
+ {
73
+ fprintf(stderr, "warning -- found validity error: ");
74
+ fprintf(stderr, msg, ap);
75
+ }
76
+ }
77
+
63
78
  void rxml_document_free(xmlDocPtr xdoc)
64
79
  {
65
80
  xdoc->_private = NULL;
@@ -251,205 +266,27 @@ static VALUE rxml_document_child_q(VALUE self)
251
266
  return (Qtrue);
252
267
  }
253
268
 
254
- /*
255
- * call-seq:
256
- * document.dump([stream]) -> true
257
- *
258
- * Dump this document's XML to the specified IO stream.
259
- * If no stream is specified, stdout is used.
260
- */
261
- static VALUE rxml_document_dump(int argc, VALUE *argv, VALUE self)
262
- {
263
- OpenFile *fptr;
264
- VALUE io;
265
- FILE *out;
266
- xmlDocPtr xdoc;
267
-
268
- Data_Get_Struct(self, xmlDoc, xdoc);
269
- if (xdoc == NULL)
270
- return (Qnil);
271
-
272
- switch (argc)
273
- {
274
- case 0:
275
- io = rb_stdout;
276
- break;
277
- case 1:
278
- io = argv[0];
279
- if (!rb_obj_is_kind_of(io, rb_cIO))
280
- rb_raise(rb_eTypeError, "need an IO object");
281
- break;
282
- default:
283
- rb_raise(rb_eArgError, "wrong number of arguments (0 or 1)");
284
- }
285
-
286
- GetOpenFile(io, fptr);
287
- rb_io_check_writable(fptr);
288
- out = GetWriteFile(fptr);
289
- xmlDocDump(out, xdoc);
290
- return (Qtrue);
291
- }
292
-
293
- /*
294
- * call-seq:
295
- * document.debug_dump([stream]) -> true
296
- *
297
- * Debug version of dump.
298
- */
299
- static VALUE rxml_document_debug_dump(int argc, VALUE *argv, VALUE self)
300
- {
301
- #ifdef LIBXML_DEBUG_ENABLED
302
- OpenFile *fptr;
303
- VALUE io;
304
- FILE *out;
305
- xmlDocPtr xdoc;
306
-
307
- Data_Get_Struct(self, xmlDoc, xdoc);
308
- if (xdoc == NULL)
309
- return(Qnil);
310
-
311
- switch (argc)
312
- {
313
- case 0:
314
- io = rb_stderr;
315
- break;
316
- case 1:
317
- io = argv[0];
318
- if (!rb_obj_is_kind_of(io, rb_cIO))
319
- rb_raise(rb_eTypeError, "need an IO object");
320
- break;
321
- default:
322
- rb_raise(rb_eArgError, "wrong number of arguments (0 or 1)");
323
- }
324
-
325
- GetOpenFile(io, fptr);
326
- rb_io_check_writable(fptr);
327
- out = GetWriteFile(fptr);
328
- xmlDebugDumpDocument(out, xdoc);
329
- return(Qtrue);
330
- #else
331
- rb_warn(
332
- "libxml was compiled without debugging support. Please recompile libxml and ruby-libxml");
333
- return (Qfalse);
334
- #endif
335
- }
336
269
 
337
270
  /*
338
271
  * call-seq:
339
- * document.debug_dump_head([stream]) -> true
272
+ * node.debug -> true|false
340
273
  *
341
- * Debug-dump this document's header to the specified IO stream.
342
- * If no stream is specified, stdout is used.
343
- */
344
- static VALUE rxml_document_debug_dump_head(int argc, VALUE *argv, VALUE self)
274
+ * Print libxml debugging information to stdout.
275
+ * Requires that libxml was compiled with debugging enabled.
276
+ */
277
+ static VALUE rxml_document_debug(VALUE self)
345
278
  {
346
279
  #ifdef LIBXML_DEBUG_ENABLED
347
- OpenFile *fptr;
348
- VALUE io;
349
- FILE *out;
350
280
  xmlDocPtr xdoc;
351
-
352
281
  Data_Get_Struct(self, xmlDoc, xdoc);
353
- if (xdoc == NULL)
354
- return(Qnil);
355
-
356
- switch (argc)
357
- {
358
- case 0:
359
- io = rb_stdout;
360
- break;
361
- case 1:
362
- io = argv[0];
363
- if (!rb_obj_is_kind_of(io, rb_cIO))
364
- rb_raise(rb_eTypeError, "need an IO object");
365
- break;
366
- default:
367
- rb_raise(rb_eArgError, "wrong number of arguments (0 or 1)");
368
- }
369
-
370
- GetOpenFile(io, fptr);
371
- rb_io_check_writable(fptr);
372
- out = GetWriteFile(fptr);
373
- xmlDebugDumpDocumentHead(out, xdoc);
374
- return(Qtrue);
282
+ xmlDebugDumpDocument(NULL, xdoc);
283
+ return Qtrue;
375
284
  #else
376
- rb_warn(
377
- "libxml was compiled without debugging support. Please recompile libxml and ruby-libxml");
378
- return (Qfalse);
285
+ rb_warn("libxml was compiled without debugging support.")
286
+ return Qfalse;
379
287
  #endif
380
288
  }
381
289
 
382
- /*
383
- * call-seq:
384
- * document.format_dump([stream], [spacing]) -> true
385
- *
386
- * Dump this document's formatted XML to the specified IO stream.
387
- * If no stream is specified, stdout is used. If spacing is
388
- * specified, it must be a boolean that determines whether
389
- * spacing is used.
390
- */
391
- static VALUE rxml_document_format_dump(int argc, VALUE *argv, VALUE self)
392
- {
393
- OpenFile *fptr;
394
- VALUE bool, io;
395
- FILE *out;
396
- xmlDocPtr xdoc;
397
-
398
- int size, spacing;
399
-
400
- Data_Get_Struct(self, xmlDoc, xdoc);
401
- if (xdoc == NULL)
402
- return (Qnil);
403
-
404
- switch (argc)
405
- {
406
- case 0:
407
- io = rb_stdout;
408
- spacing = 1;
409
- break;
410
- case 1:
411
- io = argv[0];
412
- if (!rb_obj_is_kind_of(io, rb_cIO))
413
- rb_raise(rb_eTypeError, "need an IO object");
414
- spacing = 1;
415
- break;
416
- case 2:
417
- io = argv[0];
418
- if (!rb_obj_is_kind_of(io, rb_cIO))
419
- rb_raise(rb_eTypeError, "need an IO object");
420
- bool = argv[1];
421
- if (TYPE(bool) == T_TRUE)
422
- spacing = 1;
423
- else if (TYPE(bool) == T_FALSE)
424
- spacing = 0;
425
- else
426
- rb_raise(rb_eTypeError,
427
- "incorect argument type, second argument must be bool");
428
-
429
- break;
430
- default:
431
- rb_raise(rb_eArgError, "wrong number of arguments (0 or 1)");
432
- }
433
-
434
- GetOpenFile(io, fptr);
435
- rb_io_check_writable(fptr);
436
- out = GetWriteFile(fptr);
437
- size = xmlDocFormatDump(out, xdoc, spacing);
438
- return (INT2NUM(size));
439
- }
440
-
441
- /*
442
- * call-seq:
443
- * document.debug_format_dump([stream]) -> true
444
- *
445
- * *Deprecated* in favour of format_dump.
446
- */
447
- static VALUE rxml_document_debug_format_dump(int argc, VALUE *argv, VALUE self)
448
- {
449
- rb_warn("debug_format_dump has been deprecaited, use format_dump instead");
450
- return (rxml_document_format_dump(argc, argv, self));
451
- }
452
-
453
290
  /*
454
291
  * call-seq:
455
292
  * document.encoding -> "encoding"
@@ -479,7 +316,7 @@ static VALUE rxml_document_encoding_set(VALUE self, VALUE encoding)
479
316
 
480
317
  Check_Type(encoding, T_STRING);
481
318
  Data_Get_Struct(self, xmlDoc, xdoc);
482
- xdoc->encoding = xmlStrdup(StringValuePtr(encoding));
319
+ xdoc->encoding = xmlStrdup((xmlChar *)StringValuePtr(encoding));
483
320
  return (rxml_document_encoding_get(self));
484
321
  }
485
322
 
@@ -673,54 +510,61 @@ static VALUE rxml_document_root_set(VALUE self, VALUE node)
673
510
 
674
511
  /*
675
512
  * call-seq:
676
- * document.save(filename, format = false) -> int
513
+ * document.save(filename) -> int
514
+ * document.save(filename, :indent => true, :encoding => 'UTF-8') -> int
677
515
  *
678
- * Save this document to the file given by filename,
679
- * optionally formatting the output.
680
-
681
- * Parameters:
682
- * filename: The filename or URL of the new document
683
- * format: Specifies whether formatting spaces should be added.
684
- * returns: The number of bytes written or -1 in case of error.
685
- */
516
+ * Saves a document to a file. You may provide an optional hash table
517
+ * to control how the string is generated. Valid options are:
518
+ *
519
+ * :indent - Specifies if the string should be indented. The default value
520
+ * is true. Note that indentation is only added if both :indent is
521
+ * true and XML.indent_tree_output is true. If :indent is set to false,
522
+ * then both indentation and line feeds are removed from the result.
523
+ *
524
+ * :encoding - Specifies the output encoding of the string. It
525
+ * defaults to the original encoding of the document (see
526
+ * #encoding. To override the orginal encoding, use one of the
527
+ * XML::Input encoding constants. */
686
528
  static VALUE rxml_document_save(int argc, VALUE *argv, VALUE self)
687
- {
529
+ {
530
+ VALUE result;
531
+ VALUE options = Qnil;
532
+ VALUE filename = Qnil;
688
533
  xmlDocPtr xdoc;
534
+ int indent = 1;
535
+ const char *xfilename;
536
+ const char *encoding;
537
+ xmlChar *buffer;
538
+ int length;
689
539
 
690
- const char *filename;
691
- int format = 0;
692
- int len;
540
+ rb_scan_args(argc, argv, "11", &filename, &options);
693
541
 
694
- if (argc < 1 || argc > 2)
695
- rb_raise(rb_eArgError, "wrong number of arguments (need 1 or 2)");
542
+ Check_Type(filename, T_STRING);
543
+ xfilename = StringValuePtr(filename);
696
544
 
697
- Check_Type(argv[0], T_STRING);
698
- filename = StringValuePtr(argv[0]);
545
+ Data_Get_Struct(self, xmlDoc, xdoc);
546
+ encoding = xdoc->encoding;
699
547
 
700
- if (argc == 2)
548
+ if (!NIL_P(options))
701
549
  {
702
- switch (TYPE(argv[1]))
703
- {
704
- case T_TRUE:
705
- format = 1;
706
- break;
707
- case T_FALSE:
708
- format = 0;
709
- break;
710
- default:
711
- rb_raise(rb_eArgError,
712
- "The second parameter (format) must be true or false");
713
- }
550
+ VALUE rencoding, rindent;
551
+ Check_Type(options, T_HASH);
552
+ rencoding = rb_hash_aref(options, ID2SYM(rb_intern("encoding")));
553
+ rindent = rb_hash_aref(options, ID2SYM(rb_intern("indent")));
554
+
555
+ if (rindent == Qfalse)
556
+ indent = 0;
557
+
558
+ if (rencoding != Qnil)
559
+ encoding = RSTRING_PTR(rxml_input_encoding_to_s(cXMLInput, rencoding));
714
560
  }
715
561
 
716
- Data_Get_Struct(self, xmlDoc, xdoc);
717
- len = xmlSaveFormatFileEnc(filename, xdoc, (const char*) xdoc->encoding,
718
- format);
562
+ length = xmlSaveFormatFileEnc(xfilename, xdoc, encoding, indent);
719
563
 
720
- if (len == -1)
721
- rb_raise(rb_eIOError, "Could not write document");
564
+ if (length == -1)
565
+ rxml_raise(&xmlLastError);
722
566
  else
723
- return (INT2NUM(len));
567
+ return (INT2NUM(length));
724
568
  }
725
569
 
726
570
  /*
@@ -742,71 +586,53 @@ static VALUE rxml_document_standalone_q(VALUE self)
742
586
 
743
587
  /*
744
588
  * call-seq:
745
- * document.to_s({format=true,encoding) -> "xml"
589
+ * document.to_s -> "string"
590
+ * document.to_s(:indent => true, :encoding => 'UTF-8') -> "string"
746
591
  *
747
- * Coerce this document to a string representation
748
- * of it's XML. The default is to pretty format, but this
749
- * depends Parser#indent_tree_output==true or
750
- * Parser#default_keep_blanks==false.
592
+ * Converts a document, and all of its children, to a string representation.
593
+ * You may provide an optional hash table to control how the string is
594
+ * generated. Valid options are:
595
+ *
596
+ * :indent - Specifies if the string should be indented. The default value
597
+ * is true. Note that indentation is only added if both :indent is
598
+ * true and XML.indent_tree_output is true. If :indent is set to false,
599
+ * then both indentation and line feeds are removed from the result.
751
600
  *
752
- * The encoding is not applied to the document, but is
753
- * encoding target of the resulting string.
754
- */
601
+ * :encoding - Specifies the output encoding of the string. It
602
+ * defaults to XML::Input::UTF8. To change it, use one of the
603
+ * XML::Input encoding constants. */
755
604
  static VALUE rxml_document_to_s(int argc, VALUE *argv, VALUE self)
756
- {
605
+ {
606
+ VALUE result;
607
+ VALUE options = Qnil;
757
608
  xmlDocPtr xdoc;
609
+ int indent = 1;
610
+ const char *encoding = "UTF-8";
611
+ xmlChar *buffer;
612
+ int length;
758
613
 
759
- xmlChar *result, *encoding = NULL;
760
- int format, len;
761
- VALUE rresult;
614
+ rb_scan_args(argc, argv, "01", &options);
762
615
 
763
- switch (argc)
616
+ if (!NIL_P(options))
764
617
  {
765
- case 0:
766
- format = 1;
767
- break;
768
- case 2:
769
- if (TYPE(argv[1]) == T_STRING)
770
- encoding = (xmlChar *) StringValuePtr(argv[1]);
771
- case 1:
772
- if (TYPE(argv[0]) == T_TRUE)
773
- format = 1;
774
- else if (TYPE(argv[0]) == T_FALSE)
775
- format = 0;
776
- else
777
- rb_raise(rb_eTypeError, "wrong type of argument, must be bool");
778
- break;
779
- default:
780
- rb_raise(rb_eArgError, "wrong number of arguments (0 or 1)");
618
+ VALUE rencoding, rindent;
619
+ Check_Type(options, T_HASH);
620
+ rencoding = rb_hash_aref(options, ID2SYM(rb_intern("encoding")));
621
+ rindent = rb_hash_aref(options, ID2SYM(rb_intern("indent")));
622
+
623
+ if (rindent == Qfalse)
624
+ indent = 0;
625
+
626
+ if (rencoding != Qnil)
627
+ encoding = RSTRING_PTR(rxml_input_encoding_to_s(cXMLInput, rencoding));
781
628
  }
782
629
 
783
630
  Data_Get_Struct(self, xmlDoc, xdoc);
784
- if (xdoc == NULL)
785
- {
786
- return (Qnil);
787
- }
788
- else if (encoding != NULL)
789
- {
790
- if (format)
791
- {
792
- xmlDocDumpFormatMemoryEnc(xdoc, &result, &len, (const char*) encoding,
793
- format);
794
- }
795
- else
796
- {
797
- xmlDocDumpMemoryEnc(xdoc, &result, &len, (const char *) encoding);
798
- }
799
- }
800
- else
801
- {
802
- if (format)
803
- xmlDocDumpFormatMemory(xdoc, &result, &len, format);
804
- else
805
- xmlDocDumpMemory(xdoc, &result, &len);
806
- }
807
- rresult = rb_str_new((const char*) result, len);
808
- xmlFree(result);
809
- return rresult;
631
+ xmlDocDumpFormatMemoryEnc(xdoc, &buffer, &length, encoding, indent);
632
+
633
+ result = rb_str_new((const char*) buffer, length);
634
+ xmlFree(buffer);
635
+ return result;
810
636
  }
811
637
 
812
638
  /*
@@ -889,19 +715,19 @@ void LibXML_validity_error(void * ctxt, const char * msg, va_list ap)
889
715
  }
890
716
  }
891
717
 
892
- void LibXML_validity_warning(void * ctxt, const char * msg, va_list ap)
718
+ /*
719
+ * call-seq:
720
+ * document.order_elements!
721
+ *
722
+ * Call this routine to speed up XPath computation on static documents.
723
+ * This stamps all the element nodes with the document order.
724
+ */
725
+ static VALUE rxml_document_order_elements(VALUE self)
893
726
  {
894
- if (rb_block_given_p())
895
- {
896
- char buff[1024];
897
- snprintf(buff, 1024, msg, ap);
898
- rb_yield(rb_ary_new3(2, rb_str_new2(buff), Qfalse));
899
- }
900
- else
901
- {
902
- fprintf(stderr, "warning -- found validity error: ");
903
- fprintf(stderr, msg, ap);
904
- }
727
+ xmlDocPtr xdoc;
728
+
729
+ Data_Get_Struct(self, xmlDoc, xdoc);
730
+ return LONG2FIX(xmlXPathOrderDocElems(xdoc));
905
731
  }
906
732
 
907
733
  /*
@@ -1044,24 +870,17 @@ void ruby_init_xml_document(void)
1044
870
  rb_define_method(cXMLDocument, "initialize", rxml_document_initialize, -1);
1045
871
  rb_define_method(cXMLDocument, "child", rxml_document_child_get, 0);
1046
872
  rb_define_method(cXMLDocument, "child?", rxml_document_child_q, 0);
1047
- rb_define_method(cXMLDocument, "compression", rxml_document_compression_get,
1048
- 0);
1049
- rb_define_method(cXMLDocument, "compression=", rxml_document_compression_set,
1050
- 1);
873
+ rb_define_method(cXMLDocument, "compression", rxml_document_compression_get, 0);
874
+ rb_define_method(cXMLDocument, "compression=", rxml_document_compression_set, 1);
1051
875
  rb_define_method(cXMLDocument, "compression?", rxml_document_compression_q, 0);
1052
- rb_define_method(cXMLDocument, "dump", rxml_document_dump, -1);
1053
- rb_define_method(cXMLDocument, "debug_dump", rxml_document_debug_dump, -1);
1054
- rb_define_method(cXMLDocument, "debug_dump_head",
1055
- rxml_document_debug_dump_head, -1);
1056
- rb_define_method(cXMLDocument, "debug_format_dump",
1057
- rxml_document_debug_format_dump, -1);
876
+ rb_define_method(cXMLDocument, "debug", rxml_document_debug, 0);
1058
877
  rb_define_method(cXMLDocument, "encoding", rxml_document_encoding_get, 0);
1059
878
  rb_define_method(cXMLDocument, "encoding=", rxml_document_encoding_set, 1);
1060
- rb_define_method(cXMLDocument, "format_dump", rxml_document_format_dump, -1);
1061
879
  rb_define_method(cXMLDocument, "last", rxml_document_last_get, 0);
1062
880
  rb_define_method(cXMLDocument, "last?", rxml_document_last_q, 0);
1063
881
  rb_define_method(cXMLDocument, "next", rxml_document_next_get, 0);
1064
882
  rb_define_method(cXMLDocument, "next?", rxml_document_next_q, 0);
883
+ rb_define_method(cXMLDocument, "order_elements!", rxml_document_order_elements, 0);
1065
884
  rb_define_method(cXMLDocument, "parent", rxml_document_parent_get, 0);
1066
885
  rb_define_method(cXMLDocument, "parent?", rxml_document_parent_q, 0);
1067
886
  rb_define_method(cXMLDocument, "prev", rxml_document_prev_get, 0);
@@ -1075,9 +894,7 @@ void ruby_init_xml_document(void)
1075
894
  rb_define_method(cXMLDocument, "version", rxml_document_version_get, 0);
1076
895
  rb_define_method(cXMLDocument, "xinclude", rxml_document_xinclude, 0);
1077
896
  rb_define_method(cXMLDocument, "validate", rxml_document_validate_dtd, 1);
1078
- rb_define_method(cXMLDocument, "validate_schema",
1079
- rxml_document_validate_schema, 1);
1080
- rb_define_method(cXMLDocument, "validate_relaxng",
1081
- rxml_document_validate_relaxng, 1);
897
+ rb_define_method(cXMLDocument, "validate_schema", rxml_document_validate_schema, 1);
898
+ rb_define_method(cXMLDocument, "validate_relaxng", rxml_document_validate_relaxng, 1);
1082
899
  rb_define_method(cXMLDocument, "reader", rxml_document_reader, 0);
1083
900
  }