libxml-ruby 0.5.2.0 → 0.5.3

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.
Files changed (131) hide show
  1. data/CHANGES +122 -0
  2. data/LICENSE +2 -1
  3. data/MANIFEST +138 -0
  4. data/NOTES +9 -0
  5. data/README +1 -1
  6. data/Rakefile +27 -205
  7. data/TODO +0 -2
  8. data/VERSION +1 -0
  9. data/ext/{xml → libxml}/cbg.c +0 -0
  10. data/ext/libxml/extconf.rb +309 -0
  11. data/ext/{xml → libxml}/libxml.c +1 -1
  12. data/ext/{xml → libxml}/libxml.h +7 -4
  13. data/ext/{xml → libxml}/ruby_xml_attr.c +1 -1
  14. data/ext/{xml → libxml}/ruby_xml_attr.h +1 -1
  15. data/ext/{xml → libxml}/ruby_xml_document.c +16 -8
  16. data/ext/{xml → libxml}/ruby_xml_document.h +1 -1
  17. data/ext/{xml → libxml}/ruby_xml_dtd.c +0 -0
  18. data/ext/{xml → libxml}/ruby_xml_dtd.h +0 -0
  19. data/ext/{xml → libxml}/ruby_xml_html_parser.c +1 -1
  20. data/ext/{xml → libxml}/ruby_xml_html_parser.h +1 -1
  21. data/ext/{xml → libxml}/ruby_xml_input_cbg.c +0 -0
  22. data/ext/{xml → libxml}/ruby_xml_input_cbg.h +0 -0
  23. data/ext/{xml → libxml}/ruby_xml_node.c +47 -6
  24. data/ext/{xml → libxml}/ruby_xml_node.h +1 -1
  25. data/ext/{xml → libxml}/ruby_xml_node_set.c +1 -1
  26. data/ext/{xml → libxml}/ruby_xml_node_set.h +1 -1
  27. data/ext/{xml → libxml}/ruby_xml_ns.c +1 -1
  28. data/ext/{xml → libxml}/ruby_xml_ns.h +1 -1
  29. data/ext/{xml → libxml}/ruby_xml_parser.c +6 -4
  30. data/ext/{xml → libxml}/ruby_xml_parser.h +1 -1
  31. data/ext/{xml → libxml}/ruby_xml_parser_context.c +1 -1
  32. data/ext/{xml → libxml}/ruby_xml_parser_context.h +1 -1
  33. data/ext/{xml → libxml}/ruby_xml_reader.c +3 -0
  34. data/ext/{xml → libxml}/ruby_xml_reader.h +0 -0
  35. data/ext/{xml → libxml}/ruby_xml_sax_parser.c +1 -1
  36. data/ext/{xml → libxml}/ruby_xml_sax_parser.h +1 -1
  37. data/ext/{xml → libxml}/ruby_xml_schema.c +0 -0
  38. data/ext/{xml → libxml}/ruby_xml_schema.h +0 -0
  39. data/ext/{xml → libxml}/ruby_xml_state.c +0 -0
  40. data/ext/{xml → libxml}/ruby_xml_state.h +0 -0
  41. data/ext/{xml → libxml}/ruby_xml_tree.c +1 -1
  42. data/ext/{xml → libxml}/ruby_xml_tree.h +1 -1
  43. data/ext/{xml → libxml}/ruby_xml_xinclude.c +1 -1
  44. data/ext/{xml → libxml}/ruby_xml_xinclude.h +1 -1
  45. data/ext/{xml → libxml}/ruby_xml_xpath.c +7 -4
  46. data/ext/{xml → libxml}/ruby_xml_xpath.h +1 -1
  47. data/ext/{xml → libxml}/ruby_xml_xpath_context.c +1 -1
  48. data/ext/{xml → libxml}/ruby_xml_xpath_context.h +1 -1
  49. data/ext/{xml → libxml}/ruby_xml_xpath_object.c +65 -32
  50. data/ext/{xml → libxml}/ruby_xml_xpath_object.h +0 -0
  51. data/ext/{xml → libxml}/ruby_xml_xpointer.c +1 -1
  52. data/ext/{xml → libxml}/ruby_xml_xpointer.h +1 -1
  53. data/ext/{xml → libxml}/ruby_xml_xpointer_context.c +1 -1
  54. data/ext/{xml → libxml}/ruby_xml_xpointer_context.h +1 -1
  55. data/ext/{xml → libxml}/sax_parser_callbacks.inc +1 -1
  56. data/ext/libxml/version.h +9 -0
  57. data/{ext/xml → lib}/libxml.rb +7 -2
  58. data/lib/xml/libxml.rb +5 -0
  59. data/{ChangeLog → log/Changelog-0.txt} +0 -0
  60. data/log/Changelog.txt +435 -0
  61. data/meta/project.yaml +27 -0
  62. data/meta/unixname +1 -0
  63. data/setup.rb +1469 -0
  64. data/site/css/normal.css +182 -0
  65. data/site/img/raze-tiny.png +0 -0
  66. data/site/img/red-cube.jpg +0 -0
  67. data/site/img/xml-ruby.png +0 -0
  68. data/site/index.xml +43 -0
  69. data/site/install.xml +77 -0
  70. data/site/layout.rhtml +38 -0
  71. data/site/layout.xsl +67 -0
  72. data/site/license.xml +32 -0
  73. data/site/log/changelog.xml +1324 -0
  74. data/site/log/changelog.xsl +42 -0
  75. data/{tests → test}/dtd-test.rb +2 -2
  76. data/test/etc_doc_to_s.rb +21 -0
  77. data/test/ets_copy_bug.rb +21 -0
  78. data/test/ets_copy_bug2.rb +32 -0
  79. data/test/ets_doc_file.rb +14 -0
  80. data/test/ets_doc_to_s.rb +21 -0
  81. data/test/ets_gpx.rb +26 -0
  82. data/test/ets_node_gc.rb +21 -0
  83. data/test/ets_test.xml +2 -0
  84. data/test/ets_tsr.rb +9 -0
  85. data/{tests → test}/merge_bug.rb +4 -5
  86. data/{tests → test}/model/default_validation_bug.rb +0 -0
  87. data/{tests → test}/model/merge_bug_data.xml +0 -0
  88. data/{tests → test}/model/rubynet.xml +0 -0
  89. data/{tests → test}/model/rubynet_project +1 -1
  90. data/{tests → test}/model/saxtest.xml +0 -0
  91. data/{tests → test}/model/simple.xml +0 -0
  92. data/{tests → test}/model/xinclude.xml +0 -0
  93. data/{tests → test}/schema-test.rb +2 -2
  94. data/{tests → test}/tc_xml_document.rb +2 -2
  95. data/{tests → test}/tc_xml_document_write.rb +1 -2
  96. data/{tests → test}/tc_xml_document_write2.rb +1 -2
  97. data/{tests → test}/tc_xml_document_write3.rb +1 -2
  98. data/{tests → test}/tc_xml_html_parser.rb +7 -8
  99. data/{tests → test}/tc_xml_node.rb +1 -2
  100. data/{tests → test}/tc_xml_node2.rb +1 -2
  101. data/{tests → test}/tc_xml_node3.rb +2 -3
  102. data/{tests → test}/tc_xml_node4.rb +19 -20
  103. data/{tests → test}/tc_xml_node5.rb +8 -9
  104. data/{tests → test}/tc_xml_node6.rb +1 -2
  105. data/{tests → test}/tc_xml_node7.rb +5 -6
  106. data/{tests → test}/tc_xml_node8.rb +5 -5
  107. data/{tests → test}/tc_xml_node9.rb +5 -5
  108. data/test/tc_xml_node_copy.rb +40 -0
  109. data/{tests → test}/tc_xml_node_set.rb +2 -3
  110. data/{tests → test}/tc_xml_node_set2.rb +4 -5
  111. data/test/tc_xml_node_text.rb +17 -0
  112. data/{tests → test}/tc_xml_node_xlink.rb +2 -2
  113. data/{tests → test}/tc_xml_parser.rb +5 -6
  114. data/{tests → test}/tc_xml_parser2.rb +2 -2
  115. data/{tests → test}/tc_xml_parser3.rb +2 -2
  116. data/{tests → test}/tc_xml_parser4.rb +2 -2
  117. data/{tests → test}/tc_xml_parser5.rb +2 -2
  118. data/{tests → test}/tc_xml_parser6.rb +3 -3
  119. data/{tests → test}/tc_xml_parser7.rb +3 -3
  120. data/{tests → test}/tc_xml_parser8.rb +13 -13
  121. data/{tests → test}/tc_xml_parser_context.rb +1 -2
  122. data/{tests → test}/tc_xml_reader.rb +22 -14
  123. data/{tests → test}/tc_xml_sax_parser.rb +21 -22
  124. data/{tests → test}/tc_xml_xinclude.rb +4 -4
  125. data/{tests → test}/tc_xml_xpath.rb +17 -3
  126. data/{tests → test}/tc_xml_xpointer.rb +4 -5
  127. metadata +231 -158
  128. data/CHANGELOG_to200701 +0 -82
  129. data/ext/xml/extconf.rb +0 -98
  130. data/tests/libxml_test.rb +0 -3
  131. data/tests/runner.rb +0 -11
