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.
- data/CHANGES +42 -0
- data/README +123 -117
- data/doc/classes/XML.html +226 -0
- data/doc/classes/XML/Attr.html +969 -0
- data/doc/classes/XML/Attributes.html +487 -0
- data/doc/classes/XML/Document.html +1423 -0
- data/doc/classes/XML/Dtd.html +159 -0
- data/doc/classes/XML/Error.html +111 -0
- data/doc/classes/XML/HTMLParser.html +330 -0
- data/doc/classes/XML/InputCallbacks.html +154 -0
- data/doc/classes/XML/NS.html +366 -0
- data/doc/classes/XML/Node.html +3292 -0
- data/doc/classes/XML/Node/FailedModify.html +111 -0
- data/doc/classes/XML/Node/Set.html +435 -0
- data/doc/classes/XML/Node/SetNamespace.html +111 -0
- data/doc/classes/XML/Node/UnknownType.html +111 -0
- data/doc/classes/XML/Parser.html +2178 -0
- data/doc/classes/XML/Parser/Context.html +1233 -0
- data/doc/classes/XML/Parser/ParseError.html +111 -0
- data/doc/classes/XML/Reader.html +2173 -0
- data/doc/classes/XML/SaxParser.html +396 -0
- data/doc/classes/XML/SiblingEnum.html +142 -0
- data/doc/classes/XML/State.html +118 -0
- data/doc/classes/XML/Tree.html +224 -0
- data/doc/classes/XML/XInclude.html +117 -0
- data/doc/classes/XML/XInclude/Error.html +111 -0
- data/doc/classes/XML/XMLParserOptions.html +198 -0
- data/doc/classes/XML/XPath.html +269 -0
- data/doc/classes/XML/XPath/Context.html +193 -0
- data/doc/classes/XML/XPath/InvalidPath.html +111 -0
- data/doc/classes/XML/XPath/Object.html +439 -0
- data/doc/classes/XML/XPointer.html +164 -0
- data/doc/classes/XML/XPointer/Context.html +117 -0
- data/doc/classes/XML/XPointer/Context/InvalidPath.html +111 -0
- data/doc/classes/XML/XPointer/InvalidExpression.html +111 -0
- data/doc/classes/singleton.html +114 -0
- data/doc/created.rid +1 -0
- data/doc/files/CHANGES.html +375 -0
- data/doc/files/LICENSE.html +133 -0
- data/doc/files/README.html +279 -0
- data/doc/files/VERSION.html +107 -0
- data/doc/files/ext/libxml/cbg_c.html +101 -0
- data/doc/files/ext/libxml/libxml_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_attr_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_attributes_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_document_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_dtd_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_html_parser_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_input_cbg_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_node_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_node_set_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_ns_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_parser_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_parser_context_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_reader_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_sax_parser_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_schema_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_state_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_tree_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_xinclude_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_xpath_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_xpath_context_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_xpath_object_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_xpointer_c.html +101 -0
- data/doc/files/ext/libxml/ruby_xml_xpointer_context_c.html +101 -0
- data/doc/files/lib/libxml_rb.html +115 -0
- data/doc/files/lib/xml/libxml_rb.html +114 -0
- data/doc/fr_class_index.html +60 -0
- data/doc/fr_file_index.html +56 -0
- data/doc/fr_method_index.html +373 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/ext/libxml/cbg.c +76 -76
- data/ext/libxml/extconf.rb +308 -308
- data/ext/libxml/libxml.c +58 -62
- data/ext/libxml/ruby_libxml.h +1 -0
- data/ext/libxml/ruby_xml_attr.c +201 -113
- data/ext/libxml/ruby_xml_attr.h +6 -9
- data/ext/libxml/ruby_xml_attributes.c +268 -0
- data/ext/libxml/ruby_xml_attributes.h +17 -0
- data/ext/libxml/ruby_xml_document.c +80 -66
- data/ext/libxml/ruby_xml_dtd.c +2 -2
- data/ext/libxml/ruby_xml_dtd.h +17 -17
- data/ext/libxml/ruby_xml_html_parser.c +18 -19
- data/ext/libxml/ruby_xml_html_parser.h +29 -29
- data/ext/libxml/ruby_xml_input_cbg.c +6 -0
- data/ext/libxml/ruby_xml_input_cbg.h +20 -20
- data/ext/libxml/ruby_xml_node.c +438 -536
- data/ext/libxml/ruby_xml_node.h +17 -27
- data/ext/libxml/ruby_xml_node_set.c +10 -9
- data/ext/libxml/ruby_xml_node_set.h +20 -20
- data/ext/libxml/ruby_xml_ns.c +60 -69
- data/ext/libxml/ruby_xml_ns.h +12 -21
- data/ext/libxml/ruby_xml_parser.c +54 -53
- data/ext/libxml/ruby_xml_parser.h +31 -31
- data/ext/libxml/ruby_xml_parser_context.c +37 -91
- data/ext/libxml/ruby_xml_parser_context.h +20 -22
- data/ext/libxml/ruby_xml_reader.h +14 -14
- data/ext/libxml/ruby_xml_sax_parser.c +55 -55
- data/ext/libxml/ruby_xml_sax_parser.h +56 -56
- data/ext/libxml/ruby_xml_schema.c +44 -51
- data/ext/libxml/ruby_xml_schema.h +16 -16
- data/ext/libxml/ruby_xml_state.c +35 -96
- data/ext/libxml/ruby_xml_state.h +2 -3
- data/ext/libxml/ruby_xml_tree.h +12 -12
- data/ext/libxml/ruby_xml_xinclude.h +13 -13
- data/ext/libxml/ruby_xml_xpath.c +57 -18
- data/ext/libxml/ruby_xml_xpath.h +23 -23
- data/ext/libxml/ruby_xml_xpath_context.c +11 -7
- data/ext/libxml/ruby_xml_xpath_context.h +20 -20
- data/ext/libxml/ruby_xml_xpath_object.c +9 -16
- data/ext/libxml/ruby_xml_xpath_object.h +4 -10
- data/ext/libxml/ruby_xml_xpointer.c +11 -11
- data/ext/libxml/ruby_xml_xpointer.h +27 -27
- data/ext/libxml/ruby_xml_xpointer_context.h +18 -18
- data/ext/libxml/version.h +2 -2
- data/lib/libxml.rb +134 -125
- data/mingw/libiconv-2.dll +0 -0
- data/mingw/libxml2-2.dll +0 -0
- data/mingw/libxml_ruby.so +0 -0
- data/test/ets_copy_bug.rb +1 -1
- data/test/ets_copy_bug2.rb +16 -27
- data/test/ets_doc_to_s.rb +1 -1
- data/test/ets_gpx.rb +1 -1
- data/test/ets_node_gc.rb +1 -1
- data/test/ets_tsr.rb +1 -1
- data/test/tc_well_formed.rb +1 -1
- data/test/tc_xml_attributes.rb +106 -0
- data/test/tc_xml_document.rb +10 -10
- data/test/tc_xml_document_write3.rb +1 -1
- data/test/tc_xml_dtd.rb +49 -0
- data/test/tc_xml_html_parser.rb +3 -3
- data/test/tc_xml_node.rb +69 -33
- data/test/tc_xml_node_attr.rb +170 -0
- data/test/{tc_xml_node8.rb → tc_xml_node_cdata.rb} +2 -2
- data/test/{tc_xml_node9.rb → tc_xml_node_comment.rb} +3 -3
- data/test/tc_xml_node_edit.rb +91 -0
- data/test/tc_xml_parser.rb +97 -50
- data/test/tc_xml_parser_context.rb +61 -23
- data/test/tc_xml_schema.rb +39 -0
- data/test/tc_xml_xinclude.rb +5 -6
- data/test/tc_xml_xpath.rb +51 -27
- data/test/test_suite.rb +27 -0
- data/vc/{libxml.sln → libxml_ruby.sln} +5 -5
- data/vc/{libxml.vcproj → libxml_ruby.vcproj} +9 -1
- metadata +106 -54
- data/mingw/mingw.rake +0 -36
- data/test/dtd-test.rb +0 -24
- data/test/merge_bug.rb +0 -55
- data/test/schema-test.rb +0 -74
- data/test/tc_xml_node2.rb +0 -25
- data/test/tc_xml_node3.rb +0 -27
- data/test/tc_xml_node4.rb +0 -86
- data/test/tc_xml_node5.rb +0 -52
- data/test/tc_xml_node6.rb +0 -27
- data/test/tc_xml_node7.rb +0 -35
- data/test/tc_xml_parser2.rb +0 -16
- data/test/tc_xml_parser3.rb +0 -23
- data/test/tc_xml_parser4.rb +0 -33
- data/test/tc_xml_parser5.rb +0 -27
- data/test/tc_xml_parser6.rb +0 -23
- data/test/tc_xml_parser7.rb +0 -28
- data/test/tc_xml_parser8.rb +0 -32
- data/test/tc_xml_parser9.rb +0 -11
- data/test/tc_xml_xpath2.rb +0 -14
- data/work/vc/debug/libxml.exp +0 -0
- data/work/vc/debug/libxml.ilk +0 -0
- data/work/vc/debug/libxml.lib +0 -0
- data/work/vc/debug/libxml.pdb +0 -0
- data/work/vc/debug/libxml.so +0 -0
@@ -1,20 +1,20 @@
|
|
1
|
-
/* $Id: ruby_xml_xpath_context.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_XPATH_CONTEXT__
|
6
|
-
#define __RUBY_XML_XPATH_CONTEXT__
|
7
|
-
|
8
|
-
extern VALUE cXMLXPathContext;
|
9
|
-
|
10
|
-
typedef struct ruby_xml_xpath_context {
|
11
|
-
VALUE xd;
|
12
|
-
xmlXPathContextPtr ctxt;
|
13
|
-
} ruby_xml_xpath_context;
|
14
|
-
|
15
|
-
VALUE ruby_xml_xpath_context_wrap(xmlXPathContextPtr ctxt);
|
16
|
-
VALUE ruby_xml_xpath_context_new(VALUE anode);
|
17
|
-
VALUE ruby_xml_xpath_context_register_namespace(VALUE self, VALUE prefix, VALUE uri);
|
18
|
-
void ruby_init_xml_xpath_context(void);
|
19
|
-
|
20
|
-
#endif
|
1
|
+
/* $Id: ruby_xml_xpath_context.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_XPATH_CONTEXT__
|
6
|
+
#define __RUBY_XML_XPATH_CONTEXT__
|
7
|
+
|
8
|
+
extern VALUE cXMLXPathContext;
|
9
|
+
|
10
|
+
typedef struct ruby_xml_xpath_context {
|
11
|
+
VALUE xd;
|
12
|
+
xmlXPathContextPtr ctxt;
|
13
|
+
} ruby_xml_xpath_context;
|
14
|
+
|
15
|
+
VALUE ruby_xml_xpath_context_wrap(xmlXPathContextPtr ctxt);
|
16
|
+
VALUE ruby_xml_xpath_context_new(VALUE anode);
|
17
|
+
VALUE ruby_xml_xpath_context_register_namespace(VALUE self, VALUE prefix, VALUE uri);
|
18
|
+
void ruby_init_xml_xpath_context(void);
|
19
|
+
|
20
|
+
#endif
|
@@ -24,8 +24,7 @@ ruby_xml_xpath_object_tabref(xmlXPathObjectPtr xpop, int apos) {
|
|
24
24
|
|
25
25
|
switch(xpop->nodesetval->nodeTab[apos]->type) {
|
26
26
|
case XML_ATTRIBUTE_NODE:
|
27
|
-
return ruby_xml_attr_wrap(
|
28
|
-
(xmlAttrPtr)xpop->nodesetval->nodeTab[apos]);
|
27
|
+
return Qnil;//ruby_xml_attr_wrap((xmlAttrPtr)xpop->nodesetval->nodeTab[apos]);
|
29
28
|
break;
|
30
29
|
default:
|
31
30
|
return ruby_xml_node2_wrap(cXMLNode,
|
@@ -69,12 +68,6 @@ ruby_xml_xpath_object_wrap(xmlXPathObjectPtr xpop)
|
|
69
68
|
ruby_xml_xpath_object_free,
|
70
69
|
xpop);
|
71
70
|
|
72
|
-
if (xpop->type == XPATH_NODESET && !((xpop->nodesetval == NULL) || (xpop->nodesetval->nodeNr == 0))) {
|
73
|
-
int i;
|
74
|
-
for (i = 0; i < xpop->nodesetval->nodeNr; i++) {
|
75
|
-
ruby_xml_xpath_object_tabref(xpop, i);
|
76
|
-
}
|
77
|
-
}
|
78
71
|
break;
|
79
72
|
case XPATH_BOOLEAN:
|
80
73
|
if (xpop->boolval != 0)
|
@@ -104,7 +97,7 @@ ruby_xml_xpath_object_wrap(xmlXPathObjectPtr xpop)
|
|
104
97
|
|
105
98
|
/*
|
106
99
|
* call-seq:
|
107
|
-
* xpath_object.to_a
|
100
|
+
* xpath_object.to_a -> [node, ..., node]
|
108
101
|
*
|
109
102
|
* Obtain an array of the nodes in this set.
|
110
103
|
*/
|
@@ -130,7 +123,7 @@ ruby_xml_xpath_object_to_a(VALUE self)
|
|
130
123
|
|
131
124
|
/*
|
132
125
|
* call-seq:
|
133
|
-
* xpath_object.set
|
126
|
+
* xpath_object.set -> Node::Set
|
134
127
|
*
|
135
128
|
* Obtain the previous type object which is really
|
136
129
|
* just a proxy back to this object. Unless the
|
@@ -153,7 +146,7 @@ ruby_xml_xpath_object_set(VALUE self)
|
|
153
146
|
|
154
147
|
/*
|
155
148
|
* call-seq:
|
156
|
-
* xpath_object.empty?
|
149
|
+
* xpath_object.empty? -> (true|false)
|
157
150
|
*
|
158
151
|
* Determine whether this nodeset is empty (contains no nodes).
|
159
152
|
*/
|
@@ -171,7 +164,7 @@ ruby_xml_xpath_object_empty_q(VALUE self) {
|
|
171
164
|
|
172
165
|
/*
|
173
166
|
* call-seq:
|
174
|
-
* xpath_object.each { |node| ... }
|
167
|
+
* xpath_object.each { |node| ... } -> self
|
175
168
|
*
|
176
169
|
* Call the supplied block for each node in this set.
|
177
170
|
*/
|
@@ -194,7 +187,7 @@ ruby_xml_xpath_object_each(VALUE self)
|
|
194
187
|
|
195
188
|
/*
|
196
189
|
* call-seq:
|
197
|
-
* xpath_object.first
|
190
|
+
* xpath_object.first -> node
|
198
191
|
*
|
199
192
|
* Returns the first node in this node set, or nil if none exist.
|
200
193
|
*/
|
@@ -208,7 +201,7 @@ ruby_xml_xpath_object_first(VALUE self) {
|
|
208
201
|
|
209
202
|
/*
|
210
203
|
* call-seq:
|
211
|
-
* xpath_object[i]
|
204
|
+
* xpath_object[i] -> node
|
212
205
|
*
|
213
206
|
* array index into set of nodes
|
214
207
|
*/
|
@@ -223,7 +216,7 @@ ruby_xml_xpath_object_aref(VALUE self, VALUE aref) {
|
|
223
216
|
|
224
217
|
/*
|
225
218
|
* call-seq:
|
226
|
-
* xpath_object.length
|
219
|
+
* xpath_object.length -> num
|
227
220
|
*
|
228
221
|
* Obtain the length of the nodesetval node list.
|
229
222
|
*/
|
@@ -231,7 +224,7 @@ VALUE
|
|
231
224
|
ruby_xml_xpath_object_length(VALUE self) {
|
232
225
|
xmlXPathObjectPtr xpop;
|
233
226
|
|
234
|
-
if (
|
227
|
+
if (ruby_xml_xpath_object_empty_q(self) == Qtrue)
|
235
228
|
return INT2FIX(0);
|
236
229
|
|
237
230
|
Data_Get_Struct(self,xmlXPathObject,xpop);
|
@@ -9,20 +9,14 @@ typedef struct ruby_xml_xpath_object_s {
|
|
9
9
|
xmlXPathObjectPtr xpop;
|
10
10
|
} ruby_xml_xpath_object;
|
11
11
|
|
12
|
+
void ruby_init_xml_xpath_object(void);
|
12
13
|
VALUE ruby_xml_xpath_object_wrap(xmlXPathObjectPtr xpop);
|
13
|
-
|
14
|
+
|
14
15
|
VALUE ruby_xml_xpath_object_first(VALUE self);
|
15
|
-
VALUE
|
16
|
-
VALUE ruby_xml_xpath_object_empty_q(VALUE self);
|
16
|
+
VALUE ruby_xml_xpath_object_to_a(VALUE self);
|
17
17
|
VALUE ruby_xml_xpath_object_each(VALUE self);
|
18
|
+
VALUE ruby_xml_xpath_object_empty_q(VALUE self);
|
18
19
|
VALUE ruby_xml_xpath_object_first(VALUE self);
|
19
20
|
VALUE ruby_xml_xpath_object_length(VALUE self);
|
20
|
-
VALUE ruby_xml_xpath_object_set_type(VALUE self);
|
21
|
-
VALUE ruby_xml_xpath_object_string(VALUE self);
|
22
|
-
|
23
|
-
void ruby_xml_xpath_object_mark(xmlXPathObjectPtr xpop);
|
24
|
-
void ruby_xml_xpath_object_free(xmlXPathObjectPtr xpop);
|
25
|
-
|
26
|
-
void ruby_init_xml_xpath_object(void);
|
27
21
|
|
28
22
|
#endif
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* $Id: ruby_xml_xpointer.c
|
1
|
+
/* $Id: ruby_xml_xpointer.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
|
|
@@ -11,7 +11,7 @@ VALUE eXMLXPointerInvalidExpression;
|
|
11
11
|
VALUE
|
12
12
|
ruby_xml_xpointer_point(VALUE class, VALUE rnode, VALUE xptr_str) {
|
13
13
|
#ifdef LIBXML_XPTR_ENABLED
|
14
|
-
|
14
|
+
xmlNodePtr xnode;
|
15
15
|
xmlXPathContextPtr ctxt;
|
16
16
|
VALUE rxptr_xpth_ctxt, rxxp;
|
17
17
|
xmlXPathObjectPtr xpath;
|
@@ -20,10 +20,10 @@ ruby_xml_xpointer_point(VALUE class, VALUE rnode, VALUE xptr_str) {
|
|
20
20
|
if (rb_obj_is_kind_of(rnode, cXMLNode) == Qfalse)
|
21
21
|
rb_raise(rb_eTypeError, "require an XML::Node object");
|
22
22
|
|
23
|
-
Data_Get_Struct(rnode,
|
23
|
+
Data_Get_Struct(rnode, xmlNode, xnode);
|
24
24
|
|
25
25
|
rxptr_xpth_ctxt =
|
26
|
-
ruby_xml_xpath_context_wrap(ctxt=xmlXPtrNewContext(
|
26
|
+
ruby_xml_xpath_context_wrap(ctxt=xmlXPtrNewContext(xnode->doc, xnode, NULL));
|
27
27
|
|
28
28
|
if (NIL_P(rxptr_xpth_ctxt))
|
29
29
|
return(Qnil);
|
@@ -49,7 +49,7 @@ ruby_xml_xpointer_point2(VALUE node, VALUE xptr_str) {
|
|
49
49
|
|
50
50
|
/*
|
51
51
|
* call-seq:
|
52
|
-
* XML::XPointer.range(start_node, end_node)
|
52
|
+
* XML::XPointer.range(start_node, end_node) -> xpath
|
53
53
|
*
|
54
54
|
* Create an xpath representing the range between the supplied
|
55
55
|
* start and end node.
|
@@ -57,7 +57,7 @@ ruby_xml_xpointer_point2(VALUE node, VALUE xptr_str) {
|
|
57
57
|
VALUE
|
58
58
|
ruby_xml_xpointer_range(VALUE class, VALUE rstart, VALUE rend) {
|
59
59
|
#ifdef LIBXML_XPTR_ENABLED
|
60
|
-
|
60
|
+
xmlNodePtr start, end;
|
61
61
|
VALUE rxxp;
|
62
62
|
xmlXPathObjectPtr xpath;
|
63
63
|
|
@@ -66,15 +66,15 @@ ruby_xml_xpointer_range(VALUE class, VALUE rstart, VALUE rend) {
|
|
66
66
|
if (rb_obj_is_kind_of(rend, cXMLNode) == Qfalse)
|
67
67
|
rb_raise(rb_eTypeError, "require an XML::Node object as an ending point");
|
68
68
|
|
69
|
-
Data_Get_Struct(rstart,
|
70
|
-
if (start
|
69
|
+
Data_Get_Struct(rstart, xmlNode, start);
|
70
|
+
if (start == NULL)
|
71
71
|
return(Qnil);
|
72
72
|
|
73
|
-
Data_Get_Struct(rend,
|
74
|
-
if (end
|
73
|
+
Data_Get_Struct(rend, xmlNode, end);
|
74
|
+
if (end == NULL)
|
75
75
|
return(Qnil);
|
76
76
|
|
77
|
-
xpath = xmlXPtrNewRangeNodes(start
|
77
|
+
xpath = xmlXPtrNewRangeNodes(start, end);
|
78
78
|
if (xpath == NULL)
|
79
79
|
rb_fatal("You shouldn't be able to have this happen");
|
80
80
|
|
@@ -1,27 +1,27 @@
|
|
1
|
-
/* $Id: ruby_xml_xpointer.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_XPOINTER__
|
6
|
-
#define __RUBY_XML_XPOINTER__
|
7
|
-
|
8
|
-
extern VALUE cXMLXPointer;
|
9
|
-
extern VALUE eXMLXPointerInvalidExpression;
|
10
|
-
|
11
|
-
typedef struct ruby_xml_xpointer {
|
12
|
-
VALUE xd;
|
13
|
-
VALUE ctxt;
|
14
|
-
/*
|
15
|
-
* This needs to go into a xpointer data struct:
|
16
|
-
*
|
17
|
-
* xmlLocationSetPtr xptr;
|
18
|
-
*
|
19
|
-
* I also need an xpointer data struct type.
|
20
|
-
*/
|
21
|
-
} ruby_xml_xpointer;
|
22
|
-
|
23
|
-
VALUE ruby_xml_xpointer_point(VALUE class, VALUE node, VALUE xptr_string);
|
24
|
-
VALUE ruby_xml_xpointer_point2(VALUE node, VALUE xptr_string);
|
25
|
-
void ruby_init_xml_xpointer(void);
|
26
|
-
|
27
|
-
#endif
|
1
|
+
/* $Id: ruby_xml_xpointer.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_XPOINTER__
|
6
|
+
#define __RUBY_XML_XPOINTER__
|
7
|
+
|
8
|
+
extern VALUE cXMLXPointer;
|
9
|
+
extern VALUE eXMLXPointerInvalidExpression;
|
10
|
+
|
11
|
+
typedef struct ruby_xml_xpointer {
|
12
|
+
VALUE xd;
|
13
|
+
VALUE ctxt;
|
14
|
+
/*
|
15
|
+
* This needs to go into a xpointer data struct:
|
16
|
+
*
|
17
|
+
* xmlLocationSetPtr xptr;
|
18
|
+
*
|
19
|
+
* I also need an xpointer data struct type.
|
20
|
+
*/
|
21
|
+
} ruby_xml_xpointer;
|
22
|
+
|
23
|
+
VALUE ruby_xml_xpointer_point(VALUE class, VALUE node, VALUE xptr_string);
|
24
|
+
VALUE ruby_xml_xpointer_point2(VALUE node, VALUE xptr_string);
|
25
|
+
void ruby_init_xml_xpointer(void);
|
26
|
+
|
27
|
+
#endif
|
@@ -1,18 +1,18 @@
|
|
1
|
-
/* $Id: ruby_xml_xpointer_context.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_XPOINTER_CONTEXT__
|
6
|
-
#define __RUBY_XML_XPOINTER_CONTEXT__
|
7
|
-
|
8
|
-
extern VALUE cXMLXPointerContext;
|
9
|
-
extern VALUE eXMLXPointerContextInvalidPath;
|
10
|
-
|
11
|
-
typedef struct ruby_xml_xpointer_context {
|
12
|
-
VALUE xd;
|
13
|
-
xmlXPathContextPtr ctxt;
|
14
|
-
} ruby_xml_xpointer_context;
|
15
|
-
|
16
|
-
void ruby_init_xml_xpointer_context(void);
|
17
|
-
|
18
|
-
#endif
|
1
|
+
/* $Id: ruby_xml_xpointer_context.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_XPOINTER_CONTEXT__
|
6
|
+
#define __RUBY_XML_XPOINTER_CONTEXT__
|
7
|
+
|
8
|
+
extern VALUE cXMLXPointerContext;
|
9
|
+
extern VALUE eXMLXPointerContextInvalidPath;
|
10
|
+
|
11
|
+
typedef struct ruby_xml_xpointer_context {
|
12
|
+
VALUE xd;
|
13
|
+
xmlXPathContextPtr ctxt;
|
14
|
+
} ruby_xml_xpointer_context;
|
15
|
+
|
16
|
+
void ruby_init_xml_xpointer_context(void);
|
17
|
+
|
18
|
+
#endif
|
data/ext/libxml/version.h
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
/* Don't nuke this block! It is used for automatically updating the
|
2
2
|
* versions below. VERSION = string formatting, VERNUM = numbered
|
3
3
|
* version for inline testing: increment both or none at all.*/
|
4
|
-
#define RUBY_LIBXML_VERSION "0.
|
4
|
+
#define RUBY_LIBXML_VERSION "0.7.0"
|
5
5
|
#define RUBY_LIBXML_VERNUM 0
|
6
6
|
#define RUBY_LIBXML_VER_MAJ 0
|
7
|
-
#define RUBY_LIBXML_VER_MIN
|
7
|
+
#define RUBY_LIBXML_VER_MIN 7
|
8
8
|
#define RUBY_LIBXML_VER_MIC 0
|
9
9
|
#define RUBY_LIBXML_VER_PATCH 0
|
data/lib/libxml.rb
CHANGED
@@ -1,125 +1,134 @@
|
|
1
|
-
# $Id: libxml.rb
|
2
|
-
# Please see the LICENSE file for copyright and distribution information
|
3
|
-
|
4
|
-
require 'libxml_ruby.so'
|
5
|
-
|
6
|
-
module XML::XMLParserOptions
|
7
|
-
XML_PARSE_RECOVER = 1 # recover on errors
|
8
|
-
XML_PARSE_NOENT = 2 # substitute entities
|
9
|
-
XML_PARSE_DTDLOAD = 4 # load the external subset
|
10
|
-
XML_PARSE_DTDATTR = 8 # default DTD attributes
|
11
|
-
XML_PARSE_DTDVALID = 16 # validate with the DTD
|
12
|
-
XML_PARSE_NOERROR = 32 # suppress error reports
|
13
|
-
XML_PARSE_NOWARNING = 64 # suppress warning reports
|
14
|
-
XML_PARSE_PEDANTIC = 128 # pedantic error reporting
|
15
|
-
XML_PARSE_NOBLANKS = 256 # remove blank nodes
|
16
|
-
XML_PARSE_SAX1 = 512 # use the SAX1 interface internally
|
17
|
-
XML_PARSE_XINCLUDE = 1024 # Implement XInclude substitition
|
18
|
-
XML_PARSE_NONET = 2048 # Forbid network access
|
19
|
-
XML_PARSE_NODICT = 4096 # Do not reuse the context dictionnary
|
20
|
-
XML_PARSE_NSCLEAN = 8192 # remove redundant namespaces declarations
|
21
|
-
XML_PARSE_NOCDATA = 16384 # merge CDATA as text nodes
|
22
|
-
XML_PARSE_NOXINCNODE = 32768 # do not generate XINCLUDE START/END nodes
|
23
|
-
XML_PARSE_COMPACT = 65536 # compact small text nodes; no modification of the tree allowed afterwards (will possibly crash if you try to modify the tree)
|
24
|
-
end
|
25
|
-
|
26
|
-
class XML::Document
|
27
|
-
include Enumerable
|
28
|
-
|
29
|
-
# maybe, maybe not...
|
30
|
-
def each(&blk)
|
31
|
-
find('//*').each(&blk)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
class XML::Node::Set
|
36
|
-
include Enumerable
|
37
|
-
|
38
|
-
# inefficient, but maybe can find a way to cache the
|
39
|
-
# ary and dump on change?
|
40
|
-
def [](i, count = nil)
|
41
|
-
if count
|
42
|
-
to_a[i,count]
|
43
|
-
else
|
44
|
-
to_a[i]
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def to_s #:nodoc:
|
49
|
-
to_a.to_s
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
module XML::SiblingEnum
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
def
|
83
|
-
siblings(
|
84
|
-
end
|
85
|
-
|
86
|
-
#
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
end
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
def
|
118
|
-
inject(
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
1
|
+
# $Id: libxml.rb 326 2008-07-08 23:00:50Z cfis $
|
2
|
+
# Please see the LICENSE file for copyright and distribution information
|
3
|
+
|
4
|
+
require 'libxml_ruby.so'
|
5
|
+
|
6
|
+
module XML::XMLParserOptions
|
7
|
+
XML_PARSE_RECOVER = 1 # recover on errors
|
8
|
+
XML_PARSE_NOENT = 2 # substitute entities
|
9
|
+
XML_PARSE_DTDLOAD = 4 # load the external subset
|
10
|
+
XML_PARSE_DTDATTR = 8 # default DTD attributes
|
11
|
+
XML_PARSE_DTDVALID = 16 # validate with the DTD
|
12
|
+
XML_PARSE_NOERROR = 32 # suppress error reports
|
13
|
+
XML_PARSE_NOWARNING = 64 # suppress warning reports
|
14
|
+
XML_PARSE_PEDANTIC = 128 # pedantic error reporting
|
15
|
+
XML_PARSE_NOBLANKS = 256 # remove blank nodes
|
16
|
+
XML_PARSE_SAX1 = 512 # use the SAX1 interface internally
|
17
|
+
XML_PARSE_XINCLUDE = 1024 # Implement XInclude substitition
|
18
|
+
XML_PARSE_NONET = 2048 # Forbid network access
|
19
|
+
XML_PARSE_NODICT = 4096 # Do not reuse the context dictionnary
|
20
|
+
XML_PARSE_NSCLEAN = 8192 # remove redundant namespaces declarations
|
21
|
+
XML_PARSE_NOCDATA = 16384 # merge CDATA as text nodes
|
22
|
+
XML_PARSE_NOXINCNODE = 32768 # do not generate XINCLUDE START/END nodes
|
23
|
+
XML_PARSE_COMPACT = 65536 # compact small text nodes; no modification of the tree allowed afterwards (will possibly crash if you try to modify the tree)
|
24
|
+
end
|
25
|
+
|
26
|
+
class XML::Document
|
27
|
+
include Enumerable
|
28
|
+
|
29
|
+
# maybe, maybe not...
|
30
|
+
def each(&blk)
|
31
|
+
find('//*').each(&blk)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class XML::Node::Set
|
36
|
+
include Enumerable
|
37
|
+
|
38
|
+
# inefficient, but maybe can find a way to cache the
|
39
|
+
# ary and dump on change?
|
40
|
+
def [](i, count = nil)
|
41
|
+
if count
|
42
|
+
to_a[i,count]
|
43
|
+
else
|
44
|
+
to_a[i]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_s #:nodoc:
|
49
|
+
to_a.to_s
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
module XML::SiblingEnum
|
54
|
+
def length
|
55
|
+
inject(0) do |result, node|
|
56
|
+
result + 1
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
# Iterates nodes and attributes
|
63
|
+
def siblings(node, &blk)
|
64
|
+
if n = node
|
65
|
+
loop do
|
66
|
+
blk.call(n)
|
67
|
+
break unless n = n.next
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
class XML::Node
|
74
|
+
include XML::SiblingEnum
|
75
|
+
include Enumerable
|
76
|
+
|
77
|
+
# maybe these don't belong on all nodes...
|
78
|
+
def each_child(&blk)
|
79
|
+
siblings(child, &blk)
|
80
|
+
end
|
81
|
+
|
82
|
+
def each_attr(&blk)
|
83
|
+
siblings(properties, &blk)
|
84
|
+
end
|
85
|
+
|
86
|
+
# all siblings INCLUDING self
|
87
|
+
def each_sibling(&blk)
|
88
|
+
siblings(self, &blk)
|
89
|
+
end
|
90
|
+
|
91
|
+
# I guess this is what you'd expect?
|
92
|
+
alias :each :each_child
|
93
|
+
|
94
|
+
def to_a
|
95
|
+
inject([]) do |ary,n|
|
96
|
+
ary << n
|
97
|
+
ary
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def clone
|
102
|
+
copy(false)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
class XML::Attr
|
107
|
+
include XML::SiblingEnum
|
108
|
+
include Enumerable
|
109
|
+
|
110
|
+
def each_sibling(&blk)
|
111
|
+
siblings(self,&blk)
|
112
|
+
end
|
113
|
+
|
114
|
+
alias :each_attr :each_sibling
|
115
|
+
alias :each :each_sibling
|
116
|
+
|
117
|
+
def to_h
|
118
|
+
inject({}) do |h,a|
|
119
|
+
h[a.name] = a.value
|
120
|
+
h
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def to_a
|
125
|
+
inject([]) do |ary,a|
|
126
|
+
ary << [a.name, a.value]
|
127
|
+
ary
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def to_s
|
132
|
+
"#{name} = #{value}"
|
133
|
+
end
|
134
|
+
end
|