libxml-ruby 0.9.5-x86-mswin32-60 → 0.9.6-x86-mswin32-60
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.
- data/CHANGES +28 -0
- data/README +8 -12
- data/ext/libxml/cbg.c +86 -86
- data/ext/libxml/libxml.c +875 -899
- data/ext/libxml/ruby_libxml.h +91 -65
- data/ext/libxml/ruby_xml_attr.c +485 -485
- data/ext/libxml/ruby_xml_attr.h +3 -3
- data/ext/libxml/ruby_xml_attributes.h +2 -2
- data/ext/libxml/ruby_xml_document.c +124 -307
- data/ext/libxml/ruby_xml_document.h +3 -3
- data/ext/libxml/ruby_xml_dtd.c +119 -119
- data/ext/libxml/ruby_xml_dtd.h +2 -2
- data/ext/libxml/ruby_xml_error.c +1 -1
- data/ext/libxml/ruby_xml_error.h +2 -2
- data/ext/libxml/ruby_xml_html_parser.c +119 -119
- data/ext/libxml/ruby_xml_html_parser.h +3 -3
- data/ext/libxml/ruby_xml_input.c +13 -11
- data/ext/libxml/ruby_xml_input.h +3 -3
- data/ext/libxml/ruby_xml_input_cbg.c +197 -197
- data/ext/libxml/ruby_xml_namespace.c +158 -0
- data/ext/libxml/ruby_xml_namespace.h +12 -0
- data/ext/libxml/ruby_xml_namespaces.c +303 -0
- data/ext/libxml/{ruby_xml_ns.h → ruby_xml_namespaces.h} +4 -5
- data/ext/libxml/ruby_xml_node.c +88 -293
- data/ext/libxml/ruby_xml_node.h +4 -4
- data/ext/libxml/ruby_xml_parser.c +152 -152
- data/ext/libxml/ruby_xml_parser.h +3 -3
- data/ext/libxml/ruby_xml_parser_context.c +630 -657
- data/ext/libxml/ruby_xml_parser_context.h +3 -3
- data/ext/libxml/ruby_xml_reader.c +899 -904
- data/ext/libxml/ruby_xml_reader.h +2 -2
- data/ext/libxml/ruby_xml_relaxng.h +2 -2
- data/ext/libxml/ruby_xml_sax_parser.c +175 -175
- data/ext/libxml/ruby_xml_sax_parser.h +3 -3
- data/ext/libxml/ruby_xml_schema.c +165 -165
- data/ext/libxml/ruby_xml_schema.h +2 -2
- data/ext/libxml/ruby_xml_state.h +2 -2
- data/ext/libxml/ruby_xml_xinclude.c +24 -24
- data/ext/libxml/ruby_xml_xinclude.h +3 -3
- data/ext/libxml/ruby_xml_xpath.c +108 -108
- data/ext/libxml/ruby_xml_xpath.h +3 -3
- data/ext/libxml/ruby_xml_xpath_context.c +84 -35
- data/ext/libxml/ruby_xml_xpath_context.h +3 -3
- data/ext/libxml/ruby_xml_xpath_expression.c +5 -7
- data/ext/libxml/ruby_xml_xpath_expression.h +2 -2
- data/ext/libxml/ruby_xml_xpath_object.c +7 -7
- data/ext/libxml/ruby_xml_xpath_object.h +2 -2
- data/ext/libxml/ruby_xml_xpointer.c +107 -107
- data/ext/libxml/ruby_xml_xpointer.h +3 -3
- data/ext/libxml/version.h +2 -2
- data/ext/mingw/libxml_ruby.dll.a +0 -0
- data/ext/mingw/libxml_ruby.so +0 -0
- data/ext/vc/libxml_ruby.vcproj +13 -5
- data/lib/libxml.rb +4 -1
- data/lib/libxml/document.rb +40 -6
- data/lib/libxml/hpricot.rb +76 -76
- data/lib/libxml/namespace.rb +60 -0
- data/lib/libxml/namespaces.rb +36 -0
- data/lib/libxml/node.rb +90 -26
- data/lib/libxml/ns.rb +20 -0
- data/test/model/bands.xml +5 -0
- data/test/tc_attributes.rb +1 -1
- data/test/tc_document.rb +24 -41
- data/test/tc_document_write.rb +87 -115
- data/test/tc_namespace.rb +59 -0
- data/test/tc_namespaces.rb +174 -0
- data/test/tc_node.rb +41 -33
- data/test/tc_node_copy.rb +1 -1
- data/test/tc_node_edit.rb +6 -0
- data/test/tc_node_write.rb +76 -0
- data/test/tc_xinclude.rb +2 -9
- data/test/tc_xpath.rb +38 -11
- data/test/test_suite.rb +3 -1
- metadata +16 -9
- data/ext/libxml/ruby_xml_ns.c +0 -150
- data/test/ets_copy_bug.rb +0 -21
- data/test/ets_copy_bug3.rb +0 -38
- data/test/model/default_validation_bug.rb +0 -0
- data/test/tc_ns.rb +0 -18
@@ -1,9 +1,9 @@
|
|
1
|
-
/* $Id: ruby_xml_xpath_context.h
|
1
|
+
/* $Id: ruby_xml_xpath_context.h 666 2008-12-07 00:16:50Z cfis $ */
|
2
2
|
|
3
3
|
/* Please see the LICENSE file for copyright and distribution information */
|
4
4
|
|
5
|
-
#ifndef
|
6
|
-
#define
|
5
|
+
#ifndef __RXML_XPATH_CONTEXT__
|
6
|
+
#define __RXML_XPATH_CONTEXT__
|
7
7
|
|
8
8
|
extern VALUE cXMLXPathContext;
|
9
9
|
void ruby_init_xml_xpath_context(void);
|
@@ -37,8 +37,8 @@ static VALUE rxml_xpath_expression_alloc(VALUE klass)
|
|
37
37
|
/* call-seq:
|
38
38
|
* XPath::Expression.new(expression) -> XPath::Expression
|
39
39
|
*
|
40
|
-
*
|
41
|
-
*
|
40
|
+
* Compiles an XPatch expression. This improves performance
|
41
|
+
* when an XPath expression is called multiple times.
|
42
42
|
*
|
43
43
|
* doc = XML::Document.string('<header><first>hi</first></header>')
|
44
44
|
* expr = XPath::Expression.new('//first')
|
@@ -46,7 +46,7 @@ static VALUE rxml_xpath_expression_alloc(VALUE klass)
|
|
46
46
|
*/
|
47
47
|
static VALUE rxml_xpath_expression_initialize(VALUE self, VALUE expression)
|
48
48
|
{
|
49
|
-
xmlXPathCompExprPtr compexpr = xmlXPathCompile(StringValueCStr(expression));
|
49
|
+
xmlXPathCompExprPtr compexpr = xmlXPathCompile((const xmlChar*)StringValueCStr(expression));
|
50
50
|
|
51
51
|
if (compexpr == NULL)
|
52
52
|
{
|
@@ -62,8 +62,6 @@ void ruby_init_xml_xpath_expression(void)
|
|
62
62
|
{
|
63
63
|
cXMLXPathExpression = rb_define_class_under(mXPath, "Expression", rb_cObject);
|
64
64
|
rb_define_alloc_func(cXMLXPathExpression, rxml_xpath_expression_alloc);
|
65
|
-
rb_define_singleton_method(cXMLXPathExpression, "compile",
|
66
|
-
|
67
|
-
rb_define_method(cXMLXPathExpression, "initialize",
|
68
|
-
rxml_xpath_expression_initialize, 1);
|
65
|
+
rb_define_singleton_method(cXMLXPathExpression, "compile", rb_class_new_instance, 1);
|
66
|
+
rb_define_method(cXMLXPathExpression, "initialize", rxml_xpath_expression_initialize, 1);
|
69
67
|
}
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
/* Please see the LICENSE file for copyright and distribution information */
|
4
4
|
|
5
|
-
#ifndef
|
6
|
-
#define
|
5
|
+
#ifndef __RXML_XPATH_EXPRESSION__
|
6
|
+
#define __RXML_XPATH_EXPRESSION__
|
7
7
|
|
8
8
|
extern VALUE cXMLXPathExpression;
|
9
9
|
|
@@ -83,7 +83,7 @@ VALUE rxml_xpath_object_wrap(xmlXPathObjectPtr xpop)
|
|
83
83
|
xmlXPathFreeObject(xpop);
|
84
84
|
break;
|
85
85
|
case XPATH_STRING:
|
86
|
-
rval = rb_str_new2(xpop->stringval);
|
86
|
+
rval = rb_str_new2((const char*)xpop->stringval);
|
87
87
|
|
88
88
|
xmlXPathFreeObject(xpop);
|
89
89
|
break;
|
@@ -284,15 +284,15 @@ static VALUE rxml_xpath_object_string(VALUE self)
|
|
284
284
|
*/
|
285
285
|
static VALUE rxml_xpath_object_debug(VALUE self)
|
286
286
|
{
|
287
|
+
#ifdef LIBXML_DEBUG_ENABLED
|
287
288
|
xmlXPathObjectPtr xpop;
|
288
|
-
|
289
|
-
#ifndef LIBXML_DEBUG_ENABLED
|
290
|
-
rb_raise(rb_eTypeError, "libxml was not compiled with debug support.");
|
291
|
-
#endif
|
292
|
-
|
293
289
|
Data_Get_Struct(self, xmlXPathObject, xpop);
|
294
290
|
xmlXPathDebugDumpObject(stdout, xpop, 0);
|
295
|
-
return
|
291
|
+
return Qtrue;
|
292
|
+
#else
|
293
|
+
rb_warn("libxml was compiled without debugging support.")
|
294
|
+
return Qfalse;
|
295
|
+
#endif
|
296
296
|
}
|
297
297
|
|
298
298
|
void ruby_init_xml_xpath_object(void)
|
@@ -1,107 +1,107 @@
|
|
1
|
-
/* $Id: ruby_xml_xpointer.c 650 2008-11-30 03:40:22Z cfis $ */
|
2
|
-
|
3
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
4
|
-
|
5
|
-
#include "ruby_libxml.h"
|
6
|
-
#include "ruby_xml_xpointer.h"
|
7
|
-
|
8
|
-
VALUE cXMLXPointer;
|
9
|
-
|
10
|
-
/*
|
11
|
-
* Document-class: LibXML::XML::XPointer
|
12
|
-
*
|
13
|
-
* The XML::Pointer class provides a standards based API for searching an xml document.
|
14
|
-
* XPointer is based on the XML Path Language (XML::XPath) and is documented
|
15
|
-
* at http://www.w3.org/TR/WD-xptr.
|
16
|
-
*/
|
17
|
-
|
18
|
-
static VALUE rxml_xpointer_point(VALUE class, VALUE rnode, VALUE xptr_str)
|
19
|
-
{
|
20
|
-
#ifdef LIBXML_XPTR_ENABLED
|
21
|
-
xmlNodePtr xnode;
|
22
|
-
xmlXPathContextPtr xctxt;
|
23
|
-
xmlXPathObjectPtr xpop;
|
24
|
-
|
25
|
-
VALUE context;
|
26
|
-
VALUE result;
|
27
|
-
VALUE argv[1];
|
28
|
-
|
29
|
-
Check_Type(xptr_str, T_STRING);
|
30
|
-
if (rb_obj_is_kind_of(rnode, cXMLNode) == Qfalse)
|
31
|
-
rb_raise(rb_eTypeError, "require an XML::Node object");
|
32
|
-
|
33
|
-
Data_Get_Struct(rnode, xmlNode, xnode);
|
34
|
-
|
35
|
-
argv[0] = rb_funcall(rnode, rb_intern("doc"), 0);
|
36
|
-
context = rb_class_new_instance(1, argv, cXMLXPathContext);
|
37
|
-
Data_Get_Struct(context, xmlXPathContext, xctxt);
|
38
|
-
|
39
|
-
xpop = xmlXPtrEval((xmlChar*)StringValuePtr(xptr_str), xctxt);
|
40
|
-
if (!xpop)
|
41
|
-
rxml_raise(&xmlLastError);
|
42
|
-
|
43
|
-
result = rxml_xpath_object_wrap(xpop);
|
44
|
-
rb_iv_set(result, "@context", context);
|
45
|
-
|
46
|
-
return(result);
|
47
|
-
#else
|
48
|
-
rb_warn("libxml was compiled without XPointer support");
|
49
|
-
return (Qfalse);
|
50
|
-
#endif
|
51
|
-
}
|
52
|
-
|
53
|
-
VALUE rxml_xpointer_point2(VALUE node, VALUE xptr_str)
|
54
|
-
{
|
55
|
-
return (rxml_xpointer_point(cXMLXPointer, node, xptr_str));
|
56
|
-
}
|
57
|
-
|
58
|
-
/*
|
59
|
-
* call-seq:
|
60
|
-
* XML::XPointer.range(start_node, end_node) -> xpath
|
61
|
-
*
|
62
|
-
* Create an xpath representing the range between the supplied
|
63
|
-
* start and end node.
|
64
|
-
*/
|
65
|
-
static VALUE rxml_xpointer_range(VALUE class, VALUE rstart, VALUE rend)
|
66
|
-
{
|
67
|
-
#ifdef LIBXML_XPTR_ENABLED
|
68
|
-
xmlNodePtr start, end;
|
69
|
-
VALUE rxxp;
|
70
|
-
xmlXPathObjectPtr xpath;
|
71
|
-
|
72
|
-
if (rb_obj_is_kind_of(rstart, cXMLNode) == Qfalse)
|
73
|
-
rb_raise(rb_eTypeError, "require an XML::Node object as a starting point");
|
74
|
-
if (rb_obj_is_kind_of(rend, cXMLNode) == Qfalse)
|
75
|
-
rb_raise(rb_eTypeError, "require an XML::Node object as an ending point");
|
76
|
-
|
77
|
-
Data_Get_Struct(rstart, xmlNode, start);
|
78
|
-
if (start == NULL)
|
79
|
-
return(Qnil);
|
80
|
-
|
81
|
-
Data_Get_Struct(rend, xmlNode, end);
|
82
|
-
if (end == NULL)
|
83
|
-
return(Qnil);
|
84
|
-
|
85
|
-
xpath = xmlXPtrNewRangeNodes(start, end);
|
86
|
-
if (xpath == NULL)
|
87
|
-
rb_fatal("You shouldn't be able to have this happen");
|
88
|
-
|
89
|
-
rxxp = rxml_xpath_object_wrap(xpath);
|
90
|
-
return(rxxp);
|
91
|
-
#else
|
92
|
-
rb_warn("libxml was compiled without XPointer support");
|
93
|
-
return (Qfalse);
|
94
|
-
#endif
|
95
|
-
}
|
96
|
-
|
97
|
-
// Rdoc needs to know
|
98
|
-
#ifdef RDOC_NEVER_DEFINED
|
99
|
-
mLibXML = rb_define_module("LibXML");
|
100
|
-
mXML = rb_define_module_under(mLibXML, "XML");
|
101
|
-
#endif
|
102
|
-
|
103
|
-
void ruby_init_xml_xpointer(void)
|
104
|
-
{
|
105
|
-
cXMLXPointer = rb_define_class_under(mXML, "XPointer", rb_cObject);
|
106
|
-
rb_define_singleton_method(cXMLXPointer, "range", rxml_xpointer_range, 2);
|
107
|
-
}
|
1
|
+
/* $Id: ruby_xml_xpointer.c 650 2008-11-30 03:40:22Z cfis $ */
|
2
|
+
|
3
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
4
|
+
|
5
|
+
#include "ruby_libxml.h"
|
6
|
+
#include "ruby_xml_xpointer.h"
|
7
|
+
|
8
|
+
VALUE cXMLXPointer;
|
9
|
+
|
10
|
+
/*
|
11
|
+
* Document-class: LibXML::XML::XPointer
|
12
|
+
*
|
13
|
+
* The XML::Pointer class provides a standards based API for searching an xml document.
|
14
|
+
* XPointer is based on the XML Path Language (XML::XPath) and is documented
|
15
|
+
* at http://www.w3.org/TR/WD-xptr.
|
16
|
+
*/
|
17
|
+
|
18
|
+
static VALUE rxml_xpointer_point(VALUE class, VALUE rnode, VALUE xptr_str)
|
19
|
+
{
|
20
|
+
#ifdef LIBXML_XPTR_ENABLED
|
21
|
+
xmlNodePtr xnode;
|
22
|
+
xmlXPathContextPtr xctxt;
|
23
|
+
xmlXPathObjectPtr xpop;
|
24
|
+
|
25
|
+
VALUE context;
|
26
|
+
VALUE result;
|
27
|
+
VALUE argv[1];
|
28
|
+
|
29
|
+
Check_Type(xptr_str, T_STRING);
|
30
|
+
if (rb_obj_is_kind_of(rnode, cXMLNode) == Qfalse)
|
31
|
+
rb_raise(rb_eTypeError, "require an XML::Node object");
|
32
|
+
|
33
|
+
Data_Get_Struct(rnode, xmlNode, xnode);
|
34
|
+
|
35
|
+
argv[0] = rb_funcall(rnode, rb_intern("doc"), 0);
|
36
|
+
context = rb_class_new_instance(1, argv, cXMLXPathContext);
|
37
|
+
Data_Get_Struct(context, xmlXPathContext, xctxt);
|
38
|
+
|
39
|
+
xpop = xmlXPtrEval((xmlChar*)StringValuePtr(xptr_str), xctxt);
|
40
|
+
if (!xpop)
|
41
|
+
rxml_raise(&xmlLastError);
|
42
|
+
|
43
|
+
result = rxml_xpath_object_wrap(xpop);
|
44
|
+
rb_iv_set(result, "@context", context);
|
45
|
+
|
46
|
+
return(result);
|
47
|
+
#else
|
48
|
+
rb_warn("libxml was compiled without XPointer support");
|
49
|
+
return (Qfalse);
|
50
|
+
#endif
|
51
|
+
}
|
52
|
+
|
53
|
+
VALUE rxml_xpointer_point2(VALUE node, VALUE xptr_str)
|
54
|
+
{
|
55
|
+
return (rxml_xpointer_point(cXMLXPointer, node, xptr_str));
|
56
|
+
}
|
57
|
+
|
58
|
+
/*
|
59
|
+
* call-seq:
|
60
|
+
* XML::XPointer.range(start_node, end_node) -> xpath
|
61
|
+
*
|
62
|
+
* Create an xpath representing the range between the supplied
|
63
|
+
* start and end node.
|
64
|
+
*/
|
65
|
+
static VALUE rxml_xpointer_range(VALUE class, VALUE rstart, VALUE rend)
|
66
|
+
{
|
67
|
+
#ifdef LIBXML_XPTR_ENABLED
|
68
|
+
xmlNodePtr start, end;
|
69
|
+
VALUE rxxp;
|
70
|
+
xmlXPathObjectPtr xpath;
|
71
|
+
|
72
|
+
if (rb_obj_is_kind_of(rstart, cXMLNode) == Qfalse)
|
73
|
+
rb_raise(rb_eTypeError, "require an XML::Node object as a starting point");
|
74
|
+
if (rb_obj_is_kind_of(rend, cXMLNode) == Qfalse)
|
75
|
+
rb_raise(rb_eTypeError, "require an XML::Node object as an ending point");
|
76
|
+
|
77
|
+
Data_Get_Struct(rstart, xmlNode, start);
|
78
|
+
if (start == NULL)
|
79
|
+
return(Qnil);
|
80
|
+
|
81
|
+
Data_Get_Struct(rend, xmlNode, end);
|
82
|
+
if (end == NULL)
|
83
|
+
return(Qnil);
|
84
|
+
|
85
|
+
xpath = xmlXPtrNewRangeNodes(start, end);
|
86
|
+
if (xpath == NULL)
|
87
|
+
rb_fatal("You shouldn't be able to have this happen");
|
88
|
+
|
89
|
+
rxxp = rxml_xpath_object_wrap(xpath);
|
90
|
+
return(rxxp);
|
91
|
+
#else
|
92
|
+
rb_warn("libxml was compiled without XPointer support");
|
93
|
+
return (Qfalse);
|
94
|
+
#endif
|
95
|
+
}
|
96
|
+
|
97
|
+
// Rdoc needs to know
|
98
|
+
#ifdef RDOC_NEVER_DEFINED
|
99
|
+
mLibXML = rb_define_module("LibXML");
|
100
|
+
mXML = rb_define_module_under(mLibXML, "XML");
|
101
|
+
#endif
|
102
|
+
|
103
|
+
void ruby_init_xml_xpointer(void)
|
104
|
+
{
|
105
|
+
cXMLXPointer = rb_define_class_under(mXML, "XPointer", rb_cObject);
|
106
|
+
rb_define_singleton_method(cXMLXPointer, "range", rxml_xpointer_range, 2);
|
107
|
+
}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
/* $Id: ruby_xml_xpointer.h
|
1
|
+
/* $Id: ruby_xml_xpointer.h 666 2008-12-07 00:16:50Z cfis $ */
|
2
2
|
|
3
3
|
/* Please see the LICENSE file for copyright and distribution information */
|
4
4
|
|
5
|
-
#ifndef
|
6
|
-
#define
|
5
|
+
#ifndef __RXML_XPOINTER__
|
6
|
+
#define __RXML_XPOINTER__
|
7
7
|
|
8
8
|
extern VALUE cXMLXPointer;
|
9
9
|
|
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.9.
|
4
|
+
#define RUBY_LIBXML_VERSION "0.9.6"
|
5
5
|
#define RUBY_LIBXML_VERNUM 0
|
6
6
|
#define RUBY_LIBXML_VER_MAJ 0
|
7
7
|
#define RUBY_LIBXML_VER_MIN 9
|
8
|
-
#define RUBY_LIBXML_VER_MIC
|
8
|
+
#define RUBY_LIBXML_VER_MIC 6
|
9
9
|
#define RUBY_LIBXML_VER_PATCH 0
|
data/ext/mingw/libxml_ruby.dll.a
CHANGED
Binary file
|
data/ext/mingw/libxml_ruby.so
CHANGED
Binary file
|
data/ext/vc/libxml_ruby.vcproj
CHANGED
@@ -63,7 +63,7 @@
|
|
63
63
|
<Tool
|
64
64
|
Name="VCLinkerTool"
|
65
65
|
AdditionalDependencies="msvcrt-ruby18.lib libxml2.lib"
|
66
|
-
OutputFile="C:\Development\ruby\lib\ruby\gems\1.8\gems\libxml-ruby-0.9.
|
66
|
+
OutputFile="C:\Development\ruby\lib\ruby\gems\1.8\gems\libxml-ruby-0.9.6-x86-mswin32-60\lib\$(ProjectName).so"
|
67
67
|
LinkIncremental="2"
|
68
68
|
AdditionalLibraryDirectories="C:\Development\ruby\lib;C:\Development\msys\local\lib"
|
69
69
|
GenerateDebugInformation="true"
|
@@ -222,11 +222,15 @@
|
|
222
222
|
>
|
223
223
|
</File>
|
224
224
|
<File
|
225
|
-
RelativePath="..\libxml\
|
225
|
+
RelativePath="..\libxml\ruby_xml_namespace.c"
|
226
226
|
>
|
227
227
|
</File>
|
228
228
|
<File
|
229
|
-
RelativePath="..\libxml\
|
229
|
+
RelativePath="..\libxml\ruby_xml_namespaces.c"
|
230
|
+
>
|
231
|
+
</File>
|
232
|
+
<File
|
233
|
+
RelativePath="..\libxml\ruby_xml_node.c"
|
230
234
|
>
|
231
235
|
</File>
|
232
236
|
<File
|
@@ -324,11 +328,15 @@
|
|
324
328
|
>
|
325
329
|
</File>
|
326
330
|
<File
|
327
|
-
RelativePath="..\libxml\
|
331
|
+
RelativePath="..\libxml\ruby_xml_namespace.h"
|
328
332
|
>
|
329
333
|
</File>
|
330
334
|
<File
|
331
|
-
RelativePath="..\libxml\
|
335
|
+
RelativePath="..\libxml\ruby_xml_namespaces.h"
|
336
|
+
>
|
337
|
+
</File>
|
338
|
+
<File
|
339
|
+
RelativePath="..\libxml\ruby_xml_node.h"
|
332
340
|
>
|
333
341
|
</File>
|
334
342
|
<File
|
data/lib/libxml.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: libxml.rb
|
1
|
+
# $Id: libxml.rb 666 2008-12-07 00:16:50Z cfis $
|
2
2
|
# Please see the LICENSE file for copyright and distribution information
|
3
3
|
|
4
4
|
# If running on Windows, then add the current directory to the PATH
|
@@ -17,7 +17,10 @@ require 'libxml/parser'
|
|
17
17
|
require 'libxml/parser_options'
|
18
18
|
require 'libxml/parser_context'
|
19
19
|
require 'libxml/document'
|
20
|
+
require 'libxml/namespaces'
|
21
|
+
require 'libxml/namespace'
|
20
22
|
require 'libxml/node'
|
23
|
+
require 'libxml/ns'
|
21
24
|
require 'libxml/attributes'
|
22
25
|
require 'libxml/attr'
|
23
26
|
require 'libxml/tree'
|
data/lib/libxml/document.rb
CHANGED
@@ -17,6 +17,20 @@ module LibXML
|
|
17
17
|
Parser.io(value).parse
|
18
18
|
end
|
19
19
|
|
20
|
+
# Returns a new XML::XPathContext for the document.
|
21
|
+
#
|
22
|
+
# call-seq:
|
23
|
+
# document.context(namespaces=nil) -> XPath::Context
|
24
|
+
#
|
25
|
+
# Namespaces is an optional array of XML::NS objects
|
26
|
+
def context(nslist = nil)
|
27
|
+
context = XPath::Context.new(self)
|
28
|
+
context.node = self.root
|
29
|
+
context.register_namespaces_from_node(self.root)
|
30
|
+
context.register_namespaces(nslist) if nslist
|
31
|
+
context
|
32
|
+
end
|
33
|
+
|
20
34
|
# Return the nodes matching the specified xpath expression,
|
21
35
|
# optionally using the specified namespace. For more
|
22
36
|
# information about working with namespaces, please refer
|
@@ -47,12 +61,7 @@ module LibXML
|
|
47
61
|
# nodes = nil
|
48
62
|
# GC.start
|
49
63
|
def find(xpath, nslist = nil)
|
50
|
-
context
|
51
|
-
context.node = self.root
|
52
|
-
context.register_namespaces_from_node(self.root)
|
53
|
-
context.register_namespaces(nslist) if nslist
|
54
|
-
|
55
|
-
context.find(xpath)
|
64
|
+
self.context(nslist).find(xpath)
|
56
65
|
end
|
57
66
|
|
58
67
|
# Return the first node matching the specified xpath expression.
|
@@ -61,6 +70,31 @@ module LibXML
|
|
61
70
|
def find_first(xpath, nslist = nil)
|
62
71
|
find(xpath, nslist).first
|
63
72
|
end
|
73
|
+
|
74
|
+
def dump # :nodoc:
|
75
|
+
warn('Document#dump is deprecated. Use Document#to_s instead.')
|
76
|
+
self.to_s
|
77
|
+
end
|
78
|
+
|
79
|
+
def format_dump # :nodoc:
|
80
|
+
warn('Document#format_dump is deprecated. Use Document#to_s instead.')
|
81
|
+
self.to_s
|
82
|
+
end
|
83
|
+
|
84
|
+
def debug_dump # :nodoc:
|
85
|
+
warn('Document#debug_dump is deprecated. Use Document#debug instead.')
|
86
|
+
self.debug
|
87
|
+
end
|
88
|
+
|
89
|
+
def debug_dump_head # :nodoc:
|
90
|
+
warn('Document#debug_dump_head is deprecated. Use Document#debug instead.')
|
91
|
+
self.debug
|
92
|
+
end
|
93
|
+
|
94
|
+
def debug_format_dump # :nodoc:
|
95
|
+
warn('Document#debug_format_dump is deprecated. Use Document#to_s instead.')
|
96
|
+
self.to_s
|
97
|
+
end
|
64
98
|
end
|
65
99
|
end
|
66
100
|
end
|