data/TODO CHANGED
@@ -1,5 +1,3 @@
1
- $Id: TODO 59 2006-04-12 12:08:39Z roscopeco $
2
-
3
1
  ==== BUGS
4
2
 
5
3
  * Some C funcs need more NULL checking, they're throwing wierd
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.5.3 stable (2008-02-01)
File without changes
@@ -0,0 +1,309 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rbconfig'
4
+
5
+ def method_missing(s, *args)
6
+ if v = Config::CONFIG[s] || Config::CONFIG[s.upcase]
7
+ return v
8
+ else
9
+ super
10
+ end
11
+ end
12
+
13
+
14
+ if RUBY_PLATFORM =~ /win32/ # FIXME: Make more robust
15
+
16
+ # We can't use Ruby's standard build procedures
17
+ # on Windows because the Ruby executable is
18
+ # built with VC++ while here we want to build
19
+ # with MingW. So just roll our own...
20
+
21
+ target = "libxml_so"
22
+
23
+ #RUBY_INCLUDE_DIR = Config::CONFIG["archdir"]
24
+ #RUBY_BIN_DIR = Config::CONFIG["bindir"]
25
+ #RUBY_LIB_DIR = Config::CONFIG["libdir"]
26
+ #RUBY_SHARED_LIB = Config::CONFIG["LIBRUBY"]
27
+ #RUBY_SHARED_DLL = RUBY_SHARED_LIB.gsub(/lib$/, 'dll')
28
+
29
+ #CLEAN.include('*.o')
30
+ #CLOBBER.include('ruby_prof.so')
31
+
32
+ srcs = Dir['../ext/*.c']
33
+
34
+ objs = src.collect do |srcfile|
35
+ srcfile = File.basename(srcfile)
36
+ srcfile.chomp(File.extname(srcfile) + '.o')
37
+ end
38
+
39
+ #src.each do |srcfile|
40
+ # srcfile = File.basename(srcfile)
41
+ # objfile = srcfile.chomp(File.extname(srcfile) + '.o')
42
+ #
43
+ # if File.mtime(objfile) < File.mtime(srcfile)
44
+ # system "gcc -c -fPIC -O2 -Wall -o #{objfile} #{srcfile} -I#{RUBY_INCLUDE_DIR}"
45
+ # end
46
+ #end
47
+
48
+ #system "gcc -shared -o #{LIBNAME} #{obj} #{RUBY_BIN_DIR}/#{RUBY_SHARED_DLL}"
49
+
50
+ makefile_template = DATA.read
51
+ makefile = eval(makefile_template)
52
+
53
+ File.open('Makefile', 'w'){ |f| f << makefile }
54
+
55
+ else
56
+
57
+ require 'mkmf'
58
+
59
+ if defined?(CFLAGS)
60
+ if CFLAGS.index(CONFIG['CCDLFLAGS'])
61
+ $CFLAGS = CFLAGS
62
+ else
63
+ $CFLAGS = CFLAGS + ' ' + CONFIG['CCDLFLAGS']
64
+ end
65
+ else
66
+ $CFLAGS = CONFIG['CFLAGS']
67
+ end
68
+ $LDFLAGS = CONFIG['LDFLAGS']
69
+ $LIBPATH.push(Config::CONFIG['libdir'])
70
+
71
+ def crash(str)
72
+ printf(" extconf failure: %s\n", str)
73
+ exit 1
74
+ end
75
+
76
+ dir_config('iconv')
77
+ dir_config('xml2')
78
+ dir_config('zlib')
79
+
80
+ have_library('socket','socket')
81
+ have_library('nsl','gethostbyname')
82
+
83
+ unless have_library('m', 'atan')
84
+ # try again for gcc 4.0
85
+ saveflags = $CFLAGS
86
+ $CFLAGS += ' -fno-builtin'
87
+ unless have_library('m', 'atan')
88
+ crash('need libm')
89
+ end
90
+ $CFLAGS = saveflags
91
+ end
92
+
93
+ unless have_library('z', 'inflate') or
94
+ have_library('zlib', 'inflate') or
95
+ have_library('zlib1', 'inflate')
96
+ crash('need zlib')
97
+ else
98
+ $defs.push('-DHAVE_ZLIB_H')
99
+ end
100
+
101
+ unless have_library('iconv','iconv_open') or
102
+ have_library('iconv','libiconv_open') or
103
+ have_library('libiconv', 'libiconv_open') or
104
+ have_library('libiconv', 'iconv_open') or
105
+ have_library('c','iconv_open') or
106
+ have_library('recode','iconv_open') or
107
+ have_library('iconv')
108
+ crash(<<EOL)
109
+ need libiconv.
110
+
111
+ Install the libiconv or try passing one of the following options
112
+ to extconf.rb:
113
+
114
+ --with-iconv-dir=/path/to/iconv
115
+ --with-iconv-lib=/path/to/iconv/lib
116
+ --with-iconv-include=/path/to/iconv/include
117
+ EOL
118
+ end
119
+
120
+ unless (have_library('xml2', 'xmlParseDoc') or
121
+ have_library('libxml2', 'xmlParseDoc') or
122
+ find_library('xml2', '/opt/lib', '/usr/local/lib', '/usr/lib')) and
123
+ (have_header('libxml/xmlversion.h') or
124
+ find_header('libxml/xmlversion.h',
125
+ "#{CONFIG['prefix']}/include",
126
+ '/opt/include/libxml2',
127
+ '/usr/local/include/libxml2',
128
+ '/usr/include/libxml2'))
129
+ crash(<<EOL)
130
+ need libxml2.
131
+
132
+ Install the library or try one of the following options to extconf.rb:
133
+
134
+ --with-xml2-dir=/path/to/libxml2
135
+ --with-xml2-lib=/path/to/libxml2/lib
136
+ --with-xml2-include=/path/to/libxml2/include
137
+ EOL
138
+ end
139
+
140
+ unless have_func('xmlDocFormatDump')
141
+ crash('Your version of libxml2 is too old. Please upgrade.')
142
+ end
143
+
144
+ unless have_func('docbCreateFileParserCtxt')
145
+ crash('Need docbCreateFileParserCtxt')
146
+ end
147
+
148
+ $CFLAGS << ' ' << $INCFLAGS
149
+ #$INSTALLFILES = [["libxml.rb", "$(RUBYLIBDIR)", "../xml"]]
150
+
151
+ create_header()
152
+ #create_makefile('xml/libxml_so')
153
+ create_makefile('libxml_so')
154
+
155
+ end
156
+
157
+ __END__
158
+
159
+ SHELL = /bin/sh
160
+
161
+ #### Start of system configuration section. ####
162
+
163
+ # I think we can remove all the parts related to the install target
164
+ # since setup.rb and RubyGems handles that on their own. Correct?
165
+
166
+ srcdir = .
167
+ topdir = #{archdir} #/usr/lib/ruby/1.8/x86_64-linux
168
+ hdrdir = $(topdir)
169
+ VPATH = $(srcdir):$(topdir):$(hdrdir)
170
+ prefix = $(DESTDIR)/usr
171
+ exec_prefix = $(DESTDIR)/usr
172
+ sitedir = $(DESTDIR)/usr/local/lib/site_ruby
173
+ rubylibdir = $(libdir)/ruby/$(ruby_version)
174
+ docdir = $(datarootdir)/doc/$(PACKAGE)
175
+ dvidir = $(docdir)
176
+ datarootdir = $(prefix)/share
177
+ archdir = $(rubylibdir)/$(arch)
178
+ sbindir = $(exec_prefix)/sbin
179
+ psdir = $(docdir)
180
+ localedir = $(datarootdir)/locale
181
+ htmldir = $(docdir)
182
+ datadir = $(datarootdir)
183
+ includedir = $(prefix)/include
184
+ infodir = $(prefix)/share/info
185
+ sysconfdir = $(DESTDIR)/etc
186
+ mandir = $(prefix)/share/man
187
+ libdir = $(DESTDIR)/usr/lib
188
+ sharedstatedir = $(prefix)/com
189
+ oldincludedir = $(DESTDIR)/usr/include
190
+ pdfdir = $(docdir)
191
+ sitearchdir = $(sitelibdir)/$(sitearch)
192
+ bindir = $(exec_prefix)/bin
193
+ localstatedir = $(DESTDIR)/var
194
+ sitelibdir = $(sitedir)/$(ruby_version)
195
+ libexecdir = $(prefix)/lib/ruby1.8
196
+
197
+ CC = cc
198
+ LIBRUBY = $(LIBRUBY_SO)
199
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
200
+ LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
201
+ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
202
+
203
+ RUBY_EXTCONF_H = extconf.h
204
+ CFLAGS = -fPIC -fno-strict-aliasing -g -O2 -fPIC -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -I/usr/include/libxml2
205
+ INCFLAGS = -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -I/usr/include/libxml2
206
+ CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\"
207
+ CXXFLAGS = $(CFLAGS)
208
+ DLDFLAGS = -L. -rdynamic -Wl,-export-dynamic
209
+ LDSHARED = $(CC) -shared
210
+ AR = ar
211
+ EXEEXT =
212
+
213
+ RUBY_INSTALL_NAME = ruby1.8
214
+ RUBY_SO_NAME = ruby1.8
215
+ arch = x86_64-linux
216
+ sitearch = x86_64-linux
217
+ ruby_version = 1.8
218
+ ruby = /usr/bin/ruby1.8
219
+ RUBY = $(ruby)
220
+ RM = rm -f
221
+ MAKEDIRS = mkdir -p
222
+ INSTALL = /usr/bin/install -c
223
+ INSTALL_PROG = $(INSTALL) -m 0755
224
+ INSTALL_DATA = $(INSTALL) -m 644
225
+ COPY = cp
226
+
227
+ preload =
228
+
229
+ libpath = . $(libdir) /usr/lib
230
+ LIBPATH = -L"." -L"$(libdir)" -L"/usr/lib"
231
+ DEFFILE =
232
+
233
+ CLEANFILES =
234
+ DISTCLEANFILES =
235
+
236
+ extout =
237
+ extout_prefix =
238
+ target_prefix = /xml
239
+ LOCAL_LIBS =
240
+ LIBS = $(LIBRUBYARG_SHARED) -lxml2 -lc -lz -lm -lnsl -lpthread -ldl -lcrypt -lm -lc
241
+
242
+ SRCS = #{srcs.join(' ')}
243
+ OBJS = #{objs.join(' ')}
244
+
245
+ TARGET = #{target}
246
+ DLLIB = $(TARGET).so
247
+ EXTSTATIC =
248
+ STATIC_LIB =
249
+
250
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
251
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
252
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
253
+
254
+ TARGET_SO = $(DLLIB)
255
+ CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
256
+ CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
257
+
258
+ all: $(DLLIB)
259
+ static: $(STATIC_LIB)
260
+
261
+ clean:
262
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
263
+
264
+ distclean: clean
265
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
266
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
267
+
268
+ realclean: distclean
269
+ install: install-so install-rb
270
+
271
+ install-so: $(RUBYARCHDIR)
272
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
273
+ $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
274
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
275
+ install-rb: pre-install-rb install-rb-default
276
+ install-rb-default: pre-install-rb-default
277
+ pre-install-rb: Makefile
278
+ pre-install-rb-default: Makefile
279
+ $(RUBYARCHDIR):
280
+ $(MAKEDIRS) $@
281
+
282
+ site-install: site-install-so site-install-rb
283
+ site-install-so: install-so
284
+ site-install-rb: install-rb
285
+
286
+ .SUFFIXES: .c .m .cc .cxx .cpp .C .o
287
+
288
+ .cc.o:
289
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
290
+
291
+ .cxx.o:
292
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
293
+
294
+ .cpp.o:
295
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
296
+
297
+ .C.o:
298
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
299
+
300
+ .c.o:
301
+ $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
302
+
303
+ $(DLLIB): $(OBJS)
304
+ @-$(RM) $@
305
+ $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
306
+
307
+
308
+ $(OBJS): ruby.h defines.h $(RUBY_EXTCONF_H)
309
+
@@ -1,4 +1,4 @@
1
- /* $Id: libxml.c 189 2007-09-26 15:04:47Z danj $ */
1
+ /* $Id: libxml.c 225 2007-12-07 04:58:09Z transami $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -5,13 +5,16 @@
5
5
 
6
6
  /* Don't nuke this block! It is used for automatically updating the
7
7
  * versions below. VERSION = string formatting, VERNUM = numbered
8
- * version for inline testing: increment both or none at all. */
9
- #define RUBY_LIBXML_VERSION "0.5.2.0"
10
- #define RUBY_LIBXML_VERNUM 520
8
+ * version for inline testing: increment both or none at all.
9
+ #define RUBY_LIBXML_VERSION "0.5.2.2"
10
+ #define RUBY_LIBXML_VERNUM 522
11
11
  #define RUBY_LIBXML_VER_MAJ 0
