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
@@ -2,11 +2,10 @@
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
5
- #ifndef __rxml_NS__
6
- #define __rxml_NS__
5
+ #ifndef __RXML_NAMESPACES__
6
+ #define __RXML_NAMESPACES__
7
7
 
8
- extern VALUE cXMLNS;
8
+ extern VALUE cXMLNamespaces;
9
9
 
10
- void ruby_init_xml_ns(void);
11
- VALUE rxml_ns_wrap(xmlNsPtr ns);
10
+ void ruby_init_xml_namespaces(void);
12
11
  #endif
@@ -1,7 +1,3 @@
1
- /* $Id: ruby_xml_node.c 650 2008-11-30 03:40:22Z cfis $ */
2
-
3
- /* Please see the LICENSE file for copyright and distribution information */
4
-
5
1
  #include "ruby_libxml.h"
6
2
  #include "ruby_xml_node.h"
7
3
 
@@ -88,7 +84,7 @@ void rxml_node_mark(xmlNodePtr xnode)
88
84
  rxml_node_mark_common(xnode);
89
85
  }
90
86
 
91
- VALUE rxml_node_wrap(VALUE class, xmlNodePtr xnode)
87
+ VALUE rxml_node_wrap(VALUE klass, xmlNodePtr xnode)
92
88
  {
93
89
  VALUE obj;
94
90
 
@@ -98,7 +94,7 @@ VALUE rxml_node_wrap(VALUE class, xmlNodePtr xnode)
98
94
  return (VALUE) xnode->_private;
99
95
  }
100
96
 
101
- obj = Data_Wrap_Struct(class, rxml_node_mark, rxml_node2_free, xnode);
97
+ obj = Data_Wrap_Struct(klass, rxml_node_mark, rxml_node2_free, xnode);
102
98
 
103
99
  xnode->_private = (void*) obj;
104
100
  return obj;
@@ -341,6 +337,26 @@ static VALUE rxml_node_content_stripped_get(VALUE self)
341
337
  return (result);
342
338
  }
343
339
 
