libxml-ruby 0.9.8-x86-mswin32-60 → 0.9.9-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +41 -1
- data/LICENSE +3 -4
- data/README +37 -24
- data/Rakefile +2 -2
- data/ext/libxml/extconf.rb +31 -12
- data/ext/libxml/libxml.c +56 -858
- data/ext/libxml/ruby_libxml.h +93 -96
- data/ext/libxml/ruby_xml.c +855 -0
- data/ext/libxml/ruby_xml.h +9 -0
- data/ext/libxml/ruby_xml_attr.c +3 -9
- data/ext/libxml/ruby_xml_attr.h +2 -2
- data/ext/libxml/ruby_xml_attr_decl.c +2 -8
- data/ext/libxml/ruby_xml_attr_decl.h +1 -1
- data/ext/libxml/ruby_xml_attributes.c +6 -8
- data/ext/libxml/ruby_xml_attributes.h +1 -1
- data/ext/libxml/ruby_xml_document.c +915 -895
- data/ext/libxml/ruby_xml_document.h +2 -2
- data/ext/libxml/ruby_xml_dtd.c +257 -136
- data/ext/libxml/ruby_xml_dtd.h +1 -1
- data/ext/libxml/ruby_xml_encoding.c +55 -37
- data/ext/libxml/ruby_xml_encoding.h +1 -1
- data/ext/libxml/ruby_xml_error.c +526 -1058
- data/ext/libxml/ruby_xml_error.h +1 -1
- data/ext/libxml/ruby_xml_html_parser.c +2 -8
- data/ext/libxml/ruby_xml_html_parser.h +2 -2
- data/ext/libxml/ruby_xml_html_parser_context.c +175 -145
- data/ext/libxml/ruby_xml_html_parser_context.h +1 -1
- data/ext/libxml/ruby_xml_html_parser_options.c +12 -20
- data/ext/libxml/ruby_xml_html_parser_options.h +1 -1
- data/ext/libxml/ruby_xml_input_cbg.c +2 -8
- data/ext/libxml/ruby_xml_input_cbg.h +1 -1
- data/ext/libxml/ruby_xml_namespace.c +2 -8
- data/ext/libxml/ruby_xml_namespace.h +2 -2
- data/ext/libxml/ruby_xml_namespaces.c +1 -9
- data/ext/libxml/ruby_xml_namespaces.h +1 -1
- data/ext/libxml/ruby_xml_node.c +182 -121
- data/ext/libxml/ruby_xml_node.h +2 -2
- data/ext/libxml/ruby_xml_parser.c +2 -8
- data/ext/libxml/ruby_xml_parser.h +2 -2
- data/ext/libxml/ruby_xml_parser_context.c +952 -901
- data/ext/libxml/ruby_xml_parser_context.h +2 -2
- data/ext/libxml/ruby_xml_parser_options.c +2 -9
- data/ext/libxml/ruby_xml_parser_options.h +1 -1
- data/ext/libxml/ruby_xml_reader.c +1002 -993
- data/ext/libxml/ruby_xml_reader.h +1 -1
- data/ext/libxml/ruby_xml_relaxng.c +1 -7
- data/ext/libxml/ruby_xml_relaxng.h +1 -1
- data/ext/libxml/ruby_xml_sax2_handler.c +2 -2
- data/ext/libxml/ruby_xml_sax2_handler.h +1 -1
- data/ext/libxml/ruby_xml_sax_parser.c +2 -8
- data/ext/libxml/ruby_xml_sax_parser.h +2 -2
- data/ext/libxml/ruby_xml_schema.c +1 -7
- data/ext/libxml/ruby_xml_schema.h +1 -1
- data/ext/libxml/{version.h → ruby_xml_version.h} +2 -2
- data/ext/libxml/ruby_xml_xinclude.c +2 -8
- data/ext/libxml/ruby_xml_xinclude.h +2 -2
- data/ext/libxml/ruby_xml_xpath.c +17 -18
- data/ext/libxml/ruby_xml_xpath.h +2 -2
- data/ext/libxml/ruby_xml_xpath_context.c +387 -389
- data/ext/libxml/ruby_xml_xpath_context.h +2 -2
- data/ext/libxml/ruby_xml_xpath_expression.c +18 -8
- data/ext/libxml/ruby_xml_xpath_expression.h +1 -1
- data/ext/libxml/ruby_xml_xpath_object.c +19 -8
- data/ext/libxml/ruby_xml_xpath_object.h +1 -1
- data/ext/libxml/ruby_xml_xpointer.c +2 -8
- data/ext/libxml/ruby_xml_xpointer.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.sln +7 -1
- data/lib/libxml.rb +1 -12
- data/lib/libxml/attr.rb +0 -3
- data/lib/libxml/attr_decl.rb +0 -3
- data/lib/libxml/attributes.rb +0 -3
- data/lib/libxml/document.rb +31 -5
- data/lib/libxml/error.rb +8 -4
- data/lib/libxml/properties.rb +0 -5
- data/lib/libxml/sax_callbacks.rb +30 -19
- data/lib/libxml/tree.rb +0 -1
- data/lib/libxml/xpath_object.rb +0 -13
- data/test/model/definition.dtd +8 -0
- data/test/tc_attributes.rb +4 -1
- data/test/tc_document.rb +16 -0
- data/test/tc_dtd.rb +30 -2
- data/test/tc_html_parser.rb +55 -10
- data/test/tc_node.rb +67 -1
- data/test/tc_node_edit.rb +26 -6
- data/test/tc_node_text.rb +41 -23
- data/test/tc_parser.rb +50 -0
- data/test/tc_reader.rb +15 -0
- data/test/tc_relaxng.rb +1 -1
- data/test/tc_sax_parser.rb +37 -5
- data/test/tc_schema.rb +1 -1
- data/test/tc_xpath.rb +1 -0
- data/test/tc_xpath_expression.rb +4 -2
- metadata +6 -6
- data/ext/libxml/ruby_xml_state.c +0 -51
- data/ext/libxml/ruby_xml_state.h +0 -11
- data/ext/vc/libxml_ruby.vcproj +0 -460
data/CHANGES
CHANGED
@@ -1,3 +1,43 @@
|
|
1
|
+
== 0.9.9 / 2009-03-05 Charlie Savage
|
2
|
+
|
3
|
+
* Ruby 1.9.1 support (Charlie Savage). libxml-ruby now compiles and runs on either
|
4
|
+
1.8.6 and 1.9.1. With 1.8.6 all tests should pass while on 1.9.1 all but
|
5
|
+
for encoding tests pass. The port to Ruby 1.9.1 revealed two memory
|
6
|
+
allocation bugs (one with dtds, one with nodes) which are now fixed.
|
7
|
+
|
8
|
+
* Better OS X support (Joe Khoobyar). The default version of libxml2
|
9
|
+
on OS X 10.5 is fairly old, resulting in this link error:
|
10
|
+
|
11
|
+
NSLinkModule() error
|
12
|
+
dyld: Symbol not found: _htmlNewParserCtxt
|
13
|
+
|
14
|
+
This can be fixed by using MacPorts to get a newer version of libxml2.
|
15
|
+
To make use of MacPorts, the build script has been updated to use xml2-config.
|
16
|
+
This can be fine-tuned using the new --with-xml2-config / --without-xml2-config
|
17
|
+
options to extconf.rb (default is --without-xml2-config to match existing behavior).
|
18
|
+
|
19
|
+
* Greatly reduced memory usage (Joe Khoobyar).
|
20
|
+
See http://rubyforge.org/pipermail/libxml-devel/2009-February/001375.html.
|
21
|
+
|
22
|
+
* Add Document#xhtml? and document#node_type methods (Joe Khoobyar)
|
23
|
+
|
24
|
+
* Add XPath::Object#last (Joe Khoobyar)
|
25
|
+
|
26
|
+
* Provide finer control over CDATA nodes on a parser by parser basis (Joe Khoobyar).
|
27
|
+
|
28
|
+
* Bug fix - Namespaces were incorrectly merged with attributes in the new sax2
|
29
|
+
handler (Charlie Savage).
|
30
|
+
|
31
|
+
* Bug fix - Support iterating over nodes and attributes even with blocks
|
32
|
+
that call remove! (Charlie Savage)
|
33
|
+
|
34
|
+
* Bug fix - If reader.node is NULL, return nil instead of crashing (Charlie Savage)
|
35
|
+
|
36
|
+
* Bug fix - Dtd's owned by documents were freed twice in some circumstances (Joe Khoobyar).
|
37
|
+
|
38
|
+
* Bug fix - Fix output escaping on attributes nodes (Joe Khoobyar).
|
39
|
+
|
40
|
+
|
1
41
|
== 0.9.8 / 2009-1-24 Charlie Savage
|
2
42
|
|
3
43
|
* Refactored XML::Parser, XML::HTMLParser, XML::SaxParser and
|
@@ -10,7 +50,7 @@
|
|
10
50
|
boolean value.
|
11
51
|
|
12
52
|
* Updated all APIs to use the encoding constants defined
|
13
|
-
in XML::Encoding versus string
|
53
|
+
in XML::Encoding versus string values. This API change
|
14
54
|
is not backwards compatible.
|
15
55
|
|
16
56
|
* Added support for attribute declarations in DTD's via the new
|
data/LICENSE
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
Copyright (c) 2001 Wai-Sun "Squidster" Chia <waisun.chia@compaq.com>
|
1
|
+
Copyright (c) 2008-2009 Charlie Savage and contributors
|
2
|
+
Copyright (c) 2002-2007 Sean Chittenden and contributors
|
3
|
+
Copyright (c) 2001 Wai-Sun "Squidster" Chia
|
5
4
|
|
6
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
7
6
|
this software and associated documentation files (the "Software"), to deal in
|
data/README
CHANGED
@@ -43,28 +43,30 @@ solution. If you wish to run a debug version of libxml-ruby on
|
|
43
43
|
Windows, then it is highly recommended you use VC++.
|
44
44
|
|
45
45
|
== Getting Started
|
46
|
-
Using libxml is easy. First decide what parser you want to use
|
47
|
-
Generally you'll want to use the LibXML::XML::Parser which provides a tree based API.
|
48
|
-
For larger documents that don't fit into memory, or if you prefer an input based API,
|
49
|
-
then use LibXML::XML::Reader. If you are parsing HTML files, then use LibXML::XML::HTMLParser.
|
50
|
-
Finally, if you are masochistic, then use the LibXML::XML::SaxParser, which provides a callback API.
|
46
|
+
Using libxml is easy. First decide what parser you want to use:
|
51
47
|
|
52
|
-
|
53
|
-
|
54
|
-
|
48
|
+
* Generally you'll want to use the LibXML::XML::Parser which provides a tree based API.
|
49
|
+
* For larger documents that don't fit into memory, or if you prefer an input based API, use the LibXML::XML::Reader.
|
50
|
+
* To parse HTML files use LibXML::XML::HTMLParser.
|
51
|
+
* If you are masochistic, then use the LibXML::XML::SaxParser, which provides a callback API.
|
52
|
+
|
53
|
+
Once you have choosen a parser, choose a datasource. Libxml can parse files, strings, URIs
|
54
|
+
and IO streams. For each data source you can specify an LibXML::XML::Encoding, a base uri and
|
55
|
+
various parser options. For more information, refer the LibXML::XML::Parser.document,
|
56
|
+
LibXML::XML::Parser.file, LibXML::XML::Parser.io or LibXML:::XML::Parser.string methods (the
|
57
|
+
same methods are defined on all four parser classes).
|
55
58
|
|
56
59
|
== Advanced Functionality
|
57
60
|
Beyond the basics of parsing and processing XML and HTML documents,
|
58
|
-
|
61
|
+
libxml provides a wealth of additional functionality.
|
59
62
|
|
60
63
|
Most commonly, you'll want to use its LibXML::XML::XPath support, which makes
|
61
|
-
it easy to
|
62
|
-
|
63
|
-
an XML document.
|
64
|
+
it easy to find data inside a XML document. Although not as popular,
|
65
|
+
LibXML::XML::XPointer provides another API for finding data inside an XML document.
|
64
66
|
|
65
67
|
Often times you'll need to validate data before processing it. For example,
|
66
68
|
if you accept user generated content submitted over the Web, you'll
|
67
|
-
want to
|
69
|
+
want to verify that it does not contain malicious code such as embedded scripts.
|
68
70
|
This can be done using libxml's powerful set of validators:
|
69
71
|
|
70
72
|
* DTDs (LibXML::XML::Dtd)
|
@@ -72,7 +74,7 @@ This can be done using libxml's powerful set of validators:
|
|
72
74
|
* XML Schema (LibXML::XML::Schema)
|
73
75
|
|
74
76
|
Finally, if you'd like to use XSL Transformations to process data,
|
75
|
-
then
|
77
|
+
then install the libxslt gem which is available at
|
76
78
|
http://rubyforge.org/projects/libxsl/.
|
77
79
|
|
78
80
|
== Usage
|
@@ -94,8 +96,8 @@ namespace, in which case you can either write your code like this:
|
|
94
96
|
require 'libxml'
|
95
97
|
document = LibXML::XML::Document.new
|
96
98
|
|
97
|
-
|
98
|
-
|
99
|
+
Or you can utilize a namespace for you own work and include LibXML into it.
|
100
|
+
For example:
|
99
101
|
|
100
102
|
require 'libxml'
|
101
103
|
|
@@ -133,16 +135,27 @@ From https://svn.concord.org/svn/projects/trunk/common/ruby/xml_benchmarks/
|
|
133
135
|
rexml 22.859000 0.047000 22.906000 ( 23.203000)
|
134
136
|
|
135
137
|
|
136
|
-
==
|
137
|
-
|
138
|
+
== Documentation
|
139
|
+
Documentation is provided via rdoc. To generate the documentation,
|
140
|
+
run the the command 'rake doc'. libxml-ruby's online documentation
|
141
|
+
is generated using Hanna. To use hanna:
|
138
142
|
|
139
|
-
|
140
|
-
|
143
|
+
gem install mislav-hanna
|
144
|
+
rake rdoc RDOCOPT="-S -T hanna"
|
141
145
|
|
142
|
-
|
146
|
+
Note that older versions of Rdoc, which ship with Ruby 1.8.x, will report
|
147
|
+
a number of errors. To avoid them, install Rdoc 2.1 or higher from
|
148
|
+
RubyForge (http://rdoc.rubyforge.org/). Once you have installed the gem,
|
149
|
+
you'll have to disable the version of Rdoc that Ruby 1.8.x includes. An
|
150
|
+
easy way to do that is rename the directory uby/lib/ruby/1.8/rdoc to
|
151
|
+
ruby/lib/ruby/1.8/rdoc_old.
|
143
152
|
|
144
|
-
|
153
|
+
== Support
|
145
154
|
|
146
|
-
|
147
|
-
|
155
|
+
If you have any questions about using libxml-ruby, please send them to
|
156
|
+
libxml-devel@rubyforge.org. If you have found any bugs in libxml-devel,
|
157
|
+
or have developed new patches, please submit them to Ruby Forge at
|
158
|
+
http://rubyforge.org/tracker/?group_id=494.
|
148
159
|
|
160
|
+
== License
|
161
|
+
See LICENSE for license information.
|
data/Rakefile
CHANGED
@@ -43,7 +43,7 @@ default_spec = Gem::Specification.new do |spec|
|
|
43
43
|
|
44
44
|
# Determine the current version of the software
|
45
45
|
spec.version =
|
46
|
-
if File.read('ext/libxml/
|
46
|
+
if File.read('ext/libxml/ruby_xml_version.h') =~ /\s*RUBY_LIBXML_VERSION\s*['"](\d.+)['"]/
|
47
47
|
CURRENT_VERSION = $1
|
48
48
|
else
|
49
49
|
CURRENT_VERSION = "0.0.0"
|
@@ -96,7 +96,7 @@ Rake::RDocTask.new("rdoc") do |rdoc|
|
|
96
96
|
rdoc.rdoc_dir = 'doc/rdoc'
|
97
97
|
rdoc.title = "LibXML"
|
98
98
|
# Show source inline with line numbers
|
99
|
-
rdoc.options << "--
|
99
|
+
rdoc.options << "--line-numbers"
|
100
100
|
# Make the readme file the start page for the generated html
|
101
101
|
rdoc.options << '--main' << 'README'
|
102
102
|
rdoc.rdoc_files.include('doc/*.rdoc',
|
data/ext/libxml/extconf.rb
CHANGED
@@ -31,7 +31,6 @@ def crash(str)
|
|
31
31
|
end
|
32
32
|
|
33
33
|
dir_config('iconv')
|
34
|
-
dir_config('xml2')
|
35
34
|
dir_config('zlib')
|
36
35
|
|
37
36
|
have_library('socket','socket')
|
@@ -74,21 +73,41 @@ to extconf.rb:
|
|
74
73
|
EOL
|
75
74
|
end
|
76
75
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
76
|
+
if (xc = with_config('xml2-config')) or RUBY_PLATFORM.match(/darwin/i) then
|
77
|
+
xc = 'xml2-config' if xc == true or xc.nil?
|
78
|
+
cflags = `#{xc} --cflags`.chomp
|
79
|
+
if $? != 0
|
80
|
+
cflags = nil
|
81
|
+
else
|
82
|
+
libs = `#{xc} --libs`.chomp
|
83
|
+
if $? != 0
|
84
|
+
libs = nil
|
85
|
+
else
|
86
|
+
$CFLAGS += ' ' + cflags
|
87
|
+
$libs = libs + " " + $libs
|
88
|
+
end
|
89
|
+
end
|
90
|
+
else
|
91
|
+
dir_config('xml2')
|
92
|
+
end
|
93
|
+
|
94
|
+
unless (cflags and libs) or
|
95
|
+
(have_library('xml2', 'xmlParseDoc') or
|
96
|
+
have_library('libxml2', 'xmlParseDoc') or
|
97
|
+
find_library('xml2', 'xmlParseDoc', '/opt/lib', '/usr/local/lib', '/usr/lib')) and
|
98
|
+
(have_header('libxml/xmlversion.h') or
|
99
|
+
find_header('libxml/xmlversion.h',
|
100
|
+
"#{CONFIG['prefix']}/include",
|
101
|
+
"#{CONFIG['prefix']}/include/libxml2",
|
102
|
+
'/opt/include/libxml2',
|
103
|
+
'/usr/local/include/libxml2',
|
104
|
+
'/usr/include/libxml2'))
|
105
|
+
crash(<<EOL)
|
88
106
|
need libxml2.
|
89
107
|
|
90
108
|
Install the library or try one of the following options to extconf.rb:
|
91
109
|
|
110
|
+
--with-xml2-config=/path/to/xml2-config
|
92
111
|
--with-xml2-dir=/path/to/libxml2
|
93
112
|
--with-xml2-lib=/path/to/libxml2/lib
|
94
113
|
--with-xml2-include=/path/to/libxml2/include
|
data/ext/libxml/libxml.c
CHANGED
@@ -1,878 +1,76 @@
|
|
1
|
-
/* $Id: libxml.c 756 2009-01-24 22:56:05Z cfis $ */
|
2
|
-
|
3
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
4
|
-
|
5
1
|
#include "ruby_libxml.h"
|
6
2
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
/*
|
11
|
-
* call-seq:
|
12
|
-
* XML.catalog_dump -> true
|
13
|
-
*
|
14
|
-
* Dump all the global catalog content stdout.
|
15
|
-
*/
|
16
|
-
static VALUE rxml_catalog_dump(VALUE self)
|
17
|
-
{
|
18
|
-
xmlCatalogDump(stdout);
|
19
|
-
return (Qtrue);
|
20
|
-
}
|
21
|
-
|
22
|
-
/*
|
23
|
-
* call-seq:
|
24
|
-
* XML.catalog_remove(catalog) -> true
|
25
|
-
*
|
26
|
-
* Remove the specified resource catalog.
|
27
|
-
*/
|
28
|
-
static VALUE rxml_catalog_remove(VALUE self, VALUE cat)
|
29
|
-
{
|
30
|
-
Check_Type(cat, T_STRING);
|
31
|
-
xmlCatalogRemove((xmlChar *) StringValuePtr(cat));
|
32
|
-
return (Qtrue);
|
33
|
-
}
|
34
|
-
|
35
|
-
/*
|
36
|
-
* call-seq:
|
37
|
-
* XML.check_lib_versions -> true
|
38
|
-
*
|
39
|
-
* Check LIBXML version matches version the bindings
|
40
|
-
* were compiled to. Throws an exception if not.
|
41
|
-
*/
|
42
|
-
static VALUE rxml_check_lib_versions(VALUE class)
|
43
|
-
{
|
44
|
-
xmlCheckVersion(LIBXML_VERSION);
|
45
|
-
return (Qtrue);
|
46
|
-
}
|
47
|
-
|
48
|
-
/*
|
49
|
-
* call-seq:
|
50
|
-
* XML.enabled_automata? -> (true|false)
|
51
|
-
*
|
52
|
-
* Determine whether libxml regexp automata support is enabled.
|
53
|
-
*/
|
54
|
-
static VALUE rxml_enabled_automata_q(VALUE class)
|
55
|
-
{
|
56
|
-
#ifdef LIBXML_AUTOMATA_ENABLED
|
57
|
-
return(Qtrue);
|
58
|
-
#else
|
59
|
-
return (Qfalse);
|
60
|
-
#endif
|
61
|
-
}
|
62
|
-
|
63
|
-
/*
|
64
|
-
* call-seq:
|
65
|
-
* XML.enabled_c14n? -> (true|false)
|
66
|
-
*
|
67
|
-
* Determine whether libxml 'canonical XML' support is enabled.
|
68
|
-
* See "Canonical XML" (http://www.w3.org/TR/xml-c14n)
|
69
|
-
*/
|
70
|
-
static VALUE rxml_enabled_c14n_q(VALUE class)
|
71
|
-
{
|
72
|
-
#ifdef LIBXML_C14N_ENABLED
|
73
|
-
return(Qtrue);
|
74
|
-
#else
|
75
|
-
return (Qfalse);
|
76
|
-
#endif
|
77
|
-
}
|
78
|
-
|
79
|
-
/*
|
80
|
-
* call-seq:
|
81
|
-
* XML.enabled_catalog? -> (true|false)
|
82
|
-
*
|
83
|
-
* Determine whether libxml resource catalog support is enabled.
|
84
|
-
*/
|
85
|
-
static VALUE rxml_enabled_catalog_q(VALUE class)
|
86
|
-
{
|
87
|
-
#ifdef LIBXML_CATALOG_ENABLED
|
88
|
-
return(Qtrue);
|
89
|
-
#else
|
90
|
-
return (Qfalse);
|
91
|
-
#endif
|
92
|
-
}
|
93
|
-
|
94
|
-
/*
|
95
|
-
* call-seq:
|
96
|
-
* XML.enabled_debug? -> (true|false)
|
97
|
-
*
|
98
|
-
* Determine whether libxml debugging support is enabled.
|
99
|
-
*/
|
100
|
-
static VALUE rxml_enabled_debug_q(VALUE class)
|
101
|
-
{
|
102
|
-
#ifdef LIBXML_DEBUG_ENABLED
|
103
|
-
return(Qtrue);
|
104
|
-
#else
|
105
|
-
return (Qfalse);
|
106
|
-
#endif
|
107
|
-
}
|
108
|
-
|
109
|
-
/*
|
110
|
-
* call-seq:
|
111
|
-
* XML.enabled_docbook? -> (true|false)
|
112
|
-
*
|
113
|
-
* Determine whether libxml docbook support is enabled.
|
114
|
-
*/
|
115
|
-
static VALUE rxml_enabled_docbook_q(VALUE class)
|
116
|
-
{
|
117
|
-
#ifdef LIBXML_DOCB_ENABLED
|
118
|
-
return(Qtrue);
|
119
|
-
#else
|
120
|
-
return (Qfalse);
|
121
|
-
#endif
|
122
|
-
}
|
123
|
-
|
124
|
-
/*
|
125
|
-
* call-seq:
|
126
|
-
* XML.enabled_ftp? -> (true|false)
|
127
|
-
*
|
128
|
-
* Determine whether libxml ftp client support is enabled.
|
129
|
-
*/
|
130
|
-
static VALUE rxml_enabled_ftp_q(VALUE class)
|
131
|
-
{
|
132
|
-
#ifdef LIBXML_FTP_ENABLED
|
133
|
-
return(Qtrue);
|
134
|
-
#else
|
135
|
-
return (Qfalse);
|
136
|
-
#endif
|
137
|
-
}
|
138
|
-
|
139
|
-
/*
|
140
|
-
* call-seq:
|
141
|
-
* XML.enabled_http? -> (true|false)
|
142
|
-
*
|
143
|
-
* Determine whether libxml http client support is enabled.
|
144
|
-
*/
|
145
|
-
static VALUE rxml_enabled_http_q(VALUE class)
|
146
|
-
{
|
147
|
-
#ifdef LIBXML_HTTP_ENABLED
|
148
|
-
return(Qtrue);
|
3
|
+
#if RUBY_INTERN_H
|
4
|
+
#include <ruby/util.h>
|
149
5
|
#else
|
150
|
-
|
6
|
+
#include <util.h>
|
151
7
|
#endif
|
152
|
-
}
|
153
|
-
|
154
|
-
/*
|
155
|
-
* call-seq:
|
156
|
-
* XML.enabled_html? -> (true|false)
|
157
|
-
*
|
158
|
-
* Determine whether libxml html support is enabled.
|
159
|
-
*/
|
160
|
-
static VALUE rxml_enabled_html_q(VALUE class)
|
161
|
-
{
|
162
|
-
#ifdef LIBXML_HTML_ENABLED
|
163
|
-
return(Qtrue);
|
164
|
-
#else
|
165
|
-
return (Qfalse);
|
166
|
-
#endif
|
167
|
-
}
|
168
8
|
|
169
|
-
|
170
|
-
* call-seq:
|
171
|
-
* XML.enabled_iconv? -> (true|false)
|
172
|
-
*
|
173
|
-
* Determine whether libxml iconv support is enabled.
|
174
|
-
*/
|
175
|
-
static VALUE rxml_enabled_iconv_q(VALUE class)
|
176
|
-
{
|
177
|
-
#ifdef LIBXML_ICONV_ENABLED
|
178
|
-
return(Qtrue);
|
179
|
-
#else
|
180
|
-
return (Qfalse);
|
181
|
-
#endif
|
182
|
-
}
|
183
|
-
|
184
|
-
/*
|
185
|
-
* call-seq:
|
186
|
-
* XML.enabled_memory_debug? -> (true|false)
|
187
|
-
*
|
188
|
-
* Determine whether libxml memory location debugging support
|
189
|
-
* is enabled.
|
190
|
-
*/
|
191
|
-
static VALUE rxml_enabled_memory_debug_location_q(VALUE class)
|
192
|
-
{
|
193
|
-
#ifdef DEBUG_MEMORY_LOCATION
|
194
|
-
return(Qtrue);
|
195
|
-
#else
|
196
|
-
return (Qfalse);
|
197
|
-
#endif
|
198
|
-
}
|
199
|
-
|
200
|
-
/*
|
201
|
-
* call-seq:
|
202
|
-
* XML.enabled_regexp? -> (true|false)
|
203
|
-
*
|
204
|
-
* Determine whether libxml regular expression support is enabled.
|
205
|
-
*/
|
206
|
-
static VALUE rxml_enabled_regexp_q(VALUE class)
|
207
|
-
{
|
208
|
-
#ifdef LIBXML_REGEXP_ENABLED
|
209
|
-
return(Qtrue);
|
210
|
-
#else
|
211
|
-
return (Qfalse);
|
212
|
-
#endif
|
213
|
-
}
|
214
|
-
|
215
|
-
/*
|
216
|
-
* call-seq:
|
217
|
-
* XML.enabled_schemas? -> (true|false)
|
218
|
-
*
|
219
|
-
* Determine whether libxml schema support is enabled.
|
220
|
-
*/
|
221
|
-
static VALUE rxml_enabled_schemas_q(VALUE class)
|
222
|
-
{
|
223
|
-
#ifdef LIBXML_SCHEMAS_ENABLED
|
224
|
-
return(Qtrue);
|
225
|
-
#else
|
226
|
-
return (Qfalse);
|
227
|
-
#endif
|
228
|
-
}
|
229
|
-
|
230
|
-
/*
|
231
|
-
* call-seq:
|
232
|
-
* XML.enabled_thread? -> (true|false)
|
233
|
-
*
|
234
|
-
* Determine whether libxml thread-safe semantics support
|
235
|
-
* is enabled (I think?).
|
236
|
-
*/
|
237
|
-
static VALUE rxml_enabled_thread_q(VALUE class)
|
238
|
-
{
|
239
|
-
#ifdef LIBXML_THREAD_ENABLED
|
240
|
-
return(Qtrue);
|
241
|
-
#else
|
242
|
-
return (Qfalse);
|
243
|
-
#endif
|
244
|
-
}
|
245
|
-
|
246
|
-
/*
|
247
|
-
* call-seq:
|
248
|
-
* XML.enabled_unicode? -> (true|false)
|
249
|
-
*
|
250
|
-
* Determine whether libxml unicode support is enabled.
|
251
|
-
*/
|
252
|
-
static VALUE rxml_enabled_unicode_q(VALUE class)
|
253
|
-
{
|
254
|
-
#ifdef LIBXML_UNICODE_ENABLED
|
255
|
-
return(Qtrue);
|
256
|
-
#else
|
257
|
-
return (Qfalse);
|
258
|
-
#endif
|
259
|
-
}
|
260
|
-
|
261
|
-
/*
|
262
|
-
* call-seq:
|
263
|
-
* XML.enabled_xinclude? -> (true|false)
|
264
|
-
*
|
265
|
-
* Determine whether libxml xinclude support is enabled.
|
266
|
-
*/
|
267
|
-
static VALUE rxml_enabled_xinclude_q(VALUE class)
|
268
|
-
{
|
269
|
-
#ifdef LIBXML_XINCLUDE_ENABLED
|
270
|
-
return(Qtrue);
|
271
|
-
#else
|
272
|
-
return (Qfalse);
|
273
|
-
#endif
|
274
|
-
}
|
275
|
-
|
276
|
-
/*
|
277
|
-
* call-seq:
|
278
|
-
* XML.enabled_xpath? -> (true|false)
|
279
|
-
*
|
280
|
-
* Determine whether libxml xpath support is enabled.
|
281
|
-
*/
|
282
|
-
static VALUE rxml_enabled_xpath_q(VALUE class)
|
283
|
-
{
|
284
|
-
#ifdef LIBXML_XPATH_ENABLED
|
285
|
-
return(Qtrue);
|
286
|
-
#else
|
287
|
-
return (Qfalse);
|
288
|
-
#endif
|
289
|
-
}
|
290
|
-
|
291
|
-
/*
|
292
|
-
* call-seq:
|
293
|
-
* XML.enabled_xpointer? -> (true|false)
|
294
|
-
*
|
295
|
-
* Determine whether libxml xpointer support is enabled.
|
296
|
-
*/
|
297
|
-
static VALUE rxml_enabled_xpointer_q(VALUE class)
|
298
|
-
{
|
299
|
-
#ifdef LIBXML_XPTR_ENABLED
|
300
|
-
return(Qtrue);
|
301
|
-
#else
|
302
|
-
return (Qfalse);
|
303
|
-
#endif
|
304
|
-
}
|
305
|
-
|
306
|
-
/*
|
307
|
-
* call-seq:
|
308
|
-
* XML.enabled_zlib? -> (true|false)
|
309
|
-
*
|
310
|
-
* Determine whether libxml zlib support is enabled.
|
311
|
-
*/
|
312
|
-
static VALUE rxml_enabled_zlib_q(VALUE class)
|
313
|
-
{
|
314
|
-
#ifdef HAVE_ZLIB_H
|
315
|
-
return(Qtrue);
|
316
|
-
#else
|
317
|
-
return (Qfalse);
|
318
|
-
#endif
|
319
|
-
}
|
320
|
-
|
321
|
-
/*
|
322
|
-
* call-seq:
|
323
|
-
* XML.debug_entities -> (true|false)
|
324
|
-
*
|
325
|
-
* Determine whether included-entity debugging is enabled.
|
326
|
-
* (Requires Libxml to be compiled with debugging support)
|
327
|
-
*/
|
328
|
-
static VALUE rxml_debug_entities_get(VALUE class)
|
329
|
-
{
|
330
|
-
#ifdef LIBXML_DEBUG_ENABLED
|
331
|
-
if (xmlParserDebugEntities)
|
332
|
-
return(Qtrue);
|
333
|
-
else
|
334
|
-
return(Qfalse);
|
335
|
-
#else
|
336
|
-
rb_warn("libxml was compiled with debugging turned off");
|
337
|
-
return (Qfalse);
|
338
|
-
#endif
|
339
|
-
}
|
340
|
-
|
341
|
-
/*
|
342
|
-
* call-seq:
|
343
|
-
* XML.debug_entities = true|false
|
344
|
-
*
|
345
|
-
* Enable or disable included-entity debugging.
|
346
|
-
* (Requires Libxml to be compiled with debugging support)
|
347
|
-
*/
|
348
|
-
static VALUE rxml_debug_entities_set(VALUE class, VALUE bool)
|
349
|
-
{
|
350
|
-
#ifdef LIBXML_DEBUG_ENABLED
|
351
|
-
if (TYPE(bool) == T_FALSE)
|
352
|
-
{
|
353
|
-
xmlParserDebugEntities = 0;
|
354
|
-
return(Qfalse);
|
355
|
-
}
|
356
|
-
else
|
357
|
-
{
|
358
|
-
xmlParserDebugEntities = 1;
|
359
|
-
return(Qtrue);
|
360
|
-
}
|
361
|
-
#else
|
362
|
-
rb_warn("libxml was compiled with debugging turned off");
|
363
|
-
#endif
|
364
|
-
}
|
365
|
-
|
366
|
-
/*
|
367
|
-
* call-seq:
|
368
|
-
* XML.default_keep_blanks -> (true|false)
|
369
|
-
*
|
370
|
-
* Determine whether parsers retain whitespace by default.
|
371
|
-
*/
|
372
|
-
static VALUE rxml_default_keep_blanks_get(VALUE class)
|
373
|
-
{
|
374
|
-
if (xmlKeepBlanksDefaultValue)
|
375
|
-
return (Qtrue);
|
376
|
-
else
|
377
|
-
return (Qfalse);
|
378
|
-
}
|
379
|
-
|
380
|
-
/*
|
381
|
-
* call-seq:
|
382
|
-
* XML.default_keep_blanks = true|false
|
383
|
-
*
|
384
|
-
* Controls whether parsers retain whitespace by default.
|
385
|
-
*/
|
386
|
-
static VALUE rxml_default_keep_blanks_set(VALUE class, VALUE bool)
|
387
|
-
{
|
388
|
-
if (TYPE(bool) == T_FALSE)
|
389
|
-
{
|
390
|
-
xmlKeepBlanksDefaultValue = 0;
|
391
|
-
return (Qfalse);
|
392
|
-
}
|
393
|
-
else if (TYPE(bool) == T_TRUE)
|
394
|
-
{
|
395
|
-
xmlKeepBlanksDefaultValue = 1;
|
396
|
-
return (Qtrue);
|
397
|
-
}
|
398
|
-
else
|
399
|
-
{
|
400
|
-
rb_raise(rb_eArgError, "Invalid argument, must be a boolean");
|
401
|
-
}
|
402
|
-
}
|
403
|
-
|
404
|
-
/*
|
405
|
-
* call-seq:
|
406
|
-
* XML.default_load_external_dtd -> (true|false)
|
407
|
-
*
|
408
|
-
* Determine whether parsers load external DTDs by default.
|
409
|
-
*/
|
410
|
-
static VALUE rxml_default_load_external_dtd_get(VALUE class)
|
411
|
-
{
|
412
|
-
if (xmlLoadExtDtdDefaultValue)
|
413
|
-
return (Qtrue);
|
414
|
-
else
|
415
|
-
return (Qfalse);
|
416
|
-
}
|
417
|
-
|
418
|
-
/*
|
419
|
-
* call-seq:
|
420
|
-
* XML.default_load_external_dtd = true|false
|
421
|
-
*
|
422
|
-
* Controls whether parsers load external DTDs by default.
|
423
|
-
*/
|
424
|
-
static VALUE rxml_default_load_external_dtd_set(VALUE class, VALUE bool)
|
425
|
-
{
|
426
|
-
if (bool == Qfalse)
|
427
|
-
{
|
428
|
-
xmlLoadExtDtdDefaultValue = 0;
|
429
|
-
return (Qfalse);
|
430
|
-
}
|
431
|
-
else
|
432
|
-
{
|
433
|
-
xmlLoadExtDtdDefaultValue = 1;
|
434
|
-
return (Qtrue);
|
435
|
-
}
|
436
|
-
}
|
437
|
-
|
438
|
-
/*
|
439
|
-
* call-seq:
|
440
|
-
* XML.default_line_numbers -> (true|false)
|
441
|
-
*
|
442
|
-
* Determine whether parsers retain line-numbers by default.
|
443
|
-
*/
|
444
|
-
static VALUE rxml_default_line_numbers_get(VALUE class)
|
445
|
-
{
|
446
|
-
if (xmlLineNumbersDefaultValue)
|
447
|
-
return (Qtrue);
|
448
|
-
else
|
449
|
-
return (Qfalse);
|
450
|
-
}
|
451
|
-
|
452
|
-
/*
|
453
|
-
* call-seq:
|
454
|
-
* XML.default_line_numbers = true|false
|
455
|
-
*
|
456
|
-
* Controls whether parsers retain line-numbers by default.
|
457
|
-
*/
|
458
|
-
static VALUE rxml_default_line_numbers_set(VALUE class, VALUE bool)
|
459
|
-
{
|
460
|
-
if (TYPE(bool) == T_FALSE)
|
461
|
-
{
|
462
|
-
xmlLineNumbersDefault(0);
|
463
|
-
return (Qfalse);
|
464
|
-
}
|
465
|
-
else
|
466
|
-
{
|
467
|
-
xmlLineNumbersDefault(1);
|
468
|
-
return (Qtrue);
|
469
|
-
}
|
470
|
-
}
|
471
|
-
|
472
|
-
/*
|
473
|
-
* call-seq:
|
474
|
-
* XML.default_pedantic_parser -> (true|false)
|
475
|
-
*
|
476
|
-
* Determine whether parsers are pedantic by default.
|
477
|
-
*/
|
478
|
-
static VALUE rxml_default_pedantic_parser_get(VALUE class)
|
479
|
-
{
|
480
|
-
if (xmlPedanticParserDefaultValue)
|
481
|
-
return (Qtrue);
|
482
|
-
else
|
483
|
-
return (Qfalse);
|
484
|
-
}
|
485
|
-
|
486
|
-
/*
|
487
|
-
* call-seq:
|
488
|
-
* XML.default_pedantic_parser = true|false
|
489
|
-
*
|
490
|
-
* Controls whether parsers are pedantic by default.
|
491
|
-
*/
|
492
|
-
static VALUE rxml_default_pedantic_parser_set(VALUE class, VALUE bool)
|
493
|
-
{
|
494
|
-
if (TYPE(bool) == T_FALSE)
|
495
|
-
{
|
496
|
-
xmlPedanticParserDefault(0);
|
497
|
-
return (Qfalse);
|
498
|
-
}
|
499
|
-
else
|
500
|
-
{
|
501
|
-
xmlPedanticParserDefault(1);
|
502
|
-
return (Qtrue);
|
503
|
-
}
|
504
|
-
}
|
505
|
-
|
506
|
-
/*
|
507
|
-
* call-seq:
|
508
|
-
* XML.default_substitute_entities -> (true|false)
|
509
|
-
*
|
510
|
-
* Determine whether parsers perform inline entity substitution
|
511
|
-
* (for external entities) by default.
|
512
|
-
*/
|
513
|
-
static VALUE rxml_default_substitute_entities_get(VALUE class)
|
514
|
-
{
|
515
|
-
if (xmlSubstituteEntitiesDefaultValue)
|
516
|
-
return (Qtrue);
|
517
|
-
else
|
518
|
-
return (Qfalse);
|
519
|
-
}
|
520
|
-
|
521
|
-
/*
|
522
|
-
* call-seq:
|
523
|
-
* XML.default_substitute_entities = true|false
|
524
|
-
*
|
525
|
-
* Controls whether parsers perform inline entity substitution
|
526
|
-
* (for external entities) by default.
|
527
|
-
*/
|
528
|
-
static VALUE rxml_default_substitute_entities_set(VALUE class, VALUE bool)
|
529
|
-
{
|
530
|
-
if (bool == Qfalse)
|
531
|
-
{
|
532
|
-
xmlSubstituteEntitiesDefault(0);
|
533
|
-
return (Qfalse);
|
534
|
-
}
|
535
|
-
else
|
536
|
-
{
|
537
|
-
xmlSubstituteEntitiesDefault(1);
|
538
|
-
return (Qtrue);
|
539
|
-
}
|
540
|
-
}
|
541
|
-
|
542
|
-
/*
|
543
|
-
* call-seq:
|
544
|
-
* XML.default_tree_indent_string -> "string"
|
545
|
-
*
|
546
|
-
* Obtain the default string used by parsers to indent the XML tree
|
547
|
-
* for output.
|
548
|
-
*/
|
549
|
-
static VALUE rxml_default_tree_indent_string_get(VALUE class)
|
550
|
-
{
|
551
|
-
if (xmlTreeIndentString == NULL)
|
552
|
-
return (Qnil);
|
553
|
-
else
|
554
|
-
return (rb_str_new2(xmlTreeIndentString));
|
555
|
-
}
|
556
|
-
|
557
|
-
/*
|
558
|
-
* call-seq:
|
559
|
-
* XML.default_tree_indent_string = "string"
|
560
|
-
*
|
561
|
-
* Set the default string used by parsers to indent the XML tree
|
562
|
-
* for output.
|
563
|
-
*/
|
564
|
-
static VALUE rxml_default_tree_indent_string_set(VALUE class, VALUE string)
|
565
|
-
{
|
566
|
-
Check_Type(string, T_STRING);
|
567
|
-
xmlTreeIndentString = xmlStrdup((xmlChar *)StringValuePtr(string));
|
568
|
-
return (string);
|
569
|
-
}
|
570
|
-
|
571
|
-
/*
|
572
|
-
* call-seq:
|
573
|
-
* XML.default_validity_checking -> (true|false)
|
574
|
-
*
|
575
|
-
* Determine whether parsers perform XML validation by default.
|
576
|
-
*/
|
577
|
-
static VALUE rxml_default_validity_checking_get(VALUE class)
|
578
|
-
{
|
579
|
-
if (xmlDoValidityCheckingDefaultValue)
|
580
|
-
return (Qtrue);
|
581
|
-
else
|
582
|
-
return (Qfalse);
|
583
|
-
}
|
584
|
-
|
585
|
-
/*
|
586
|
-
* call-seq:
|
587
|
-
* XML.default_validity_checking = true|false
|
588
|
-
*
|
589
|
-
* Controls whether parsers perform XML validation by default.
|
590
|
-
*/
|
591
|
-
static VALUE rxml_default_validity_checking_set(VALUE class, VALUE bool)
|
592
|
-
{
|
593
|
-
if (TYPE(bool) == T_FALSE)
|
594
|
-
{
|
595
|
-
xmlDoValidityCheckingDefaultValue = 0;
|
596
|
-
return (Qfalse);
|
597
|
-
}
|
598
|
-
else
|
599
|
-
{
|
600
|
-
xmlDoValidityCheckingDefaultValue = 1;
|
601
|
-
return (Qtrue);
|
602
|
-
}
|
603
|
-
}
|
604
|
-
|
605
|
-
/*
|
606
|
-
* call-seq:
|
607
|
-
* XML.default_warnings -> (true|false)
|
608
|
-
*
|
609
|
-
* Determine whether parsers output warnings by default.
|
610
|
-
*/
|
611
|
-
static VALUE rxml_default_warnings_get(VALUE class)
|
612
|
-
{
|
613
|
-
if (xmlGetWarningsDefaultValue)
|
614
|
-
return (Qtrue);
|
615
|
-
else
|
616
|
-
return (Qfalse);
|
617
|
-
}
|
618
|
-
|
619
|
-
/*
|
620
|
-
* call-seq:
|
621
|
-
* XML.default_warnings = true|false
|
622
|
-
*
|
623
|
-
* Controls whether parsers output warnings by default.
|
624
|
-
*/
|
625
|
-
static VALUE rxml_default_warnings_set(VALUE class, VALUE bool)
|
626
|
-
{
|
627
|
-
if (TYPE(bool) == T_FALSE)
|
628
|
-
{
|
629
|
-
xmlGetWarningsDefaultValue = 0;
|
630
|
-
return (Qfalse);
|
631
|
-
}
|
632
|
-
else
|
633
|
-
{
|
634
|
-
xmlGetWarningsDefaultValue = 1;
|
635
|
-
return (Qtrue);
|
636
|
-
}
|
637
|
-
}
|
9
|
+
VALUE mLibXML;
|
638
10
|
|
639
|
-
|
640
|
-
* call-seq:
|
641
|
-
* XML.default_compression -> (true|false)
|
642
|
-
*
|
643
|
-
* Determine whether parsers use Zlib compression by default
|
644
|
-
* (requires libxml to be compiled with Zlib support).
|
645
|
-
*/
|
646
|
-
static VALUE rxml_default_compression_get(VALUE class)
|
11
|
+
static void rxml_init_memory(void)
|
647
12
|
{
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
13
|
+
xmlGcMemSetup(
|
14
|
+
(xmlFreeFunc)ruby_xfree,
|
15
|
+
(xmlMallocFunc)ruby_xmalloc,
|
16
|
+
(xmlMallocFunc)ruby_xmalloc,
|
17
|
+
(xmlReallocFunc)ruby_xrealloc,
|
18
|
+
(xmlStrdupFunc)ruby_strdup
|
19
|
+
);
|
654
20
|
}
|
655
21
|
|
656
|
-
|
657
|
-
|
658
|
-
* XML.default_compression = true|false
|
659
|
-
*
|
660
|
-
* Controls whether parsers use Zlib compression by default
|
661
|
-
* (requires libxml to be compiled with Zlib support).
|
662
|
-
*/
|
663
|
-
static VALUE rxml_default_compression_set(VALUE class, VALUE num)
|
664
|
-
{
|
665
|
-
#ifdef HAVE_ZLIB_H
|
666
|
-
Check_Type(num, T_FIXNUM);
|
667
|
-
xmlSetCompressMode(FIX2INT(num));
|
668
|
-
return(num);
|
669
|
-
#else
|
670
|
-
rb_warn("libxml was compiled without zlib support");
|
671
|
-
return (Qfalse);
|
22
|
+
#if defined(_WIN32)
|
23
|
+
__declspec(dllexport)
|
672
24
|
#endif
|
673
|
-
|
674
|
-
|
675
|
-
/*
|
676
|
-
* call-seq:
|
677
|
-
* XML.features -> ["feature", ..., "feature"]
|
678
|
-
*
|
679
|
-
* Obtains an array of strings representing features supported
|
680
|
-
* (and enabled) by the installed libxml.
|
681
|
-
*/
|
682
|
-
static VALUE rxml_features(VALUE class)
|
25
|
+
void Init_libxml_ruby(void)
|
683
26
|
{
|
684
|
-
|
685
|
-
|
686
|
-
char **list = NULL;
|
687
|
-
|
688
|
-
list = ALLOC_N(char *,MAX_LIBXML_FEATURES_LEN);
|
689
|
-
MEMZERO(list, char *, MAX_LIBXML_FEATURES_LEN);
|
690
|
-
|
691
|
-
arr = rb_ary_new();
|
692
|
-
if (xmlGetFeaturesList(&len, (const char **) list) == -1)
|
693
|
-
return Qnil;
|
694
|
-
|
695
|
-
for (i = 0; i < len; i++)
|
696
|
-
{
|
697
|
-
str = rb_str_new2((const char *) list[i]);
|
698
|
-
rb_gc_unregister_address(&str);
|
699
|
-
rb_ary_push(arr, str);
|
700
|
-
}
|
701
|
-
|
702
|
-
if (len == MAX_LIBXML_FEATURES_LEN)
|
703
|
-
rb_warn(
|
704
|
-
"Please contact libxml-devel@rubyforge.org and ask to have the \"MAX_LIBXML_FEATURES_LEN increased\" because you could possibly be seeing an incomplete list");
|
705
|
-
|
706
|
-
ruby_xfree(list);
|
707
|
-
return (arr);
|
708
|
-
}
|
709
|
-
|
710
|
-
/*
|
711
|
-
* call-seq:
|
712
|
-
* XML.indent_tree_output -> (true|false)
|
27
|
+
/* The libxml gem provides Ruby language bindings for GNOME's Libxml2
|
28
|
+
* XML toolkit. To get started you may:
|
713
29
|
*
|
714
|
-
*
|
715
|
-
*
|
716
|
-
*/
|
717
|
-
static VALUE rxml_indent_tree_output_get(VALUE class)
|
718
|
-
{
|
719
|
-
if (xmlIndentTreeOutput)
|
720
|
-
return (Qtrue);
|
721
|
-
else
|
722
|
-
return (Qfalse);
|
723
|
-
}
|
724
|
-
|
725
|
-
/*
|
726
|
-
* call-seq:
|
727
|
-
* XML.indent_tree_output = true|false
|
30
|
+
* require 'xml'
|
31
|
+
* document = XML::Document.new
|
728
32
|
*
|
729
|
-
*
|
730
|
-
*
|
731
|
-
|
732
|
-
static VALUE rxml_indent_tree_output_set(VALUE class, VALUE bool)
|
733
|
-
{
|
734
|
-
if (TYPE(bool) == T_TRUE)
|
735
|
-
{
|
736
|
-
xmlIndentTreeOutput = 1;
|
737
|
-
return (Qtrue);
|
738
|
-
}
|
739
|
-
else if (TYPE(bool) == T_FALSE)
|
740
|
-
{
|
741
|
-
xmlIndentTreeOutput = 0;
|
742
|
-
return (Qfalse);
|
743
|
-
}
|
744
|
-
else
|
745
|
-
{
|
746
|
-
rb_raise(rb_eArgError, "Invalid argument, must be boolean");
|
747
|
-
}
|
748
|
-
}
|
749
|
-
|
750
|
-
/*
|
751
|
-
* call-seq:
|
752
|
-
* XML.memory_dump -> (true|false)
|
33
|
+
* However, when creating an application or library you plan to
|
34
|
+
* redistribute, it is best to not add the LibXML module to the global
|
35
|
+
* namespace, in which case you can either write your code like this:
|
753
36
|
*
|
754
|
-
*
|
755
|
-
*
|
756
|
-
*/
|
757
|
-
static VALUE rxml_memory_dump(VALUE self)
|
758
|
-
{
|
759
|
-
#ifdef DEBUG_MEMORY_LOCATION
|
760
|
-
xmlMemoryDump();
|
761
|
-
return(Qtrue);
|
762
|
-
#else
|
763
|
-
rb_warn("libxml was compiled without memory debugging support");
|
764
|
-
return (Qfalse);
|
765
|
-
#endif
|
766
|
-
}
|
767
|
-
|
768
|
-
/*
|
769
|
-
* call-seq:
|
770
|
-
* XML.memory_used -> num_bytes
|
37
|
+
* require 'libxml'
|
38
|
+
* document = LibXML::XML::Document.new
|
771
39
|
*
|
772
|
-
*
|
773
|
-
*
|
40
|
+
* Refer to the README file to get started and the LICENSE file for
|
41
|
+
* copyright and distribution information.
|
774
42
|
*/
|
775
|
-
static VALUE rxml_memory_used(VALUE self)
|
776
|
-
{
|
777
|
-
#ifdef DEBUG_MEMORY_LOCATION
|
778
|
-
return(INT2NUM(xmlMemUsed()));
|
779
|
-
#else
|
780
|
-
rb_warn("libxml was compiled without memory debugging support");
|
781
|
-
return (Qfalse);
|
782
|
-
#endif
|
783
|
-
}
|
784
|
-
|
785
|
-
#if defined(_WIN32)
|
786
|
-
__declspec(dllexport)
|
787
|
-
#endif
|
788
|
-
void Init_libxml_ruby(void)
|
789
|
-
{
|
790
43
|
mLibXML = rb_define_module("LibXML");
|
791
|
-
mXML = rb_define_module_under(mLibXML, "XML");
|
792
|
-
|
793
|
-
/* Constants */
|
794
|
-
rb_define_const(mXML, "LIBXML_VERSION", rb_str_new2(LIBXML_DOTTED_VERSION));
|
795
|
-
rb_define_const(mXML, "VERSION", rb_str_new2(RUBY_LIBXML_VERSION));
|
796
|
-
rb_define_const(mXML, "VERNUM", INT2NUM(RUBY_LIBXML_VERNUM));
|
797
|
-
rb_define_const(mXML, "XML_NAMESPACE", rb_str_new2(
|
798
|
-
(const char*) XML_XML_NAMESPACE));
|
799
|
-
|
800
|
-
rb_define_module_function(mXML, "enabled_automata?", rxml_enabled_automata_q, 0);
|
801
|
-
rb_define_module_function(mXML, "enabled_c14n?", rxml_enabled_c14n_q, 0);
|
802
|
-
rb_define_module_function(mXML, "enabled_catalog?", rxml_enabled_catalog_q, 0);
|
803
|
-
rb_define_module_function(mXML, "enabled_debug?", rxml_enabled_debug_q, 0);
|
804
|
-
rb_define_module_function(mXML, "enabled_docbook?", rxml_enabled_docbook_q, 0);
|
805
|
-
rb_define_module_function(mXML, "enabled_ftp?", rxml_enabled_ftp_q, 0);
|
806
|
-
rb_define_module_function(mXML, "enabled_http?", rxml_enabled_http_q, 0);
|
807
|
-
rb_define_module_function(mXML, "enabled_html?", rxml_enabled_html_q, 0);
|
808
|
-
rb_define_module_function(mXML, "enabled_iconv?", rxml_enabled_iconv_q, 0);
|
809
|
-
rb_define_module_function(mXML, "enabled_memory_debug?", rxml_enabled_memory_debug_location_q, 0);
|
810
|
-
rb_define_module_function(mXML, "enabled_regexp?", rxml_enabled_regexp_q, 0);
|
811
|
-
rb_define_module_function(mXML, "enabled_schemas?", rxml_enabled_schemas_q, 0);
|
812
|
-
rb_define_module_function(mXML, "enabled_thread?", rxml_enabled_thread_q, 0);
|
813
|
-
rb_define_module_function(mXML, "enabled_unicode?", rxml_enabled_unicode_q, 0);
|
814
|
-
rb_define_module_function(mXML, "enabled_xinclude?", rxml_enabled_xinclude_q, 0);
|
815
|
-
rb_define_module_function(mXML, "enabled_xpath?", rxml_enabled_xpath_q, 0);
|
816
|
-
rb_define_module_function(mXML, "enabled_xpointer?", rxml_enabled_xpointer_q, 0);
|
817
|
-
rb_define_module_function(mXML, "enabled_zlib?", rxml_enabled_zlib_q, 0);
|
818
|
-
|
819
|
-
rb_define_module_function(mXML, "catalog_dump", rxml_catalog_dump, 0);
|
820
|
-
rb_define_module_function(mXML, "catalog_remove", rxml_catalog_remove, 1);
|
821
|
-
rb_define_module_function(mXML, "check_lib_versions", rxml_check_lib_versions, 0);
|
822
|
-
rb_define_module_function(mXML, "debug_entities", rxml_debug_entities_get, 0);
|
823
|
-
rb_define_module_function(mXML, "debug_entities=", rxml_debug_entities_set, 1);
|
824
|
-
rb_define_module_function(mXML, "default_compression", rxml_default_compression_get, 0);
|
825
|
-
rb_define_module_function(mXML, "default_compression=", rxml_default_compression_set, 1);
|
826
|
-
rb_define_module_function(mXML, "default_keep_blanks", rxml_default_keep_blanks_get, 0);
|
827
|
-
rb_define_module_function(mXML, "default_keep_blanks=", rxml_default_keep_blanks_set, 1);
|
828
|
-
rb_define_module_function(mXML, "default_load_external_dtd", rxml_default_load_external_dtd_get, 0);
|
829
|
-
rb_define_module_function(mXML, "default_load_external_dtd=", rxml_default_load_external_dtd_set, 1);
|
830
|
-
rb_define_module_function(mXML, "default_line_numbers", rxml_default_line_numbers_get, 0);
|
831
|
-
rb_define_module_function(mXML, "default_line_numbers=", rxml_default_line_numbers_set, 1);
|
832
|
-
rb_define_module_function(mXML, "default_pedantic_parser", rxml_default_pedantic_parser_get, 0);
|
833
|
-
rb_define_module_function(mXML, "default_pedantic_parser=", rxml_default_pedantic_parser_set, 1);
|
834
|
-
rb_define_module_function(mXML, "default_substitute_entities", rxml_default_substitute_entities_get, 0);
|
835
|
-
rb_define_module_function(mXML, "default_substitute_entities=", rxml_default_substitute_entities_set, 1);
|
836
|
-
rb_define_module_function(mXML, "default_tree_indent_string", rxml_default_tree_indent_string_get, 0);
|
837
|
-
rb_define_module_function(mXML, "default_tree_indent_string=", rxml_default_tree_indent_string_set, 1);
|
838
|
-
rb_define_module_function(mXML, "default_validity_checking", rxml_default_validity_checking_get, 0);
|
839
|
-
rb_define_module_function(mXML, "default_validity_checking=", rxml_default_validity_checking_set, 1);
|
840
|
-
rb_define_module_function(mXML, "default_warnings", rxml_default_warnings_get, 0);
|
841
|
-
rb_define_module_function(mXML, "default_warnings=", rxml_default_warnings_set, 1);
|
842
|
-
rb_define_module_function(mXML, "features", rxml_features, 0);
|
843
|
-
rb_define_module_function(mXML, "indent_tree_output", rxml_indent_tree_output_get, 0);
|
844
|
-
rb_define_module_function(mXML, "indent_tree_output=", rxml_indent_tree_output_set, 1);
|
845
|
-
rb_define_module_function(mXML, "memory_dump", rxml_memory_dump, 0);
|
846
|
-
rb_define_module_function(mXML, "memory_used", rxml_memory_used, 0);
|
847
44
|
|
848
|
-
|
45
|
+
rxml_init_memory();
|
46
|
+
rxml_init_xml();
|
849
47
|
rxml_init_io();
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
48
|
+
rxml_init_error();
|
49
|
+
rxml_init_encoding();
|
50
|
+
rxml_init_parser();
|
51
|
+
rxml_init_parser_context();
|
52
|
+
rxml_init_parser_options();
|
53
|
+
rxml_init_node();
|
54
|
+
rxml_init_attributes();
|
55
|
+
rxml_init_attr();
|
56
|
+
rxml_init_attr_decl();
|
57
|
+
rxml_init_document();
|
58
|
+
rxml_init_namespaces();
|
59
|
+
rxml_init_namespace();
|
60
|
+
rxml_init_sax_parser();
|
61
|
+
rxml_init_sax2_handler();
|
62
|
+
rxml_init_xinclude();
|
63
|
+
rxml_init_xpath();
|
64
|
+
rxml_init_xpath_object();
|
65
|
+
rxml_init_xpath_context();
|
66
|
+
rxml_init_xpath_expression();
|
67
|
+
rxml_init_xpointer();
|
68
|
+
rxml_init_html_parser();
|
69
|
+
rxml_init_html_parser_options();
|
70
|
+
rxml_init_html_parser_context();
|
71
|
+
rxml_init_input_callbacks();
|
72
|
+
rxml_init_dtd();
|
73
|
+
rxml_init_schema();
|
74
|
+
rxml_init_relaxng();
|
75
|
+
rxml_init_reader();
|
878
76
|
}
|