libxml-ruby 0.3.8.4 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. data/CHANGELOG +6 -0
  2. data/LICENSE +1 -1
  3. data/README +1 -1
  4. data/Rakefile +8 -5
  5. data/TODO +1 -1
  6. data/ext/xml/extconf.rb +4 -5
  7. data/ext/xml/libxml.c +5 -2
  8. data/ext/xml/libxml.h +16 -7
  9. data/ext/xml/libxml.rb +3 -3
  10. data/ext/xml/ruby_xml_attr.c +118 -99
  11. data/ext/xml/ruby_xml_attr.h +4 -7
  12. data/ext/xml/ruby_xml_document.c +131 -170
  13. data/ext/xml/ruby_xml_document.h +5 -9
  14. data/ext/xml/ruby_xml_html_parser.c +453 -0
  15. data/ext/xml/ruby_xml_html_parser.h +29 -0
  16. data/ext/xml/ruby_xml_node.c +219 -253
  17. data/ext/xml/ruby_xml_node.h +4 -7
  18. data/ext/xml/ruby_xml_node_set.c +6 -6
  19. data/ext/xml/ruby_xml_node_set.h +1 -1
  20. data/ext/xml/ruby_xml_ns.c +1 -1
  21. data/ext/xml/ruby_xml_ns.h +1 -1
  22. data/ext/xml/ruby_xml_parser.c +5 -8
  23. data/ext/xml/ruby_xml_parser.h +1 -1
  24. data/ext/xml/ruby_xml_parser_context.c +3 -4
  25. data/ext/xml/ruby_xml_parser_context.h +1 -1
  26. data/ext/xml/ruby_xml_reader.c +893 -0
  27. data/ext/xml/ruby_xml_reader.h +14 -0
  28. data/ext/xml/ruby_xml_sax_parser.c +255 -204
  29. data/ext/xml/ruby_xml_sax_parser.h +6 -2
  30. data/ext/xml/ruby_xml_tree.c +1 -1
  31. data/ext/xml/ruby_xml_tree.h +1 -1
  32. data/ext/xml/ruby_xml_xinclude.c +1 -1
  33. data/ext/xml/ruby_xml_xinclude.h +1 -1
  34. data/ext/xml/ruby_xml_xpath.c +3 -2
  35. data/ext/xml/ruby_xml_xpath.h +1 -1
  36. data/ext/xml/ruby_xml_xpath_context.c +4 -4
  37. data/ext/xml/ruby_xml_xpath_context.h +1 -1
  38. data/ext/xml/ruby_xml_xpointer.c +10 -4
  39. data/ext/xml/ruby_xml_xpointer.h +1 -1
  40. data/ext/xml/ruby_xml_xpointer_context.c +1 -1
  41. data/ext/xml/ruby_xml_xpointer_context.h +1 -1
  42. data/ext/xml/sax_parser_callbacks.inc +55 -54
  43. data/tests/model/rubynet_project +1 -1
  44. data/tests/model/simple.xml +7 -0
  45. data/tests/tc_xml_document.rb +1 -1
  46. data/tests/tc_xml_document_write.rb +1 -1
  47. data/tests/tc_xml_document_write2.rb +1 -1
  48. data/tests/tc_xml_document_write3.rb +1 -1
  49. data/tests/tc_xml_html_parser.rb +60 -0
  50. data/tests/tc_xml_node.rb +1 -1
  51. data/tests/tc_xml_node2.rb +1 -1
  52. data/tests/tc_xml_node3.rb +1 -1
  53. data/tests/tc_xml_node4.rb +8 -5
  54. data/tests/tc_xml_node5.rb +1 -1
  55. data/tests/tc_xml_node6.rb +1 -1
  56. data/tests/tc_xml_node7.rb +1 -1
  57. data/tests/tc_xml_node_set.rb +1 -1
  58. data/tests/tc_xml_node_set2.rb +1 -1
  59. data/tests/tc_xml_node_xlink.rb +1 -1
  60. data/tests/tc_xml_parser.rb +5 -1
  61. data/tests/tc_xml_parser2.rb +1 -1
  62. data/tests/tc_xml_parser3.rb +1 -1
  63. data/tests/tc_xml_parser4.rb +1 -1
  64. data/tests/tc_xml_parser5.rb +1 -1
  65. data/tests/tc_xml_parser6.rb +1 -1
  66. data/tests/tc_xml_parser7.rb +1 -1
  67. data/tests/tc_xml_parser8.rb +1 -1
  68. data/tests/tc_xml_parser_context.rb +1 -1
  69. data/tests/tc_xml_reader.rb +101 -0
  70. data/tests/tc_xml_sax_parser.rb +95 -0
  71. data/tests/tc_xml_xinclude.rb +1 -1
  72. data/tests/tc_xml_xpath.rb +1 -1
  73. data/tests/tc_xml_xpointer.rb +1 -1
  74. metadata +79 -73
  75. data/ext/xml/ruby_xml_attribute.c +0 -224
  76. data/ext/xml/ruby_xml_attribute.h +0 -21
  77. data/tests/test_xml_sax_parser.rb +0 -64
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_node.h,v 1.3 2006/11/20 01:22:07 roscopeco Exp $ */
1
+ /* $Id: ruby_xml_node.h 138 2007-08-29 18:00:35Z danj $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -12,18 +12,15 @@ extern VALUE eXMLNodeUnknownType;
12
12
 
13
13
  typedef struct ruby_xml_node {
14
14
  xmlNodePtr node;
15
- VALUE xd;
16
- //int is_ptr;
17
15
  } ruby_xml_node;
18
16
 
17
+ VALUE
18
+ ruby_xml_node2_wrap(VALUE class, xmlNodePtr xnode);
19
+
19
20
  void ruby_xml_node_free(ruby_xml_node *rxn);
20
21
  void ruby_init_xml_node(void);
21
22
  VALUE ruby_xml_node_child_set(VALUE self, VALUE obj);
22
- VALUE ruby_xml_node_new(VALUE class, xmlNodePtr node);
23
- VALUE ruby_xml_node_new_ptr(VALUE class, VALUE xd, xmlNodePtr node);
24
- VALUE ruby_xml_node_new3(VALUE class, VALUE xd, xmlNodePtr node, int ptr);
25
23
  VALUE ruby_xml_node_name_get(VALUE self);
26
24
  VALUE ruby_xml_node_property_get(VALUE self, VALUE key);
27
25
  VALUE ruby_xml_node_property_set(VALUE self, VALUE key, VALUE val);
28
- VALUE ruby_xml_node_set_ptr(VALUE node, int is_ptr);
29
26
  #endif
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_node_set.c,v 1.4.2.1 2006/11/26 12:37:42 roscopeco Exp $ */
1
+ /* $Id: ruby_xml_node_set.c 138 2007-08-29 18:00:35Z danj $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -32,7 +32,7 @@ ruby_xml_node_set_to_a(VALUE self) {
32
32
  set_ary = rb_ary_new();
33
33
  if (!((rxnset->node_set == NULL) || (rxnset->node_set->nodeNr == 0))) {
34
34
  for (i = 0; i < rxnset->node_set->nodeNr; i++) {
35
- nodeobj = ruby_xml_node_new_ptr(cXMLNode, rxnset->xd, rxnset->node_set->nodeTab[i]);
35
+ nodeobj = ruby_xml_node2_wrap(cXMLNode, rxnset->node_set->nodeTab[i]);
36
36
  rb_ary_push(set_ary, nodeobj);
37
37
  }
38
38
  }
@@ -61,10 +61,10 @@ ruby_xml_node_set_each(VALUE self) {
61
61
  for (i = 0; i < rxnset->node_set->nodeNr; i++) {
62
62
  switch(rxnset->node_set->nodeTab[i]->type) {
63
63
  case XML_ATTRIBUTE_NODE:
64
- nodeobj = ruby_xml_attr_new2(cXMLAttr, rxnset->xd, (xmlAttrPtr)rxnset->node_set->nodeTab[i]);
64
+ nodeobj = ruby_xml_attr_wrap(cXMLAttr, (xmlAttrPtr)rxnset->node_set->nodeTab[i]);
65
65
  break;
66
66
  default:
67
- nodeobj = ruby_xml_node_new_ptr(cXMLNode, rxnset->xd, rxnset->node_set->nodeTab[i]);
67
+ nodeobj = ruby_xml_node2_wrap(cXMLNode, rxnset->node_set->nodeTab[i]);
68
68
  }
69
69
 
70
70
  rb_yield(nodeobj);
@@ -105,10 +105,10 @@ ruby_xml_node_set_first(VALUE self) {
105
105
 
106
106
  switch(rxnset->node_set->nodeTab[0]->type) {
107
107
  case XML_ATTRIBUTE_NODE:
108
- nodeobj = ruby_xml_attr_new2(cXMLAttr, rxnset->xd, (xmlAttrPtr)rxnset->node_set->nodeTab[0]);
108
+ nodeobj = ruby_xml_attr_wrap(cXMLAttr, (xmlAttrPtr)rxnset->node_set->nodeTab[0]);
109
109
  break;
110
110
  default:
111
- nodeobj = ruby_xml_node_new_ptr(cXMLNode, rxnset->xd, rxnset->node_set->nodeTab[0]);
111
+ nodeobj = ruby_xml_node2_wrap(cXMLNode, rxnset->node_set->nodeTab[0]);
112
112
  }
113
113
 
114
114
  return(nodeobj);
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_node_set.h,v 1.1 2006/02/21 20:40:16 roscopeco Exp $ */
1
+ /* $Id: ruby_xml_node_set.h 39 2006-02-21 20:40:16Z roscopeco $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_ns.c,v 1.1 2006/02/21 20:40:16 roscopeco Exp $ */
1
+ /* $Id: ruby_xml_ns.c 39 2006-02-21 20:40:16Z roscopeco $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_ns.h,v 1.1 2006/02/21 20:40:16 roscopeco Exp $ */
1
+ /* $Id: ruby_xml_ns.h 39 2006-02-21 20:40:16Z roscopeco $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -1,5 +1,5 @@
1
- /* $Id: ruby_xml_parser.c,v 1.5 2006/11/20 01:22:07 roscopeco Exp $ */
2
- /* $Id: ruby_xml_parser.c,v 1.5 2006/11/20 01:22:07 roscopeco Exp $ */
1
+ /* $Id: ruby_xml_parser.c 138 2007-08-29 18:00:35Z danj $ */
2
+ /* $Id: ruby_xml_parser.c 138 2007-08-29 18:00:35Z danj $ */
3
3
 