340
+ /*
341
+ * call-seq:
342
+ * node.debug -> true|false
343
+ *
344
+ * Print libxml debugging information to stdout.
345
+ * Requires that libxml was compiled with debugging enabled.
346
+ */
347
+ static VALUE rxml_node_debug(VALUE self)
348
+ {
349
+ #ifdef LIBXML_DEBUG_ENABLED
350
+ xmlNodePtr xnode;
351
+ Data_Get_Struct(self, xmlNode, xnode);
352
+ xmlDebugDumpNode(NULL, xnode, 2);
353
+ return Qtrue;
354
+ #else
355
+ rb_warn("libxml was compiled without debugging support.")
356
+ return Qfalse;
357
+ #endif
358
+ }
359
+
344
360
  /*
345
361
  * call-seq:
346
362
  * node.first -> XML::Node
@@ -496,46 +512,72 @@ static VALUE rxml_node_doc(VALUE self)
496
512
 
497
513
  /*
498
514
  * call-seq:
499
- * node.dump -> (true|nil)
515
+ * node.to_s -> "string"
516
+ * node.to_s(:indent => true, :encoding => 'UTF-8', :level => 0) -> "string"
500
517
  *
501
- * Dump this node to stdout.
502
- */
503
- static VALUE rxml_node_dump(VALUE self)
518
+ * Converts a node, and all of its children, to a string representation.
519
+ * You may provide an optional hash table to control how the string is
520
+ * generated. Valid options are:
521
+ *
522
+ * :indent - Specifies if the string should be indented. The default value
523
+ * is true. Note that indentation is only added if both :indent is
524
+ * true and XML.indent_tree_output is true. If :indent is set to false,
525
+ * then both indentation and line feeds are removed from the result.
526
+ *
527
+ * :level - Specifies the indentation level. The amount of indentation
528
+ * is equal to the (level * number_spaces) + number_spaces, where libxml
529
+ * defaults the number of spaces to 2. Thus a level of 0 results in
530
+ * 2 spaces, level 1 results in 4 spaces, level 2 results in 6 spaces, etc.
531
+ *
532
+ * :encoding - Specifies the output encoding of the string. It
533
+ * defaults to XML::Input::UTF8. To change it, use one of the
534
+ * XML::Input encoding constants. */
535
+
536
+ static VALUE rxml_node_to_s(int argc, VALUE *argv, VALUE self)
504
537
  {
538
+ VALUE options = Qnil;
505
539
  xmlNodePtr xnode;
506
- xmlBufferPtr buf;
540
+ xmlCharEncodingHandlerPtr encodingHandler;
541
+ xmlOutputBufferPtr output;
507
542
 
508
- Data_Get_Struct(self, xmlNode, xnode);
543
+ int level = 0;
544
+ int indent = 1;
545
+ const char *encoding = "UTF-8";
509
546
 
510
- if (xnode->doc == NULL)
511
- return (Qnil);
547
+ rb_scan_args(argc, argv, "01", &options);
512
548
 
513
- buf = xmlBufferCreate();
514
- xmlNodeDump(buf, xnode->doc, xnode, 0, 1);
515
- xmlBufferDump(stdout, buf);
516
- xmlBufferFree(buf);
517
- return (Qtrue);
518
- }
549
+ if (!NIL_P(options))
550
+ {
551
+ VALUE rencoding, rindent, rlevel;
552
+ Check_Type(options, T_HASH);
553
+ rencoding = rb_hash_aref(options, ID2SYM(rb_intern("encoding")));
554
+ rindent = rb_hash_aref(options, ID2SYM(rb_intern("indent")));
555
+ rlevel = rb_hash_aref(options, ID2SYM(rb_intern("level")));
519
556
 
520
- /*
521
- * call-seq:
522
- * node.debug_dump -> (true|nil)
523
- *
524
- * Dump this node to stdout, including any debugging
525
- * information.
526
- */
527
- static VALUE rxml_node_debug_dump(VALUE self)
528
- {
529
- xmlNodePtr xnode;
530
- Data_Get_Struct(self, xmlNode, xnode);
557
+ if (rindent == Qfalse)
558
+ indent = 0;
531
559
 
532
- if (xnode->doc == NULL)
533
- return (Qnil);
560
+ if (rlevel != Qnil)
561
+ level = NUM2INT(rlevel);
534
562
 
535
- xmlElemDump(stdout, xnode->doc, xnode);
536
- return (Qtrue);
563
+ if (rencoding != Qnil)
564
+ encoding = RSTRING_PTR(rxml_input_encoding_to_s(cXMLInput, rencoding));
565
+ }
566
+
567
+ encodingHandler = xmlFindCharEncodingHandler(encoding);
568
+ output = xmlAllocOutputBuffer(encodingHandler);
569
+
570
+ Data_Get_Struct(self, xmlNode, xnode);
571
+ xmlNodeDumpOutput(output, xnode->doc, xnode, level, indent, encoding);
572
+ xmlOutputBufferFlush(output);
573
+
574
+ if (output->conv)
575
+ return rb_str_new2((const char*) output->conv->content);
576
+ else
577
+ return rb_str_new2((const char*) output->buffer->content);
537
578
  }
538
579
 
