libxml-ruby 3.2.4-x64-mingw-ucrt → 4.1.1-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,103 +0,0 @@
1
- /* Please see the LICENSE file for copyright and distribution information */
2
-
3
- #include "ruby_libxml.h"
4
- #include "ruby_xml_xpointer.h"
5
-
6
- #ifdef LIBXML_XPTR_ENABLED
7
- #include <libxml/xpointer.h>
8
- #endif
9
-
10
- VALUE cXMLXPointer;
11
-
12
- /*
13
- * Document-class: LibXML::XML::XPointer
14
- *
15
- * The XML::Pointer class provides a standards based API for searching an xml document.
16
- * XPointer is based on the XML Path Language (XML::XPath) and is documented
17
- * at http://www.w3.org/TR/WD-xptr.
18
- */
19
-
20
- static VALUE rxml_xpointer_point(VALUE class, VALUE rnode, VALUE xptr_str)
21
- {
22
- #ifdef LIBXML_XPTR_ENABLED
23
- xmlNodePtr xnode;
24
- xmlXPathContextPtr xctxt;
25
- xmlXPathObjectPtr xpop;
26
-
27
- VALUE context;
28
- VALUE result;
29
- VALUE argv[1];
30
-
31
- Check_Type(xptr_str, T_STRING);
32
- if (rb_obj_is_kind_of(rnode, cXMLNode) == Qfalse)
33
- rb_raise(rb_eTypeError, "require an XML::Node object");
34
-
35
- Data_Get_Struct(rnode, xmlNode, xnode);
36
-
37
- argv[0] = rb_funcall(rnode, rb_intern("doc"), 0);
38
- context = rb_class_new_instance(1, argv, cXMLXPathContext);
39
- Data_Get_Struct(context, xmlXPathContext, xctxt);
40
-
41
- xpop = xmlXPtrEval((xmlChar*)StringValuePtr(xptr_str), xctxt);
42
- if (!xpop)
43
- rxml_raise(&xmlLastError);
44
-
45
- result = rxml_xpath_object_wrap(xnode->doc, xpop);
46
- rb_iv_set(result, "@context", context);
47
-
48
- return(result);
49
- #else
50
- rb_warn("libxml was compiled without XPointer support");
51
- return (Qfalse);
52
- #endif
53
- }
54
-
55
- VALUE rxml_xpointer_point2(VALUE node, VALUE xptr_str)
56
- {
57
- return (rxml_xpointer_point(cXMLXPointer, node, xptr_str));
58
- }
59
-
60
- /*
61
- * call-seq:
62
- * XML::XPointer.range(start_node, end_node) -> xpath
63
- *
64
- * Create an xpath representing the range between the supplied
65
- * start and end node.
66
- */
67
- static VALUE rxml_xpointer_range(VALUE class, VALUE rstart, VALUE rend)
68
- {
69
- #if defined LIBXML_XPTR_ENABLED && defined LIBXML_XPTR_LOCS_ENABLED
70
- xmlNodePtr start, end;
71
- VALUE rxxp;
72
- xmlXPathObjectPtr xpath;
73
-
74
- if (rb_obj_is_kind_of(rstart, cXMLNode) == Qfalse)
75
- rb_raise(rb_eTypeError, "require an XML::Node object as a starting point");
76
- if (rb_obj_is_kind_of(rend, cXMLNode) == Qfalse)
77
- rb_raise(rb_eTypeError, "require an XML::Node object as an ending point");
78
-
79
- Data_Get_Struct(rstart, xmlNode, start);
80
- if (start == NULL)
81
- return(Qnil);
82
-
83
- Data_Get_Struct(rend, xmlNode, end);
84
- if (end == NULL)
85
- return(Qnil);
86
-
87
- xpath = xmlXPtrNewRangeNodes(start, end);
88
- if (xpath == NULL)
89
- rb_fatal("You shouldn't be able to have this happen");
90
-
91
- rxxp = rxml_xpath_object_wrap(start->doc, xpath);
92
- return(rxxp);
93
- #else
94
- rb_warn("libxml was compiled without XPointer support");
95
- return (Qfalse);
96
- #endif
97
- }
98
-
99
- void rxml_init_xpointer(void)
100
- {
101
- cXMLXPointer = rb_define_class_under(mXML, "XPointer", rb_cObject);
102
- rb_define_singleton_method(cXMLXPointer, "range", rxml_xpointer_range, 2);
103
- }
@@ -1,11 +0,0 @@
1
- /* Please see the LICENSE file for copyright and distribution information */
2
-
3
- #ifndef __RXML_XPOINTER__
4
- #define __RXML_XPOINTER__
5
-
6
- extern VALUE cXMLXPointer;
7
-
8
- void rxml_init_xpointer(void);
9
- VALUE rxml_xpointer_point2(VALUE node, VALUE xptr_str);
10
-
11
- #endif