libxml-ruby 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. data/CHANGES +42 -0
  2. data/README +123 -117
  3. data/doc/classes/XML.html +226 -0
  4. data/doc/classes/XML/Attr.html +969 -0
  5. data/doc/classes/XML/Attributes.html +487 -0
  6. data/doc/classes/XML/Document.html +1423 -0
  7. data/doc/classes/XML/Dtd.html +159 -0
  8. data/doc/classes/XML/Error.html +111 -0
  9. data/doc/classes/XML/HTMLParser.html +330 -0
  10. data/doc/classes/XML/InputCallbacks.html +154 -0
  11. data/doc/classes/XML/NS.html +366 -0
  12. data/doc/classes/XML/Node.html +3292 -0
  13. data/doc/classes/XML/Node/FailedModify.html +111 -0
  14. data/doc/classes/XML/Node/Set.html +435 -0
  15. data/doc/classes/XML/Node/SetNamespace.html +111 -0
  16. data/doc/classes/XML/Node/UnknownType.html +111 -0
  17. data/doc/classes/XML/Parser.html +2178 -0
  18. data/doc/classes/XML/Parser/Context.html +1233 -0
  19. data/doc/classes/XML/Parser/ParseError.html +111 -0
  20. data/doc/classes/XML/Reader.html +2173 -0
  21. data/doc/classes/XML/SaxParser.html +396 -0
  22. data/doc/classes/XML/SiblingEnum.html +142 -0
  23. data/doc/classes/XML/State.html +118 -0
  24. data/doc/classes/XML/Tree.html +224 -0
  25. data/doc/classes/XML/XInclude.html +117 -0
  26. data/doc/classes/XML/XInclude/Error.html +111 -0
  27. data/doc/classes/XML/XMLParserOptions.html +198 -0
  28. data/doc/classes/XML/XPath.html +269 -0
  29. data/doc/classes/XML/XPath/Context.html +193 -0
  30. data/doc/classes/XML/XPath/InvalidPath.html +111 -0
  31. data/doc/classes/XML/XPath/Object.html +439 -0
  32. data/doc/classes/XML/XPointer.html +164 -0
  33. data/doc/classes/XML/XPointer/Context.html +117 -0
  34. data/doc/classes/XML/XPointer/Context/InvalidPath.html +111 -0
  35. data/doc/classes/XML/XPointer/InvalidExpression.html +111 -0
  36. data/doc/classes/singleton.html +114 -0
  37. data/doc/created.rid +1 -0
  38. data/doc/files/CHANGES.html +375 -0
  39. data/doc/files/LICENSE.html +133 -0
  40. data/doc/files/README.html +279 -0
  41. data/doc/files/VERSION.html +107 -0
  42. data/doc/files/ext/libxml/cbg_c.html +101 -0
  43. data/doc/files/ext/libxml/libxml_c.html +101 -0
  44. data/doc/files/ext/libxml/ruby_xml_attr_c.html +101 -0
  45. data/doc/files/ext/libxml/ruby_xml_attributes_c.html +101 -0
  46. data/doc/files/ext/libxml/ruby_xml_document_c.html +101 -0
  47. data/doc/files/ext/libxml/ruby_xml_dtd_c.html +101 -0
  48. data/doc/files/ext/libxml/ruby_xml_html_parser_c.html +101 -0
  49. data/doc/files/ext/libxml/ruby_xml_input_cbg_c.html +101 -0
  50. data/doc/files/ext/libxml/ruby_xml_node_c.html +101 -0
  51. data/doc/files/ext/libxml/ruby_xml_node_set_c.html +101 -0
  52. data/doc/files/ext/libxml/ruby_xml_ns_c.html +101 -0
  53. data/doc/files/ext/libxml/ruby_xml_parser_c.html +101 -0
  54. data/doc/files/ext/libxml/ruby_xml_parser_context_c.html +101 -0
  55. data/doc/files/ext/libxml/ruby_xml_reader_c.html +101 -0
  56. data/doc/files/ext/libxml/ruby_xml_sax_parser_c.html +101 -0
  57. data/doc/files/ext/libxml/ruby_xml_schema_c.html +101 -0
  58. data/doc/files/ext/libxml/ruby_xml_state_c.html +101 -0
  59. data/doc/files/ext/libxml/ruby_xml_tree_c.html +101 -0
  60. data/doc/files/ext/libxml/ruby_xml_xinclude_c.html +101 -0
  61. data/doc/files/ext/libxml/ruby_xml_xpath_c.html +101 -0
  62. data/doc/files/ext/libxml/ruby_xml_xpath_context_c.html +101 -0
  63. data/doc/files/ext/libxml/ruby_xml_xpath_object_c.html +101 -0
  64. data/doc/files/ext/libxml/ruby_xml_xpointer_c.html +101 -0
  65. data/doc/files/ext/libxml/ruby_xml_xpointer_context_c.html +101 -0
  66. data/doc/files/lib/libxml_rb.html +115 -0
  67. data/doc/files/lib/xml/libxml_rb.html +114 -0
  68. data/doc/fr_class_index.html +60 -0
  69. data/doc/fr_file_index.html +56 -0
  70. data/doc/fr_method_index.html +373 -0
  71. data/doc/index.html +24 -0
  72. data/doc/rdoc-style.css +208 -0
  73. data/ext/libxml/cbg.c +76 -76
  74. data/ext/libxml/extconf.rb +308 -308
  75. data/ext/libxml/libxml.c +58 -62
  76. data/ext/libxml/ruby_libxml.h +1 -0
  77. data/ext/libxml/ruby_xml_attr.c +201 -113
  78. data/ext/libxml/ruby_xml_attr.h +6 -9
  79. data/ext/libxml/ruby_xml_attributes.c +268 -0
  80. data/ext/libxml/ruby_xml_attributes.h +17 -0
  81. data/ext/libxml/ruby_xml_document.c +80 -66
  82. data/ext/libxml/ruby_xml_dtd.c +2 -2
  83. data/ext/libxml/ruby_xml_dtd.h +17 -17
  84. data/ext/libxml/ruby_xml_html_parser.c +18 -19
  85. data/ext/libxml/ruby_xml_html_parser.h +29 -29
  86. data/ext/libxml/ruby_xml_input_cbg.c +6 -0
  87. data/ext/libxml/ruby_xml_input_cbg.h +20 -20
  88. data/ext/libxml/ruby_xml_node.c +438 -536
  89. data/ext/libxml/ruby_xml_node.h +17 -27
  90. data/ext/libxml/ruby_xml_node_set.c +10 -9
  91. data/ext/libxml/ruby_xml_node_set.h +20 -20
  92. data/ext/libxml/ruby_xml_ns.c +60 -69
  93. data/ext/libxml/ruby_xml_ns.h +12 -21
  94. data/ext/libxml/ruby_xml_parser.c +54 -53
  95. data/ext/libxml/ruby_xml_parser.h +31 -31
  96. data/ext/libxml/ruby_xml_parser_context.c +37 -91
  97. data/ext/libxml/ruby_xml_parser_context.h +20 -22
  98. data/ext/libxml/ruby_xml_reader.h +14 -14
  99. data/ext/libxml/ruby_xml_sax_parser.c +55 -55
  100. data/ext/libxml/ruby_xml_sax_parser.h +56 -56
  101. data/ext/libxml/ruby_xml_schema.c +44 -51
  102. data/ext/libxml/ruby_xml_schema.h +16 -16
  103. data/ext/libxml/ruby_xml_state.c +35 -96
  104. data/ext/libxml/ruby_xml_state.h +2 -3
  105. data/ext/libxml/ruby_xml_tree.h +12 -12
  106. data/ext/libxml/ruby_xml_xinclude.h +13 -13
  107. data/ext/libxml/ruby_xml_xpath.c +57 -18
  108. data/ext/libxml/ruby_xml_xpath.h +23 -23
  109. data/ext/libxml/ruby_xml_xpath_context.c +11 -7
  110. data/ext/libxml/ruby_xml_xpath_context.h +20 -20
  111. data/ext/libxml/ruby_xml_xpath_object.c +9 -16
  112. data/ext/libxml/ruby_xml_xpath_object.h +4 -10
  113. data/ext/libxml/ruby_xml_xpointer.c +11 -11
  114. data/ext/libxml/ruby_xml_xpointer.h +27 -27
  115. data/ext/libxml/ruby_xml_xpointer_context.h +18 -18
  116. data/ext/libxml/version.h +2 -2
  117. data/lib/libxml.rb +134 -125
  118. data/mingw/libiconv-2.dll +0 -0
  119. data/mingw/libxml2-2.dll +0 -0
  120. data/mingw/libxml_ruby.so +0 -0
  121. data/test/ets_copy_bug.rb +1 -1
  122. data/test/ets_copy_bug2.rb +16 -27
  123. data/test/ets_doc_to_s.rb +1 -1
  124. data/test/ets_gpx.rb +1 -1
  125. data/test/ets_node_gc.rb +1 -1
  126. data/test/ets_tsr.rb +1 -1
  127. data/test/tc_well_formed.rb +1 -1
  128. data/test/tc_xml_attributes.rb +106 -0
  129. data/test/tc_xml_document.rb +10 -10
  130. data/test/tc_xml_document_write3.rb +1 -1
  131. data/test/tc_xml_dtd.rb +49 -0
  132. data/test/tc_xml_html_parser.rb +3 -3
  133. data/test/tc_xml_node.rb +69 -33
  134. data/test/tc_xml_node_attr.rb +170 -0
  135. data/test/{tc_xml_node8.rb → tc_xml_node_cdata.rb} +2 -2
  136. data/test/{tc_xml_node9.rb → tc_xml_node_comment.rb} +3 -3
  137. data/test/tc_xml_node_edit.rb +91 -0
  138. data/test/tc_xml_parser.rb +97 -50
  139. data/test/tc_xml_parser_context.rb +61 -23
  140. data/test/tc_xml_schema.rb +39 -0
  141. data/test/tc_xml_xinclude.rb +5 -6
  142. data/test/tc_xml_xpath.rb +51 -27
  143. data/test/test_suite.rb +27 -0
  144. data/vc/{libxml.sln → libxml_ruby.sln} +5 -5
  145. data/vc/{libxml.vcproj → libxml_ruby.vcproj} +9 -1
  146. metadata +106 -54
  147. data/mingw/mingw.rake +0 -36
  148. data/test/dtd-test.rb +0 -24
  149. data/test/merge_bug.rb +0 -55
  150. data/test/schema-test.rb +0 -74
  151. data/test/tc_xml_node2.rb +0 -25
  152. data/test/tc_xml_node3.rb +0 -27
  153. data/test/tc_xml_node4.rb +0 -86
  154. data/test/tc_xml_node5.rb +0 -52
  155. data/test/tc_xml_node6.rb +0 -27
  156. data/test/tc_xml_node7.rb +0 -35
  157. data/test/tc_xml_parser2.rb +0 -16
  158. data/test/tc_xml_parser3.rb +0 -23
  159. data/test/tc_xml_parser4.rb +0 -33
  160. data/test/tc_xml_parser5.rb +0 -27
  161. data/test/tc_xml_parser6.rb +0 -23
  162. data/test/tc_xml_parser7.rb +0 -28
  163. data/test/tc_xml_parser8.rb +0 -32
  164. data/test/tc_xml_parser9.rb +0 -11
  165. data/test/tc_xml_xpath2.rb +0 -14
  166. data/work/vc/debug/libxml.exp +0 -0
  167. data/work/vc/debug/libxml.ilk +0 -0
  168. data/work/vc/debug/libxml.lib +0 -0
  169. data/work/vc/debug/libxml.pdb +0 -0
  170. data/work/vc/debug/libxml.so +0 -0