12
12
  #define RUBY_LIBXML_VER_MIN 5
13
13
  #define RUBY_LIBXML_VER_MIC 2
14
- #define RUBY_LIBXML_VER_PATCH 0
14
+ #define RUBY_LIBXML_VER_PATCH 2
15
+ */
16
+
17
+ #include "version.h"
15
18
 
16
19
  #include <ruby.h>
17
20
  #include <rubyio.h>
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_attr.c 189 2007-09-26 15:04:47Z danj $ */
1
+ /* $Id: ruby_xml_attr.c 225 2007-12-07 04:58:09Z transami $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_attr.h 138 2007-08-29 18:00:35Z danj $ */
1
+ /* $Id: ruby_xml_attr.h 225 2007-12-07 04:58:09Z transami $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_document.c 190 2007-09-28 17:13:52Z danj $ */
1
+ /* $Id: ruby_xml_document.c 225 2007-12-07 04:58:09Z transami $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -801,15 +801,20 @@ ruby_xml_document_standalone_q(VALUE self) {
801
801
 
802
802
  /*
803
803
  * call-seq:
804
- * document.to_s => "xml"
804
+ * document.to_s({format=true,encoding) => "xml"
805
805
  *
806
806
  * Coerce this document to a string representation
807
- * of it's XML.
807
+ * of it's XML. The default is to pretty format, but this
808
+ * depends Parser#indent_tree_output==true or
809
+ * Parser#default_keep_blanks==false.
810
+ *
811
+ * The encoding is not applied to the document, but is
812
+ * encoding target of the resulting string.
808
813
  */