580
+
539
581
  /*
540
582
  * call-seq:
541
583
  * node.each -> XML::Node
@@ -579,7 +621,6 @@ static VALUE rxml_node_empty_q(VALUE self)
579
621
  return ((xmlIsBlankNode(xnode) == 1) ? Qtrue : Qfalse);
580
622
  }
581
623
 
582
- static VALUE rxml_node_to_s(VALUE self);
583
624
 
584
625
  /*
585
626
  * call-seq:
@@ -593,7 +634,7 @@ if(self == other)
593
634
  {
594
635
  return Qtrue;
595
636
  }
596
- else if NIL_P(other)
637
+ else if (NIL_P(other))
597
638
  {
598
639
  return Qfalse;
599
640
  }
@@ -605,8 +646,8 @@ else
605
646
  if (rb_obj_is_kind_of(other, cXMLNode) == Qfalse)
606
647
  rb_raise(rb_eTypeError, "Nodes can only be compared against other nodes");
607
648
 
608
- self_xml = rxml_node_to_s(self);
609
- other_xml = rxml_node_to_s(other);
649
+ self_xml = rxml_node_to_s(0, NULL, self);
650
+ other_xml = rxml_node_to_s(0, NULL, other);
610
651
  return(rb_funcall(self_xml, rb_intern("=="), 1, other_xml));
611
652
  }
612
653
  }
@@ -836,134 +877,6 @@ static VALUE rxml_node_name_set(VALUE self, VALUE name)
836
877
  return (Qtrue);
837
878
  }
838
879
 
839
- /*
840
- * call-seq:
841
- * node.namespace -> [namespace, ..., namespace]
842
- *
843
- * Obtain an array of +XML::NS+ objects representing
844
- * this node's xmlns attributes
845
- */
846
- static VALUE rxml_node_namespace_get(VALUE self)
847
- {
848
- xmlNodePtr xnode;
849
- xmlNsPtr *nsList, *cur;
850
- VALUE arr, ns;
851
-
852
- Data_Get_Struct(self, xmlNode, xnode);
853
- if (xnode == NULL)
854
- return (Qnil);
855
-
856
- nsList = xmlGetNsList(xnode->doc, xnode);
857
-
858
- if (nsList == NULL)
859
- return (Qnil);
860
-
861
- arr = rb_ary_new();
862
- for (cur = nsList; *cur != NULL; cur++)
863
- {
864
- ns = rxml_ns_wrap(*cur);
865
- if (ns == Qnil)
866
- continue;
867
- else
868
- rb_ary_push(arr, ns);
869
- }
870
- xmlFree(nsList);
871
-
872
- return (arr);
873
- }
874
-
875
- /*
876
- * call-seq:
877
- * node.namespace_node -> namespace.
878
- *
879
- * Obtain this node's namespace node.
880
- */
881
- static VALUE rxml_node_namespace_get_node(VALUE self)
882
- {
883
- xmlNodePtr xnode;
884
-
885
- Data_Get_Struct(self, xmlNode, xnode);
886
- if (xnode->ns == NULL)
887
- return (Qnil);
888
- else
889
- return rxml_ns_wrap(xnode->ns);
890
- }
891
-
892
- // TODO namespace_set can take varargs (in fact, must if used
893
- // with strings), but I cannot see how you can call
894
- // that version, apart from with 'send'
895
- //
896
- // Would sure be nice to support foo.namespace['foo'] = 'bar'
897
- // but maybe that's not practical...
898
-
899
- /*
900
- * call-seq:
901
- * node.namespace = namespace
902
- *
903
- * Add the specified XML::NS object to this node's xmlns attributes.
904
- */
905
- static VALUE rxml_node_namespace_set(int argc, VALUE *argv, VALUE self)
906
- {
907
- VALUE rns, rprefix;
908
- xmlNodePtr xnode;
909
- xmlNsPtr xns;
910
- char *cp, *href;
911
-
912
- Data_Get_Struct(self, xmlNode, xnode);
913
- switch (argc)
914
- {
915
- case 1:
916
- rns = argv[0];
917
- if (TYPE(rns) == T_STRING)
918
- {
919
- cp = strchr(StringValuePtr(rns), (int) ':');
920
- if (cp == NULL)
921
- {
922
- rprefix = rns;
923
- href = NULL;
924
- }
925
- else
926
- {
927
- rprefix = rb_str_new(StringValuePtr(rns), (int) ((long) cp
928
- - (long) StringValuePtr(rns)));
929
- href = &cp[1]; /* skip the : */
930
- }
931
- }
932
- else if (rb_obj_is_kind_of(rns, cXMLNS) == Qtrue)
933
- {
934
- Data_Get_Struct(self, xmlNs, xns);
935
- xmlSetNs(xnode, xns);
936
- return (rns);
937
- }
938
- else
939
- rb_raise(rb_eTypeError, "must pass a string or an XML::Ns object");
940
-
941
- /* Fall through to next case because when argc == 1, we need to
942
- * manually setup the additional args unless the arg passed is of
943
- * cXMLNS type */
944
- case 2:
945
- /* Don't want this code run in the fall through case */
946
- if (argc == 2)
947
- {
948
- rprefix = argv[0];
949
- href = StringValuePtr(argv[1]);
950
- }
951
-
952
- xns = xmlNewNs(xnode, (xmlChar*) href, (xmlChar*) StringValuePtr(rprefix));
953
- if (xns == NULL)
954
- rxml_raise(&xmlLastError);
955
- else
956
- return rxml_ns_wrap(xns);
957
- break;
958
-
959
- default:
960
- rb_raise(rb_eArgError, "wrong number of arguments (1 or 2)");
961
- }
962
-
963
- /* can't get here */
964
- return (Qnil);
965
- }
966
-
967
880
  /*
968
881
  * call-seq:
969
882
  * node.next -> XML::Node
@@ -1005,55 +918,6 @@ static VALUE rxml_node_next_set(VALUE self, VALUE rnode)
1005
918
  return (rxml_node_wrap(cXMLNode, ret));
1006
919
  }
1007
920
 
1008
- /*
1009
- * call-seq:
1010
- * node.ns? -> (true|false)
1011
- *
1012
- * Determine whether this node has a namespace.
1013
- */
1014
- static VALUE rxml_node_ns_q(VALUE self)
1015
- {
1016
- xmlNodePtr xnode;
1017
- Data_Get_Struct(self, xmlNode, xnode);
1018
- if (xnode->ns == NULL)
1019
- return (Qfalse);
1020
- else
1021
- return (Qtrue);
1022
- }
1023
-
1024
- /*
1025
- * call-seq:
1026
- * node.ns_def? -> (true|false)
1027
- *
1028
- * Obtain an array of +XML::NS+ objects representing
1029
- * this node's xmlns attributes
1030
- */
1031
- static VALUE rxml_node_ns_def_q(VALUE self)
1032
- {
1033
- xmlNodePtr xnode;
1034
- Data_Get_Struct(self, xmlNode, xnode);
1035
- if (xnode->nsDef == NULL)
1036
- return (Qfalse);
1037
- else
1038
- return (Qtrue);
1039
- }
1040
-
1041
- /*
1042
- * call-seq:
1043
- * node.ns_def -> namespace
1044
- *
1045
- * Obtain this node's default namespace.
1046
- */
1047
- static VALUE rxml_node_ns_def_get(VALUE self)
1048
- {
1049
- xmlNodePtr xnode;
1050
- Data_Get_Struct(self, xmlNode, xnode);
1051
- if (xnode->nsDef == NULL)
1052
- return (Qnil);
1053
- else
1054
- return (rxml_ns_wrap(xnode->nsDef));
1055
- }
1056
-
1057
921
  /*
1058
922
  * call-seq:
1059
923
  * node.parent -> XML::Node
@@ -1230,38 +1094,6 @@ static VALUE rxml_node_remove_ex(VALUE self)
1230
1094
  return self;
1231
1095
  }
1232
1096
 
1233
- /*
1234
- * call-seq:
1235
- * node.search_href -> namespace
1236
- *
1237
- * Search for a namespace by href.
1238
- */
1239
- static VALUE rxml_node_search_href(VALUE self, VALUE href)
1240
- {
1241
- xmlNodePtr xnode;
1242
-
1243
- Check_Type(href, T_STRING);
1244
- Data_Get_Struct(self, xmlNode, xnode);
1245
- return (rxml_ns_wrap(xmlSearchNsByHref(xnode->doc, xnode,
1246
- (xmlChar*) StringValuePtr(href))));
1247
- }
1248
-
1249
- /*
1250
- * call-seq:
1251
- * node.search_ns -> namespace
1252
- *
1253
- * Search for a namespace by namespace.
1254
- */
1255
- static VALUE rxml_node_search_ns(VALUE self, VALUE ns)
1256
- {
1257
- xmlNodePtr xnode;
1258
-
1259
- Check_Type(ns, T_STRING);
1260
- Data_Get_Struct(self, xmlNode, xnode);
1261
- return (rxml_ns_wrap(xmlSearchNs(xnode->doc, xnode,
1262
- (xmlChar*) StringValuePtr(ns))));
1263
- }
1264
-
1265
1097
  /*
1266
1098
  * call-seq:
1267
1099
  * node.sibling(node) -> XML::Node
@@ -1324,28 +1156,6 @@ static VALUE rxml_node_space_preserve_set(VALUE self, VALUE bool)
1324
1156
  return (Qnil);
1325
1157
  }
1326
1158
 
1327
- /*
1328
- * call-seq:
1329
- * node.to_s -> "string"
1330
- *
1331
- * Coerce this node to a string representation of
1332
- * it's XML.
1333
- */
1334
- static VALUE rxml_node_to_s(VALUE self)
1335
- {
1336
- xmlNodePtr xnode;
1337
- xmlBufferPtr buf;
1338
- VALUE result;
1339
-
1340
- Data_Get_Struct(self, xmlNode, xnode);
1341
- buf = xmlBufferCreate();
1342
- xmlNodeDump(buf, xnode->doc, xnode, 0, 1);
1343
- result = rb_str_new2((const char*) buf->content);
1344
-
1345
- xmlBufferFree(buf);
1346
- return result;
1347
- }
1348
-
1349
1159
  /*
1350
1160
  * call-seq:
1351
1161
  * node.type -> num
@@ -1430,20 +1240,16 @@ void ruby_init_xml_node(void)
1430
1240
  rb_define_const(cXMLNode, "ELEMENT_NODE", INT2FIX(XML_ELEMENT_NODE));
1431
1241
  rb_define_const(cXMLNode, "ATTRIBUTE_NODE", INT2FIX(XML_ATTRIBUTE_NODE));
1432
1242
  rb_define_const(cXMLNode, "TEXT_NODE", INT2FIX(XML_TEXT_NODE));
1433
- rb_define_const(cXMLNode, "CDATA_SECTION_NODE", INT2FIX(
1434
- XML_CDATA_SECTION_NODE));
1243
+ rb_define_const(cXMLNode, "CDATA_SECTION_NODE", INT2FIX(XML_CDATA_SECTION_NODE));
1435
1244
  rb_define_const(cXMLNode, "ENTITY_REF_NODE", INT2FIX(XML_ENTITY_REF_NODE));
1436
1245
  rb_define_const(cXMLNode, "ENTITY_NODE", INT2FIX(XML_ENTITY_NODE));
1437
1246
  rb_define_const(cXMLNode, "PI_NODE", INT2FIX(XML_PI_NODE));
1438
1247
  rb_define_const(cXMLNode, "COMMENT_NODE", INT2FIX(XML_COMMENT_NODE));
1439
1248
  rb_define_const(cXMLNode, "DOCUMENT_NODE", INT2FIX(XML_DOCUMENT_NODE));
1440
- rb_define_const(cXMLNode, "DOCUMENT_TYPE_NODE", INT2FIX(
1441
- XML_DOCUMENT_TYPE_NODE));
1442
- rb_define_const(cXMLNode, "DOCUMENT_FRAG_NODE", INT2FIX(
1443
- XML_DOCUMENT_FRAG_NODE));
1249
+ rb_define_const(cXMLNode, "DOCUMENT_TYPE_NODE", INT2FIX(XML_DOCUMENT_TYPE_NODE));
1250
+ rb_define_const(cXMLNode, "DOCUMENT_FRAG_NODE", INT2FIX(XML_DOCUMENT_FRAG_NODE));
1444
1251
  rb_define_const(cXMLNode, "NOTATION_NODE", INT2FIX(XML_NOTATION_NODE));
1445
- rb_define_const(cXMLNode, "HTML_DOCUMENT_NODE", INT2FIX(
1446
- XML_HTML_DOCUMENT_NODE));
1252
+ rb_define_const(cXMLNode, "HTML_DOCUMENT_NODE", INT2FIX(XML_HTML_DOCUMENT_NODE));
1447
1253
  rb_define_const(cXMLNode, "DTD_NODE", INT2FIX(XML_DTD_NODE));
1448
1254
  rb_define_const(cXMLNode, "ELEMENT_DECL", INT2FIX(XML_ELEMENT_DECL));
1449
1255
  rb_define_const(cXMLNode, "ATTRIBUTE_DECL", INT2FIX(XML_ATTRIBUTE_DECL));
@@ -1493,11 +1299,9 @@ void ruby_init_xml_node(void)
1493
1299
  rb_define_method(cXMLNode, "copy", rxml_node_copy, 1);
1494
1300
  rb_define_method(cXMLNode, "content", rxml_node_content_get, 0);
1495
1301
  rb_define_method(cXMLNode, "content=", rxml_node_content_set, 1);
1496
- rb_define_method(cXMLNode, "content_stripped",
1497
- rxml_node_content_stripped_get, 0);
1302
+ rb_define_method(cXMLNode, "content_stripped", rxml_node_content_stripped_get, 0);
1303
+ rb_define_method(cXMLNode, "debug", rxml_node_debug, 0);
1498
1304
  rb_define_method(cXMLNode, "doc", rxml_node_doc, 0);
1499
- rb_define_method(cXMLNode, "dump", rxml_node_dump, 0);
1500
- rb_define_method(cXMLNode, "debug_dump", rxml_node_debug_dump, 0);
1501
1305
  rb_define_method(cXMLNode, "empty?", rxml_node_empty_q, 0);
1502
1306
  rb_define_method(cXMLNode, "eql?", rxml_node_eql_q, 1);
1503
1307
  rb_define_method(cXMLNode, "lang", rxml_node_lang_get, 0);
@@ -1505,25 +1309,16 @@ void ruby_init_xml_node(void)
1505
1309
  rb_define_method(cXMLNode, "line_num", rxml_node_line_num, 0);
1506
1310
  rb_define_method(cXMLNode, "name", rxml_node_name_get, 0);
1507
1311
  rb_define_method(cXMLNode, "name=", rxml_node_name_set, 1);
1508
- rb_define_method(cXMLNode, "namespace", rxml_node_namespace_get, 0);
1509
- rb_define_method(cXMLNode, "namespace_node", rxml_node_namespace_get_node, 0);
1510
- rb_define_method(cXMLNode, "namespace=", rxml_node_namespace_set, -1);
1511
1312
  rb_define_method(cXMLNode, "node_type", rxml_node_type, 0);
1512
- rb_define_method(cXMLNode, "ns", rxml_node_namespace_get, 0);
1513
- rb_define_method(cXMLNode, "ns?", rxml_node_ns_q, 0);
1514
- rb_define_method(cXMLNode, "ns_def?", rxml_node_ns_def_q, 0);
1515
- rb_define_method(cXMLNode, "ns_def", rxml_node_ns_def_get, 0);
1516
1313
  rb_define_method(cXMLNode, "path", rxml_node_path, 0);
1517
1314
  rb_define_method(cXMLNode, "pointer", rxml_node_pointer, 1);
1518
1315
  rb_define_method(cXMLNode, "remove!", rxml_node_remove_ex, 0);
1519
- rb_define_method(cXMLNode, "search_ns", rxml_node_search_ns, 1);
1520
- rb_define_method(cXMLNode, "search_href", rxml_node_search_href, 1);
1521
1316
  rb_define_method(cXMLNode, "space_preserve", rxml_node_space_preserve_get, 0);
1522
1317
  rb_define_method(cXMLNode, "space_preserve=", rxml_node_space_preserve_set, 1);
1523
- rb_define_method(cXMLNode, "to_s", rxml_node_to_s, 0);
1318
+ rb_define_method(cXMLNode, "to_s", rxml_node_to_s, -1);
1524
1319
  rb_define_method(cXMLNode, "xlink?", rxml_node_xlink_q, 0);
1525
1320
  rb_define_method(cXMLNode, "xlink_type", rxml_node_xlink_type, 0);
1526
1321
  rb_define_method(cXMLNode, "xlink_type_name", rxml_node_xlink_type_name, 0);
1527
1322
 
1528
1323
  rb_define_alias(cXMLNode, "==", "eql?");
1529
- }
1324
+ }