@@ -1,27 +1,17 @@
1
- /* $Id: ruby_xml_node.h 207 2007-11-14 07:51:46Z danj $ */
2
-
3
- /* Please see the LICENSE file for copyright and distribution information */
4
-
5
- #ifndef __RUBY_XML_NODE__
6
- #define __RUBY_XML_NODE__
7
-
8
- extern VALUE cXMLNode;
9
- extern VALUE eXMLNodeSetNamespace;
10
- extern VALUE eXMLNodeFailedModify;
11
- extern VALUE eXMLNodeUnknownType;
12
-
13
- typedef struct ruby_xml_node {
14
- xmlNodePtr node;
15
- } ruby_xml_node;
16
-
17
- VALUE
18
- ruby_xml_node2_wrap(VALUE class, xmlNodePtr xnode);
19
-
20
- void ruby_xml_node_free(ruby_xml_node *rxn);
21
- void ruby_xml_node_mark_common(xmlNodePtr n);
22
- void ruby_init_xml_node(void);
23
- VALUE ruby_xml_node_child_set(VALUE self, VALUE obj);
24
- VALUE ruby_xml_node_name_get(VALUE self);
25
- VALUE ruby_xml_node_property_get(VALUE self, VALUE key);
26
- VALUE ruby_xml_node_property_set(VALUE self, VALUE key, VALUE val);
27
- #endif
1
+ /* $Id: ruby_xml_node.h 348 2008-07-09 18:18:19Z cfis $ */
2
+
3
+ /* Please see the LICENSE file for copyright and distribution information */
4
+
5
+ #ifndef __RUBY_XML_NODE__
6
+ #define __RUBY_XML_NODE__
7
+
8
+ extern VALUE cXMLNode;
9
+ extern VALUE eXMLNodeSetNamespace;
10
+ extern VALUE eXMLNodeFailedModify;
11
+ extern VALUE eXMLNodeUnknownType;
12
+
13
+ void ruby_init_xml_node(void);
14
+ void ruby_xml_node_mark_common(xmlNodePtr xnode);
15
+ VALUE ruby_xml_node2_wrap(VALUE class, xmlNodePtr xnode);
16
+ VALUE check_string_or_symbol(VALUE val);
17
+ #endif
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_node_set.c 300 2008-07-01 19:14:15Z cfis $ */
1
+ /* $Id: ruby_xml_node_set.c 339 2008-07-09 08:36:26Z cfis $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -17,7 +17,7 @@ VALUE cXMLNodeSet;
17
17
 
18
18
  /*
19
19
  * call-seq:
20
- * nodeset.to_a => [node, ..., node]
20
+ * nodeset.to_a -> [node, ..., node]
21
21
  *
22
22
  * Obtain an array of the nodes in this set.
23
23
  */