4
4
  /* Please see the LICENSE file for copyright and distribution information */
5
5
 
@@ -1107,7 +1107,7 @@ ruby_xml_parser_new_string(VALUE class, VALUE str) {
1107
1107
  */
1108
1108
  VALUE
1109
1109
  ruby_xml_parser_parse(VALUE self) {
1110
- ruby_xml_document *rxd;
1110
+ ruby_xml_document_t *rxd;
1111
1111
  ruby_xml_parser *rxp;
1112
1112
  ruby_xml_parser_context *rxpc;
1113
1113
  xmlDocPtr xdp;
@@ -1136,10 +1136,7 @@ ruby_xml_parser_parse(VALUE self) {
1136
1136
  rxp->parsed = 1;
1137
1137
  }
1138
1138
 
1139
- doc = ruby_xml_document_new(cXMLDocument, xdp);
1140
- Data_Get_Struct(doc, ruby_xml_document, rxd);
1141
- rxd->is_ptr = 0;
1142
- rxd->doc = xdp;
1139
+ doc = ruby_xml_document_wrap(cXMLDocument, xdp);
1143
1140
  break;
1144
1141
  default:
1145
1142
  rb_fatal("Unknown data type, %d", rxp->data_type);
@@ -1216,7 +1213,7 @@ ruby_xml_parser_str_set(VALUE self, VALUE str) {
1216
1213
  data->str = str;
1217
1214
 
1218
1215
  Data_Get_Struct(rxp->ctxt, ruby_xml_parser_context, rxpc);
1219
- rxpc->ctxt = xmlCreateMemoryParserCtxt(StringValuePtr(data->str), RSTRING(data->str)->len);
1216
+ rxpc->ctxt = xmlCreateMemoryParserCtxt(StringValuePtr(data->str), RSTRING_LEN(data->str));
1220
1217
 
1221
1218
  return(data->str);
1222
1219
  }
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_parser.h,v 1.1 2006/02/21 20:40:16 roscopeco Exp $ */
1
+ /* $Id: ruby_xml_parser.h 39 2006-02-21 20:40:16Z roscopeco $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_parser_context.c,v 1.2 2006/11/20 01:22:07 roscopeco Exp $ */
1
+ /* $Id: ruby_xml_parser_context.c 138 2007-08-29 18:00:35Z danj $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -82,7 +82,7 @@ ruby_xml_parser_context_doc_get(VALUE self) {
82
82
  if (rxpc->ctxt->myDoc == NULL)
83
83
  return(Qnil);
84
84
 
85
- return(ruby_xml_document_new4(cXMLDocument, rxpc->ctxt->myDoc));
85
+ return(ruby_xml_document_wrap(cXMLDocument, rxpc->ctxt->myDoc));
86
86
  }
87
87
 
88
88
 
@@ -330,8 +330,7 @@ ruby_xml_parser_context_node_get(VALUE self) {
330
330
  if (rxpc->ctxt->node == NULL)
331
331
  return(Qnil);
332
332
  else
333
- return(ruby_xml_node_new_ptr(cXMLNode,
334
- ruby_xml_document_new(cXMLDocument, rxpc->ctxt->myDoc),
333
+ return(ruby_xml_node2_wrap(cXMLNode,
335
334
  rxpc->ctxt->node));
336
335
  }
337
336
 
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_parser_context.h,v 1.1 2006/02/21 20:40:16 roscopeco Exp $ */
1
+ /* $Id: ruby_xml_parser_context.h 39 2006-02-21 20:40:16Z roscopeco $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4