809
814
  VALUE
810
815
  ruby_xml_document_to_s(int argc, VALUE *argv, VALUE self) {
811
816
  ruby_xml_document_t *rxd;
812
- xmlChar *result;
817
+ xmlChar *result, *encoding=NULL;
813
818
  int format, len;
814
819
  VALUE rresult;
815
820
 
@@ -817,6 +822,9 @@ ruby_xml_document_to_s(int argc, VALUE *argv, VALUE self) {
817
822
  case 0:
818
823
  format = 1;
819
824
  break;
825
+ case 2:
826
+ if (TYPE(argv[1]) == T_STRING)
827
+ encoding=(xmlChar *)StringValuePtr(argv[1]);
820
828
  case 1:
821
829
  if (TYPE(argv[0]) == T_TRUE)
822
830
  format = 1;
@@ -832,13 +840,13 @@ ruby_xml_document_to_s(int argc, VALUE *argv, VALUE self) {
832
840
  Data_Get_Struct(self, ruby_xml_document_t, rxd);
833
841
  if (rxd->doc == NULL) {
834
842
  return(Qnil);
835
- } else if (rxd->doc->encoding != NULL) {
843
+ } else if (encoding != NULL) {
836
844
  if (format) {
837
845
  xmlDocDumpFormatMemoryEnc(rxd->doc, &result, &len,
838
- (const char*)rxd->doc->encoding, format);
846
+ (const char*)encoding, format);
839
847
  } else {
840
848
  xmlDocDumpMemoryEnc(rxd->doc, &result, &len,
841
- (const char*)rxd->doc->encoding);
849
+ (const char *)encoding);
842
850
  }
843
851
  } else {
844
852
  if (format)
@@ -846,7 +854,7 @@ ruby_xml_document_to_s(int argc, VALUE *argv, VALUE self) {
846
854
  else
847
855
  xmlDocDumpMemory(rxd->doc, &result, &len);
848
856
  }
849
- rresult=rb_str_new2((const char*)result);
857
+ rresult=rb_str_new((const char*)result,len);
850
858
  xmlFree(result);
851
859
  return rresult;
852
860
  }
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_document.h 188 2007-09-24 01:43:21Z danj $ */
1
+ /* $Id: ruby_xml_document.h 225 2007-12-07 04:58:09Z transami $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_html_parser.c 189 2007-09-26 15:04:47Z danj $ */
1
+ /* $Id: ruby_xml_html_parser.c 225 2007-12-07 04:58:09Z transami $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4