@@ -37,7 +37,7 @@ ruby_xml_node_set_to_a(VALUE self) {
37
37
 
38
38
  /*
39
39
  * call-seq:
40
- * nodeset.each { |node| ... } => self
40
+ * nodeset.each { |node| ... } -> self
41
41
  *
42
42
  * Call the supplied block for each node in this set.
43
43
  */
@@ -52,7 +52,7 @@ ruby_xml_node_set_each(VALUE self) {
52
52
 
53
53
  /*
54
54
  * call-seq:
55
- * nodeset.empty? => (true|false)
55
+ * nodeset.empty? -> (true|false)
56
56
  *
57
57
  * Determine whether this nodeset is empty (contains no nodes).
58
58
  */
@@ -67,7 +67,7 @@ ruby_xml_node_set_empty_q(VALUE self) {
67
67
 
68
68
  /*
69
69
  * call-seq:
70
- * nodeset.first => node
70
+ * nodeset.first -> node
71
71
  *
72
72
  * Returns the first node in this node set, or nil if none exist.
73
73
  */
@@ -81,7 +81,7 @@ ruby_xml_node_set_first(VALUE self) {
81
81
 
82
82
  /*
83
83
  * call-seq:
84
- * nodeset.length => num
84
+ * nodeset.length -> num
85
85
  *
86
86
  * Obtain the length of this nodeset.
87
87
  */
@@ -96,7 +96,8 @@ ruby_xml_node_set_length(VALUE self) {
96
96
 
97
97
  static void
98
98
  ruby_xml_node_set_mark(ruby_xml_node_set *rxnset) {
99
- if (!NIL_P(rxnset->rxpop)) rb_gc_mark(rxnset->rxpop);
99
+ if (!NIL_P(rxnset->rxpop))
100
+ rb_gc_mark(rxnset->rxpop);
100
101
  }
101
102
 
102
103
  static void
@@ -124,7 +125,7 @@ ruby_xml_node_set_new2(VALUE rxpop)
124
125
 
125
126
  /*
126
127
  * call-seq:
127
- * nodeset.xpath => xpath
128
+ * nodeset.xpath -> xpath
128
129
  *
129
130
  * Obtain the xpath corresponding to this nodeset, if any.
130
131
  */
@@ -136,7 +137,7 @@ ruby_xml_node_set_xpath_get(VALUE self) {
136
137
 
137
138
  /*
138
139
  * call-seq:
139
- * nodeset.xpath_ctxt => context
140
+ * nodeset.xpath_ctxt -> context
140
141
  *
141
142
  * Return the xpath context corresponding to this nodeset,
142
143
  * if any.
@@ -1,20 +1,20 @@
1
- /* $Id: ruby_xml_node_set.h 207 2007-11-14 07:51:46Z danj $ */
2
-
3
- /* Please see the LICENSE file for copyright and distribution information */
4
-
5
- #ifndef __RUBY_XML_NODE_SET__
6
- #define __RUBY_XML_NODE_SET__
7
-
8
- extern VALUE cXMLNodeSet;
9
-
10
- typedef struct ruby_xml_node_set {
11
- VALUE rxpop;
12
- } ruby_xml_node_set;
13
-
14
- void ruby_init_xml_node_set(void);
15
- VALUE ruby_xml_node_set_new(VALUE class, VALUE xpop);
16
- VALUE ruby_xml_node_set_new2(VALUE xpop);
17
- VALUE ruby_xml_node_set_each(VALUE self);
18
- VALUE ruby_xml_node_set_first(VALUE self);
19
-
20
- #endif
1
+ /* $Id: ruby_xml_node_set.h 207 2007-11-14 07:51:46Z danj $ */
2
+
3
+ /* Please see the LICENSE file for copyright and distribution information */
4
+
5
+ #ifndef __RUBY_XML_NODE_SET__
6
+ #define __RUBY_XML_NODE_SET__
7
+
8
+ extern VALUE cXMLNodeSet;
9
+
10
+ typedef struct ruby_xml_node_set {
11
+ VALUE rxpop;
12
+ } ruby_xml_node_set;
13
+
14
+ void ruby_init_xml_node_set(void);
15
+ VALUE ruby_xml_node_set_new(VALUE class, VALUE xpop);
16
+ VALUE ruby_xml_node_set_new2(VALUE xpop);
17
+ VALUE ruby_xml_node_set_each(VALUE self);
18
+ VALUE ruby_xml_node_set_first(VALUE self);
19
+
20
+ #endif
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_ns.c 300 2008-07-01 19:14:15Z cfis $ */
1
+ /* $Id: ruby_xml_ns.c 351 2008-07-09 19:55:21Z cfis $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -7,130 +7,119 @@
7
7
 
8
8
  VALUE cXMLNS;
9
9
 
10
+
11
+ VALUE
12
+ ruby_xml_ns_alloc(VALUE klass) {
13
+ return Data_Wrap_Struct(cXMLNS, NULL, NULL, NULL);
14
+ }
15
+
16
+ /*
17
+ * call-seq:
18
+ * initialize(node, "href", "prefix")
19
+ *
20
+ * Create a new namespace attached to the specified node with the
21
+ * give prefix and namespace.
22
+ *
23
+ * XML::NS.new(node, "xlink", "http://www.w3.org/1999/xlink")
24
+ */
25
+ VALUE
26
+ ruby_xml_ns_initialize(VALUE self, VALUE node, VALUE href, VALUE prefix) {
27
+ xmlNodePtr xnode;
28
+ xmlNsPtr xns;
29
+
30
+ Data_Get_Struct(node, xmlNode, xnode);
31
+ xns = xmlNewNs(xnode, (xmlChar*)StringValuePtr(href), (xmlChar*)StringValuePtr(prefix));
32
+
33
+ DATA_PTR(self) = xns;
34
+ return self;
35
+ }
36
+
37
+ VALUE
38
+ ruby_xml_ns_wrap(xmlNsPtr xns) {
39
+ return(Data_Wrap_Struct(cXMLNS, NULL, NULL, xns));
40
+ }
41
+
42
+
10
43
  /*
11
44
  * call-seq:
12
- * ns.href => "href"
45
+ * ns.href -> "href"
13
46
  *
14
47
  * Obtain the namespace's href.
15
48
  */
16
49
  VALUE
17
50
  ruby_xml_ns_href_get(VALUE self) {
18
- ruby_xml_ns *rxns;
19
- Data_Get_Struct(self, ruby_xml_ns, rxns);
20
- if (rxns->ns == NULL || rxns->ns->href == NULL)
51
+ xmlNsPtr xns;
52
+ Data_Get_Struct(self, xmlNs, xns);
53
+ if (xns == NULL || xns->href == NULL)
21
54
  return(Qnil);
22
55
  else
23
- return(rb_str_new2((const char*)rxns->ns->href));
56
+ return(rb_str_new2((const char*)xns->href));
24
57
  }
25
58
 
26
59
 
27
60
  /*
28
61
  * call-seq:
29
- * ns.href? => (true|false)
62
+ * ns.href? -> (true|false)
30
63
  *
31
64
  * Determine whether this namespace has an href.
32
65
  */
33
66
  VALUE
34
67
  ruby_xml_ns_href_q(VALUE self) {
35
- ruby_xml_ns *rxns;
36
- Data_Get_Struct(self, ruby_xml_ns, rxns);
37
- if (rxns->ns == NULL || rxns->ns->href == NULL)
68
+ xmlNsPtr xns;
69
+ Data_Get_Struct(self, xmlNs, xns);
70
+ if (xns == NULL || xns->href == NULL)
38
71
  return(Qfalse);
39
72
  else
40
73
  return(Qtrue);
41
74
  }
42
75
 
43
76
 
44
- void
45
- ruby_xml_ns_free(ruby_xml_ns *rxns) {
46
- if (rxns->ns != NULL && !rxns->is_ptr) {
47
- xmlFreeNs(rxns->ns);
48
- rxns->ns = NULL;
49
- }
50
-
51
- ruby_xfree(rxns);
52
- }
53
-
54
-
55
- static void
56
- ruby_xml_ns_mark(ruby_xml_ns *rxns) {
57
- if (rxns == NULL) return;
58
- if (!NIL_P(rxns->xd)) rb_gc_mark(rxns->xd);
59
- }
60
-
61
-
62
- VALUE
63
- ruby_xml_ns_new(VALUE class, VALUE xd, xmlNsPtr ns) {
64
- ruby_xml_ns *rxns;
65
-
66
- rxns = ALLOC(ruby_xml_ns);
67
- rxns->is_ptr = 0;
68
- rxns->ns = ns;
69
- rxns->xd = xd;
70
- return(Data_Wrap_Struct(class, ruby_xml_ns_mark,
71
- ruby_xml_ns_free, rxns));
72
- }
73
-
74
-
75
- VALUE
76
- ruby_xml_ns_new2(VALUE class, VALUE xd, xmlNsPtr ns) {
77
- ruby_xml_ns *rxns;
78
-
79
- rxns = ALLOC(ruby_xml_ns);
80
- rxns->is_ptr = 1;
81
- rxns->ns = ns;
82
- rxns->xd = xd;
83
- return(Data_Wrap_Struct(class, ruby_xml_ns_mark,
84
- ruby_xml_ns_free, rxns));
85
- }
86
-
87
-
88
77
  /*
89
78
  * call-seq:
90
- * ns.next => ns
79
+ * ns.next -> ns
91
80
  *
92
81
  * Obtain the next namespace.
93
82
  */
94
83
  VALUE
95
84
  ruby_xml_ns_next(VALUE self) {
96
- ruby_xml_ns *rxns;
97
- Data_Get_Struct(self, ruby_xml_ns, rxns);
98
- if (rxns->ns == NULL || rxns->ns->next == NULL)
85
+ xmlNsPtr xns;
86
+ Data_Get_Struct(self, xmlNs, xns);
87
+ if (xns == NULL || xns->next == NULL)
99
88
  return(Qnil);
100
89
  else
101
- return(ruby_xml_ns_new2(cXMLNS, rxns->xd, rxns->ns->next));
90
+ return(ruby_xml_ns_wrap(xns->next));
102
91
  }
103
92
 
104
93
 
105
94
  /*
106
95
  * call-seq:
107
- * ns.prefix => "prefix"
108
- * ns.to_s => "prefix"
96
+ * ns.prefix -> "prefix"
97
+ * ns.to_s -> "prefix"
109
98
  *
110
99
  * Obtain the namespace's prefix.
111
100
  */
112
101
  VALUE
113
102
  ruby_xml_ns_prefix_get(VALUE self) {
114
- ruby_xml_ns *rxns;
115
- Data_Get_Struct(self, ruby_xml_ns, rxns);
116
- if (rxns->ns == NULL || rxns->ns->prefix == NULL)
103
+ xmlNsPtr xns;
104
+ Data_Get_Struct(self, xmlNs, xns);
105
+ if (xns == NULL || xns->prefix == NULL)
117
106
  return(Qnil);
118
107
  else
119
- return(rb_str_new2((const char*)rxns->ns->prefix));
108
+ return(rb_str_new2((const char*)xns->prefix));
120
109
  }
121
110
 
122
111
 
123
112
  /*
124
113
  * call-seq:
125
- * ns.prefix? => (true|false)
114
+ * ns.prefix? -> (true|false)
126
115
  *
127
116
  * Determine whether this namespace has a prefix.
128
117
  */
129
118
  VALUE
130
119
  ruby_xml_ns_prefix_q(VALUE self) {
131
- ruby_xml_ns *rxns;
132
- Data_Get_Struct(self, ruby_xml_ns, rxns);
133
- if (rxns->ns == NULL || rxns->ns->prefix == NULL)
120
+ xmlNsPtr xns;
121
+ Data_Get_Struct(self, xmlNs, xns);
122
+ if (xns == NULL || xns->prefix == NULL)
134
123
  return(Qfalse);
135
124
  else
136
125
  return(Qtrue);
@@ -144,6 +133,8 @@ ruby_xml_ns_prefix_q(VALUE self) {
144
133
  void
145
134
  ruby_init_xml_ns(void) {
146
135
  cXMLNS = rb_define_class_under(mXML, "NS", rb_cObject);
136
+ rb_define_alloc_func(cXMLNS, ruby_xml_ns_alloc);
137
+ rb_define_method(cXMLNS, "initialize", ruby_xml_ns_initialize, 3);
147
138
  rb_define_method(cXMLNS, "href", ruby_xml_ns_href_get, 0);
148
139
  rb_define_method(cXMLNS, "href?", ruby_xml_ns_href_q, 0);
149
140
  rb_define_method(cXMLNS, "next", ruby_xml_ns_next, 0);
@@ -1,21 +1,12 @@
1
- /* $Id: ruby_xml_ns.h 39 2006-02-21 20:40:16Z roscopeco $ */
2
-
3
- /* Please see the LICENSE file for copyright and distribution information */
4
-
5
- #ifndef __RUBY_XML_NS__
6
- #define __RUBY_XML_NS__
7
-
8
- extern VALUE cXMLNS;
9
-
10
- typedef struct ruby_xml_ns {
11
- xmlNsPtr ns;
12
- int is_ptr;
13
- VALUE xd;
14
- } ruby_xml_ns;
15
-
16
- void ruby_xml_ns_free(ruby_xml_ns *rxn);
17
- void ruby_init_xml_ns(void);
18
- VALUE ruby_xml_ns_new(VALUE class, VALUE xd, xmlNsPtr ns);
19
- VALUE ruby_xml_ns_new2(VALUE class, VALUE xd, xmlNsPtr ns);
20
- VALUE ruby_xml_ns_name_get(VALUE self);
21
- #endif
1
+ /* $Id: ruby_xml_ns.h 324 2008-07-08 23:00:02Z cfis $ */
2
+
3
+ /* Please see the LICENSE file for copyright and distribution information */
4
+
5
+ #ifndef __RUBY_XML_NS__
6
+ #define __RUBY_XML_NS__
7
+
8
+ extern VALUE cXMLNS;
9
+
10
+ void ruby_init_xml_ns(void);
11
+ VALUE ruby_xml_ns_wrap(xmlNsPtr ns);
12
+ #endif
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_parser.c 300 2008-07-01 19:14:15Z cfis $ */
1
+ /* $Id: ruby_xml_parser.c 351 2008-07-09 19:55:21Z cfis $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -18,7 +18,7 @@ ctxtRead(FILE *f, char * buf, size_t len) {
18
18
 
19
19
  /*
20
20
  * call-seq:
21
- * XML::Parser.catalog_dump => true
21
+ * XML::Parser.catalog_dump -> true
22
22
  *
23
23
  * Dump the parser resource catalogs to stdout.
24
24
  */
@@ -31,7 +31,7 @@ ruby_xml_parser_catalog_dump(VALUE self) {
31
31
 
32
32
  /*
33
33
  * call-seq:
34
- * XML::Parser.catalog_remove(catalog) => true
34
+ * XML::Parser.catalog_remove(catalog) -> true
35
35
  *
36
36
  * Remove the specified resource catalog.
37
37
  */
@@ -45,7 +45,7 @@ ruby_xml_parser_catalog_remove(VALUE self, VALUE cat) {
45
45
 
46
46
  /*
47
47
  * call-seq:
48
- * XML::Parser.check_lib_versions => true
48
+ * XML::Parser.check_lib_versions -> true
49
49
  *
50
50
  * Check LIBXML version matches version the bindings
51
51
  * were compiled to. Throws an exception if not.
@@ -59,7 +59,7 @@ ruby_xml_parser_check_lib_versions(VALUE class) {
59
59
 
60
60
  /*
61
61
  * call-seq:
62
- * XML::Parser.enabled_automata? => (true|false)
62
+ * XML::Parser.enabled_automata? -> (true|false)
63
63
  *
64
64
  * Determine whether libxml regexp automata support is enabled.
65
65
  */
@@ -75,7 +75,7 @@ ruby_xml_parser_enabled_automata_q(VALUE class) {
75
75
 
76
76
  /*
77
77
  * call-seq:
78
- * XML::Parser.enabled_c14n? => (true|false)
78
+ * XML::Parser.enabled_c14n? -> (true|false)
79
79
  *
80
80
  * Determine whether libxml 'canonical XML' support is enabled.
81
81
  * See "Canonical XML" (http://www.w3.org/TR/xml-c14n)
@@ -92,7 +92,7 @@ ruby_xml_parser_enabled_c14n_q(VALUE class) {
92
92
 
93
93
  /*
94
94
  * call-seq:
95
- * XML::Parser.enabled_catalog? => (true|false)
95
+ * XML::Parser.enabled_catalog? -> (true|false)
96
96
  *
97
97
  * Determine whether libxml resource catalog support is enabled.
98
98
  */
@@ -108,7 +108,7 @@ ruby_xml_parser_enabled_catalog_q(VALUE class) {
108
108
 
109
109
  /*
110
110
  * call-seq:
111
- * XML::Parser.enabled_debug? => (true|false)
111
+ * XML::Parser.enabled_debug? -> (true|false)
112
112
  *
113
113
  * Determine whether libxml debugging support is enabled.
114
114
  */
@@ -124,7 +124,7 @@ ruby_xml_parser_enabled_debug_q(VALUE class) {
124
124
 
125
125
  /*
126
126
  * call-seq:
127
- * XML::Parser.enabled_docbook? => (true|false)
127
+ * XML::Parser.enabled_docbook? -> (true|false)
128
128
  *
129
129
  * Determine whether libxml docbook support is enabled.
130
130
  */
@@ -140,7 +140,7 @@ ruby_xml_parser_enabled_docbook_q(VALUE class) {
140
140
 
141
141
  /*
142
142
  * call-seq:
143
- * XML::Parser.enabled_ftp? => (true|false)
143
+ * XML::Parser.enabled_ftp? -> (true|false)
144
144
  *
145
145
  * Determine whether libxml ftp client support is enabled.
146
146
  */
@@ -156,7 +156,7 @@ ruby_xml_parser_enabled_ftp_q(VALUE class) {
156
156
 
157
157
  /*
158
158
  * call-seq:
159
- * XML::Parser.enabled_http? => (true|false)
159
+ * XML::Parser.enabled_http? -> (true|false)
160
160
  *
161
161
  * Determine whether libxml http client support is enabled.
162
162
  */
@@ -172,7 +172,7 @@ ruby_xml_parser_enabled_http_q(VALUE class) {
172
172
 
173
173
  /*
174
174
  * call-seq:
175
- * XML::Parser.enabled_html? => (true|false)
175
+ * XML::Parser.enabled_html? -> (true|false)
176
176
  *
177
177
  * Determine whether libxml html support is enabled.
178
178
  */
@@ -188,7 +188,7 @@ ruby_xml_parser_enabled_html_q(VALUE class) {
188
188
 
189
189
  /*
190
190
  * call-seq:
191
- * XML::Parser.enabled_iconv? => (true|false)
191
+ * XML::Parser.enabled_iconv? -> (true|false)
192
192
  *
193
193
  * Determine whether libxml iconv support is enabled.
194
194
  */
@@ -204,7 +204,7 @@ ruby_xml_parser_enabled_iconv_q(VALUE class) {
204
204
 
205
205
  /*
206
206
  * call-seq:
207
- * XML::Parser.enabled_memory_debug? => (true|false)
207
+ * XML::Parser.enabled_memory_debug? -> (true|false)
208
208
  *
209
209
  * Determine whether libxml memory location debugging support
210
210
  * is enabled.
@@ -221,7 +221,7 @@ ruby_xml_parser_enabled_memory_debug_location_q(VALUE class) {
221
221
 
222
222
  /*
223
223
  * call-seq:
224
- * XML::Parser.enabled_regexp? => (true|false)
224
+ * XML::Parser.enabled_regexp? -> (true|false)
225
225
  *
226
226
  * Determine whether libxml regular expression support is enabled.
227
227
  */
@@ -237,7 +237,7 @@ ruby_xml_parser_enabled_regexp_q(VALUE class) {
237
237
 
238
238
  /*
239
239
  * call-seq:
240
- * XML::Parser.enabled_schemas? => (true|false)
240
+ * XML::Parser.enabled_schemas? -> (true|false)
241
241
  *
242
242
  * Determine whether libxml schema support is enabled.
243
243
  */
@@ -253,7 +253,7 @@ ruby_xml_parser_enabled_schemas_q(VALUE class) {
253
253
 
254
254
  /*
255
255
  * call-seq:
256
- * XML::Parser.enabled_thread? => (true|false)
256
+ * XML::Parser.enabled_thread? -> (true|false)
257
257
  *
258
258
  * Determine whether libxml thread-safe semantics support
259
259
  * is enabled (I think?).
@@ -270,7 +270,7 @@ ruby_xml_parser_enabled_thread_q(VALUE class) {
270
270
 
271
271
  /*
272
272
  * call-seq:
273
- * XML::Parser.enabled_unicode? => (true|false)
273
+ * XML::Parser.enabled_unicode? -> (true|false)
274
274
  *
275
275
  * Determine whether libxml unicode support is enabled.
276
276
  */
@@ -286,7 +286,7 @@ ruby_xml_parser_enabled_unicode_q(VALUE class) {
286
286
 
287
287
  /*
288
288
  * call-seq:
289
- * XML::Parser.enabled_xinclude? => (true|false)
289
+ * XML::Parser.enabled_xinclude? -> (true|false)
290
290
  *
291
291
  * Determine whether libxml xinclude support is enabled.
292
292
  */
@@ -302,7 +302,7 @@ ruby_xml_parser_enabled_xinclude_q(VALUE class) {
302
302
 
303
303
  /*
304
304
  * call-seq:
305
- * XML::Parser.enabled_xpath? => (true|false)
305
+ * XML::Parser.enabled_xpath? -> (true|false)
306
306
  *
307
307
  * Determine whether libxml xpath support is enabled.
308
308
  */
@@ -318,7 +318,7 @@ ruby_xml_parser_enabled_xpath_q(VALUE class) {
318
318
 
319
319
  /*
320
320
  * call-seq:
321
- * XML::Parser.enabled_xpointer? => (true|false)
321
+ * XML::Parser.enabled_xpointer? -> (true|false)
322
322
  *
323
323
  * Determine whether libxml xpointer support is enabled.
324
324
  */
@@ -334,7 +334,7 @@ ruby_xml_parser_enabled_xpointer_q(VALUE class) {
334
334
 
335
335
  /*
336
336
  * call-seq:
337
- * XML::Parser.enabled_zlib? => (true|false)
337
+ * XML::Parser.enabled_zlib? -> (true|false)
338
338
  *
339
339
  * Determine whether libxml zlib support is enabled.
340
340
  */
@@ -350,7 +350,7 @@ ruby_xml_parser_enabled_zlib_q(VALUE class) {
350
350
 
351
351
  /*
352
352
  * call-seq:
353
- * XML::Parser.debug_entities => (true|false)
353
+ * XML::Parser.debug_entities -> (true|false)
354
354
  *
355
355
  * Determine whether included-entity debugging is enabled.
356
356
  * (Requires Libxml to be compiled with debugging support)
@@ -394,7 +394,7 @@ ruby_xml_parser_debug_entities_set(VALUE class, VALUE bool) {
394
394
 
395
395
  /*
396
396
  * call-seq:
397
- * XML::Parser.default_keep_blanks => (true|false)
397
+ * XML::Parser.default_keep_blanks -> (true|false)
398
398
  *
399
399
  * Determine whether parsers retain whitespace by default.
400
400
  */
@@ -429,7 +429,7 @@ ruby_xml_parser_default_keep_blanks_set(VALUE class, VALUE bool) {
429
429
 
430
430
  /*
431
431
  * call-seq:
432
- * XML::Parser.default_load_external_dtd => (true|false)
432
+ * XML::Parser.default_load_external_dtd -> (true|false)
433
433
  *
434
434
  * Determine whether parsers load external DTDs by default.
435
435
  */
@@ -462,7 +462,7 @@ ruby_xml_parser_default_load_external_dtd_set(VALUE class, VALUE bool) {
462
462
 
463
463
  /*
464
464
  * call-seq:
465
- * XML::Parser.default_line_numbers => (true|false)
465
+ * XML::Parser.default_line_numbers -> (true|false)
466
466
  *
467
467
  * Determine whether parsers retain line-numbers by default.
468
468
  */
@@ -495,7 +495,7 @@ ruby_xml_parser_default_line_numbers_set(VALUE class, VALUE bool) {
495
495
 
496
496
  /*
497
497
  * call-seq:
498
- * XML::Parser.default_pedantic_parser => (true|false)
498
+ * XML::Parser.default_pedantic_parser -> (true|false)
499
499
  *
500
500
  * Determine whether parsers are pedantic by default.
501
501
  */
@@ -528,7 +528,7 @@ ruby_xml_parser_default_pedantic_parser_set(VALUE class, VALUE bool) {
528
528
 
529
529
  /*
530
530
  * call-seq:
531
- * XML::Parser.default_substitute_entities => (true|false)
531
+ * XML::Parser.default_substitute_entities -> (true|false)
532
532
  *
533
533
  * Determine whether parsers perform inline entity substitution
534
534
  * (for external entities) by default.
@@ -563,7 +563,7 @@ ruby_xml_parser_default_substitute_entities_set(VALUE class, VALUE bool) {
563
563
 
564
564
  /*
565
565
  * call-seq:
566
- * XML::Parser.default_tree_indent_string => "string"
566
+ * XML::Parser.default_tree_indent_string -> "string"
567
567
  *
568
568
  * Obtain the default string used by parsers to indent the XML tree
569
569
  * for output.
@@ -594,7 +594,7 @@ ruby_xml_parser_default_tree_indent_string_set(VALUE class, VALUE string) {
594
594
 
595
595
  /*
596
596
  * call-seq:
597
- * XML::Parser.default_validity_checking => (true|false)
597
+ * XML::Parser.default_validity_checking -> (true|false)
598
598
  *
599
599
  * Determine whether parsers perform XML validation by default.
600
600
  */
@@ -627,7 +627,7 @@ ruby_xml_parser_default_validity_checking_set(VALUE class, VALUE bool) {
627
627
 
628
628
  /*
629
629
  * call-seq:
630
- * XML::Parser.default_warnings => (true|false)
630
+ * XML::Parser.default_warnings -> (true|false)
631
631
  *
632
632
  * Determine whether parsers output warnings by default.
633
633
  */
@@ -660,7 +660,7 @@ ruby_xml_parser_default_warnings_set(VALUE class, VALUE bool) {
660
660
 
661
661
  /*
662
662
  * call-seq:
663
- * XML::Parser.default_compression => (true|false)
663
+ * XML::Parser.default_compression -> (true|false)
664
664
  *
665
665
  * Determine whether parsers use Zlib compression by default
666
666
  * (requires libxml to be compiled with Zlib support).
@@ -698,7 +698,7 @@ ruby_xml_parser_default_compression_set(VALUE class, VALUE num) {
698
698
 
699
699
  /*
700
700
  * call-seq:
701
- * XML::Parser.features => ["feature", ..., "feature"]
701
+ * XML::Parser.features -> ["feature", ..., "feature"]
702
702
  *
703
703
  * Obtains an array of strings representing features supported
704
704
  * (and enabled) by the installed libxml.
@@ -732,7 +732,7 @@ ruby_xml_parser_features(VALUE class) {
732
732
 
733
733
  /*
734
734
  * call-seq:
735
- * parser.filename => "filename"
735
+ * parser.filename -> "filename"
736
736
  *
737
737
  * Obtain the filename this parser will read from.
738
738
  */
@@ -779,14 +779,14 @@ ruby_xml_parser_filename_set(VALUE self, VALUE filename) {
779
779
  return(Qnil);
780
780
  }
781
781
 
782
- rxp->ctxt = ruby_xml_parser_context_new3();
782
+ rxp->ctxt = ruby_xml_parser_context_new();
783
783
  data = (rx_file_data *)rxp->data;
784
784
  data->filename = filename;
785
785
 
786
786
  Data_Get_Struct(rxp->ctxt, ruby_xml_parser_context, rxpc);
787
787
  rxpc->ctxt = xmlCreateFileParserCtxt(StringValuePtr(filename));
788
788
  if (rxpc->ctxt == NULL)
789
- rb_raise(rb_eIOError, filename);
789
+ rb_raise(rb_eIOError, StringValuePtr(filename));
790
790
 
791
791
  return(data->filename);
792
792
  }
@@ -821,7 +821,7 @@ ruby_xml_parser_free(ruby_xml_parser *rxp) {
821
821
 
822
822
  /*
823
823
  * call-seq:
824
- * XML::Parser.indent_tree_output => (true|false)
824
+ * XML::Parser.indent_tree_output -> (true|false)
825
825
  *
826
826
  * Determines whether XML output will be indented
827
827
  * (using the string supplied to +default_indent_tree_string+)
@@ -858,7 +858,7 @@ ruby_xml_parser_indent_tree_output_set(VALUE class, VALUE bool) {
858
858
 
859
859
  /*
860
860
  * call-seq:
861
- * parser.io => IO
861
+ * parser.io -> IO
862
862
  *
863
863
  * Obtain the IO instance this parser works with.
864
864
  */
@@ -914,7 +914,7 @@ ruby_xml_parser_io_set(VALUE self, VALUE io) {
914
914
  return(Qnil);
915
915
  }
916
916
 
917
- rxp->ctxt = ruby_xml_parser_context_new3();
917
+ rxp->ctxt = ruby_xml_parser_context_new();
918
918
  data = (rx_io_data *)rxp->data;
919
919
  data->io = io;
920
920
 
@@ -936,9 +936,10 @@ ruby_xml_parser_io_set(VALUE self, VALUE io) {
936
936
  void
937
937
  ruby_xml_parser_mark(ruby_xml_parser *rxp) {
938
938
  if (rxp == NULL) return;
939
- if (!NIL_P(rxp->ctxt)) rb_gc_mark(rxp->ctxt);
939
+ if (!NIL_P(rxp->ctxt))
940
+ rb_gc_mark(rxp->ctxt);
940
941
 
941
- ruby_xml_state_marker();
942
+ rb_gc_mark(LIBXML_STATE);
942
943
 
943
944
  switch(rxp->data_type) {
944
945
  case RUBY_LIBXML_SRC_TYPE_NULL:
@@ -963,7 +964,7 @@ ruby_xml_parser_mark(ruby_xml_parser *rxp) {
963
964
 
964
965
  /*
965
966
  * call-seq:
966
- * XML::Parser.memory_dump => (true|false)
967
+ * XML::Parser.memory_dump -> (true|false)
967
968
  *
968
969
  * Perform a parser memory dump (requires memory debugging
969
970
  * support in libxml).
@@ -982,7 +983,7 @@ ruby_xml_parser_memory_dump(VALUE self) {
982
983
 
983
984
  /*
984
985
  * call-seq:
985
- * XML::Parser.memory_used => num_bytes
986
+ * XML::Parser.memory_used -> num_bytes
986
987
  *
987
988
  * Perform a parser memory dump (requires memory debugging
988
989
  * support in libxml).
@@ -1000,7 +1001,7 @@ ruby_xml_parser_memory_used(VALUE self) {
1000
1001
 
1001
1002
  /*
1002
1003
  * call-seq:
1003
- * XML::Parser.new => parser
1004
+ * XML::Parser.new -> parser
1004
1005
  *
1005
1006
  * Create a new parser instance with no pre-determined source.
1006
1007
  */
@@ -1026,7 +1027,7 @@ ruby_xml_parser_new(VALUE class) {
1026
1027
 
1027
1028
  /*
1028
1029
  * call-seq:
1029
- * XML::Parser.file => parser
1030
+ * XML::Parser.file -> parser
1030
1031
  *
1031
1032
  * Create a new parser instance that will read the specified file.
1032
1033
  */
@@ -1051,7 +1052,7 @@ ruby_xml_parser_new_file(VALUE class, VALUE filename) {
1051
1052
 
1052
1053
  /*
1053
1054
  * call-seq:
1054
- * XML::Parser.io => parser
1055
+ * XML::Parser.io -> parser
1055
1056
  *
1056
1057
  * Create a new parser instance that will read from the
1057
1058
  * specified IO object.
@@ -1077,7 +1078,7 @@ ruby_xml_parser_new_io(VALUE class, VALUE io) {
1077
1078
 
1078
1079
  /*
1079
1080
  * call-seq:
1080
- * XML::Parser.string => parser
1081
+ * XML::Parser.string -> parser
1081
1082
  *
1082
1083
  * Create a new parser instance that will parse the given
1083
1084
  * string.
@@ -1103,7 +1104,7 @@ ruby_xml_parser_new_string(VALUE class, VALUE str) {
1103
1104
 
1104
1105
  /*
1105
1106
  * call-seq:
1106
- * parser.parse => document
1107
+ * parser.parse -> document
1107
1108
  *
1108
1109
  * Parse the input XML and create an XML::Document with
1109
1110
  * it's content. If an error occurs, XML::Parser::ParseError
@@ -1151,7 +1152,7 @@ ruby_xml_parser_parse(VALUE self) {
1151
1152
 
1152
1153
  /*
1153
1154
  * call-seq:
1154
- * parser.context => context
1155
+ * parser.context -> context
1155
1156
  *
1156
1157
  * Obtain the XML::Parser::Context associated with this
1157
1158
  * parser.
@@ -1170,7 +1171,7 @@ ruby_xml_parser_context_get(VALUE self) {
1170
1171
 
1171
1172
  /*
1172
1173
  * call-seq:
1173
- * parser.string => "string"
1174
+ * parser.string -> "string"
1174
1175
  *
1175
1176
  * Obtain the string this parser works with.
1176
1177
  */
@@ -1211,7 +1212,7 @@ ruby_xml_parser_str_set(VALUE self, VALUE str) {
1211
1212
  return(Qnil);
1212
1213
  }
1213
1214
 
1214
- rxp->ctxt = ruby_xml_parser_context_new3();
1215
+ rxp->ctxt = ruby_xml_parser_context_new();
1215
1216
  data = (rx_string_data *)rxp->data;
1216
1217
  data->str = str;
1217
1218
 
@@ -1225,8 +1226,8 @@ ruby_xml_parser_str_set(VALUE self, VALUE str) {
1225
1226
 
1226
1227
  /*
1227
1228
  * call-seq:
1228
- * XML::Parser.register_error_handler(lambda { |msg| ... }) => old_handler
1229
- * XML::Parser.register_error_handler(nil) => old_handler
1229
+ * XML::Parser.register_error_handler(lambda { |msg| ... }) -> old_handler
1230
+ * XML::Parser.register_error_handler(nil) -> old_handler
1230
1231
  *
1231
1232
  * Register the attached block as the handler for parser errors.
1232
1233
  * A message describing parse errors is passed to the block.