coupa-libxml-ruby 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +488 -0
- data/LICENSE +22 -0
- data/README +161 -0
- data/Rakefile +188 -0
- data/doc/css/normal.css +182 -0
- data/doc/img/raze-tiny.png +0 -0
- data/doc/img/red-cube.jpg +0 -0
- data/doc/img/xml-ruby.png +0 -0
- data/doc/index.xml +43 -0
- data/doc/install.xml +77 -0
- data/doc/layout.rhtml +38 -0
- data/doc/layout.xsl +67 -0
- data/doc/license.xml +32 -0
- data/doc/log/changelog.xml +1324 -0
- data/doc/log/changelog.xsl +42 -0
- data/doc/rdoc/classes/LibXML.html +207 -0
- data/doc/rdoc/classes/LibXML/XML.html +407 -0
- data/doc/rdoc/classes/LibXML/XML/Attr.html +521 -0
- data/doc/rdoc/classes/LibXML/XML/AttrDecl.html +360 -0
- data/doc/rdoc/classes/LibXML/XML/Attributes.html +149 -0
- data/doc/rdoc/classes/LibXML/XML/Document.html +460 -0
- data/doc/rdoc/classes/LibXML/XML/Error.html +129 -0
- data/doc/rdoc/classes/LibXML/XML/HTMLParser.html +263 -0
- data/doc/rdoc/classes/LibXML/XML/Namespace.html +248 -0
- data/doc/rdoc/classes/LibXML/XML/Namespaces.html +200 -0
- data/doc/rdoc/classes/LibXML/XML/Node.html +1351 -0
- data/doc/rdoc/classes/LibXML/XML/Parser.html +328 -0
- data/doc/rdoc/classes/LibXML/XML/Reader.html +172 -0
- data/doc/rdoc/classes/LibXML/XML/SaxParser.html +232 -0
- data/doc/rdoc/classes/LibXML/XML/SaxParser/Callbacks.html +506 -0
- data/doc/rdoc/classes/LibXML/XML/SaxParser/VerboseCallbacks.html +555 -0
- data/doc/rdoc/classes/LibXML/XML/XPath.html +111 -0
- data/doc/rdoc/classes/LibXML/XML/XPath/Object.html +162 -0
- data/doc/rdoc/classes/cXMLDtd.html +114 -0
- data/doc/rdoc/classes/cXMLNode.html +114 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/CHANGES.html +794 -0
- data/doc/rdoc/files/LICENSE.html +131 -0
- data/doc/rdoc/files/README.html +343 -0
- data/doc/rdoc/files/ext/libxml/libxml_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_attr_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_attr_decl_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_attributes_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_cbg_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_document_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_dtd_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_encoding_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_error_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_html_parser_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_html_parser_context_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_html_parser_options_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_input_cbg_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_io_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_namespace_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_namespaces_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_node_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_parser_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_parser_context_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_parser_options_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_reader_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_relaxng_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_sax2_handler_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_sax_parser_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_schema_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_xinclude_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_context_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_expression_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_object_c.html +101 -0
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpointer_c.html +101 -0
- data/doc/rdoc/files/lib/libxml/attr_decl_rb.html +101 -0
- data/doc/rdoc/files/lib/libxml/attr_rb.html +101 -0
- data/doc/rdoc/files/lib/libxml/attributes_rb.html +101 -0
- data/doc/rdoc/files/lib/libxml/document_rb.html +101 -0
- data/doc/rdoc/files/lib/libxml/error_rb.html +101 -0
- data/doc/rdoc/files/lib/libxml/hpricot_rb.html +192 -0
- data/doc/rdoc/files/lib/libxml/html_parser_rb.html +101 -0
- data/doc/rdoc/files/lib/libxml/namespace_rb.html +101 -0
- data/doc/rdoc/files/lib/libxml/namespaces_rb.html +101 -0
- data/doc/rdoc/files/lib/libxml/node_rb.html +108 -0
- data/doc/rdoc/files/lib/libxml/ns_rb.html +101 -0
- data/doc/rdoc/files/lib/libxml/parser_rb.html +101 -0
- data/doc/rdoc/files/lib/libxml/properties_rb.html +101 -0
- data/doc/rdoc/files/lib/libxml/reader_rb.html +101 -0
- data/doc/rdoc/files/lib/libxml/sax_callbacks_rb.html +101 -0
- data/doc/rdoc/files/lib/libxml/sax_parser_rb.html +101 -0
- data/doc/rdoc/files/lib/libxml/tree_rb.html +101 -0
- data/doc/rdoc/files/lib/libxml/xpath_object_rb.html +101 -0
- data/doc/rdoc/files/lib/libxml_rb.html +133 -0
- data/doc/rdoc/files/lib/xml/libxml_rb.html +124 -0
- data/doc/rdoc/files/lib/xml_rb.html +134 -0
- data/doc/rdoc/fr_class_index.html +46 -0
- data/doc/rdoc/fr_file_index.html +84 -0
- data/doc/rdoc/fr_method_index.html +155 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/ext/libxml/Makefile +157 -0
- data/ext/libxml/build.log +4 -0
- data/ext/libxml/extconf.h +5 -0
- data/ext/libxml/extconf.rb +278 -0
- data/ext/libxml/libxml.c +77 -0
- data/ext/libxml/libxml.o +0 -0
- data/ext/libxml/libxml_ruby.bundle +0 -0
- data/ext/libxml/mkmf.log +228 -0
- data/ext/libxml/ruby_libxml.h +93 -0
- data/ext/libxml/ruby_xml.c +893 -0
- data/ext/libxml/ruby_xml.h +10 -0
- data/ext/libxml/ruby_xml.o +0 -0
- data/ext/libxml/ruby_xml_attr.c +352 -0
- data/ext/libxml/ruby_xml_attr.h +14 -0
- data/ext/libxml/ruby_xml_attr.o +0 -0
- data/ext/libxml/ruby_xml_attr_decl.c +171 -0
- data/ext/libxml/ruby_xml_attr_decl.h +13 -0
- data/ext/libxml/ruby_xml_attr_decl.o +0 -0
- data/ext/libxml/ruby_xml_attributes.c +277 -0
- data/ext/libxml/ruby_xml_attributes.h +17 -0
- data/ext/libxml/ruby_xml_attributes.o +0 -0
- data/ext/libxml/ruby_xml_cbg.c +86 -0
- data/ext/libxml/ruby_xml_cbg.o +0 -0
- data/ext/libxml/ruby_xml_document.c +1006 -0
- data/ext/libxml/ruby_xml_document.c.old +936 -0
- data/ext/libxml/ruby_xml_document.h +17 -0
- data/ext/libxml/ruby_xml_document.o +0 -0
- data/ext/libxml/ruby_xml_dtd.c +257 -0
- data/ext/libxml/ruby_xml_dtd.h +9 -0
- data/ext/libxml/ruby_xml_dtd.o +0 -0
- data/ext/libxml/ruby_xml_encoding.c +134 -0
- data/ext/libxml/ruby_xml_encoding.h +12 -0
- data/ext/libxml/ruby_xml_encoding.o +0 -0
- data/ext/libxml/ruby_xml_error.c +1004 -0
- data/ext/libxml/ruby_xml_error.h +14 -0
- data/ext/libxml/ruby_xml_error.o +0 -0
- data/ext/libxml/ruby_xml_html_parser.c +92 -0
- data/ext/libxml/ruby_xml_html_parser.h +12 -0
- data/ext/libxml/ruby_xml_html_parser.o +0 -0
- data/ext/libxml/ruby_xml_html_parser_context.c +308 -0
- data/ext/libxml/ruby_xml_html_parser_context.h +12 -0
- data/ext/libxml/ruby_xml_html_parser_context.o +0 -0
- data/ext/libxml/ruby_xml_html_parser_options.c +40 -0
- data/ext/libxml/ruby_xml_html_parser_options.h +12 -0
- data/ext/libxml/ruby_xml_html_parser_options.o +0 -0
- data/ext/libxml/ruby_xml_input_cbg.c +191 -0
- data/ext/libxml/ruby_xml_input_cbg.h +20 -0
- data/ext/libxml/ruby_xml_input_cbg.o +0 -0
- data/ext/libxml/ruby_xml_io.c +30 -0
- data/ext/libxml/ruby_xml_io.h +9 -0
- data/ext/libxml/ruby_xml_io.o +0 -0
- data/ext/libxml/ruby_xml_namespace.c +170 -0
- data/ext/libxml/ruby_xml_namespace.h +12 -0
- data/ext/libxml/ruby_xml_namespace.o +0 -0
- data/ext/libxml/ruby_xml_namespaces.c +295 -0
- data/ext/libxml/ruby_xml_namespaces.h +11 -0
- data/ext/libxml/ruby_xml_namespaces.o +0 -0
- data/ext/libxml/ruby_xml_node.c +1386 -0
- data/ext/libxml/ruby_xml_node.h +13 -0
- data/ext/libxml/ruby_xml_node.o +0 -0
- data/ext/libxml/ruby_xml_parser.c +94 -0
- data/ext/libxml/ruby_xml_parser.h +14 -0
- data/ext/libxml/ruby_xml_parser.o +0 -0
- data/ext/libxml/ruby_xml_parser_context.c +982 -0
- data/ext/libxml/ruby_xml_parser_context.h +12 -0
- data/ext/libxml/ruby_xml_parser_context.o +0 -0
- data/ext/libxml/ruby_xml_parser_options.c +68 -0
- data/ext/libxml/ruby_xml_parser_options.h +14 -0
- data/ext/libxml/ruby_xml_parser_options.o +0 -0
- data/ext/libxml/ruby_xml_reader.c +1002 -0
- data/ext/libxml/ruby_xml_reader.h +14 -0
- data/ext/libxml/ruby_xml_reader.o +0 -0
- data/ext/libxml/ruby_xml_relaxng.c +111 -0
- data/ext/libxml/ruby_xml_relaxng.h +10 -0
- data/ext/libxml/ruby_xml_relaxng.o +0 -0
- data/ext/libxml/ruby_xml_sax2_handler.c +322 -0
- data/ext/libxml/ruby_xml_sax2_handler.h +12 -0
- data/ext/libxml/ruby_xml_sax2_handler.o +0 -0
- data/ext/libxml/ruby_xml_sax_parser.c +137 -0
- data/ext/libxml/ruby_xml_sax_parser.h +12 -0
- data/ext/libxml/ruby_xml_sax_parser.o +0 -0
- data/ext/libxml/ruby_xml_schema.c +159 -0
- data/ext/libxml/ruby_xml_schema.h +11 -0
- data/ext/libxml/ruby_xml_schema.o +0 -0
- data/ext/libxml/ruby_xml_version.h +9 -0
- data/ext/libxml/ruby_xml_xinclude.c +18 -0
- data/ext/libxml/ruby_xml_xinclude.h +13 -0
- data/ext/libxml/ruby_xml_xinclude.o +0 -0
- data/ext/libxml/ruby_xml_xpath.c +107 -0
- data/ext/libxml/ruby_xml_xpath.h +12 -0
- data/ext/libxml/ruby_xml_xpath.o +0 -0
- data/ext/libxml/ruby_xml_xpath_context.c +387 -0
- data/ext/libxml/ruby_xml_xpath_context.h +11 -0
- data/ext/libxml/ruby_xml_xpath_context.o +0 -0
- data/ext/libxml/ruby_xml_xpath_expression.c +83 -0
- data/ext/libxml/ruby_xml_xpath_expression.h +12 -0
- data/ext/libxml/ruby_xml_xpath_expression.o +0 -0
- data/ext/libxml/ruby_xml_xpath_object.c +336 -0
- data/ext/libxml/ruby_xml_xpath_object.h +19 -0
- data/ext/libxml/ruby_xml_xpath_object.o +0 -0
- data/ext/libxml/ruby_xml_xpointer.c +101 -0
- data/ext/libxml/ruby_xml_xpointer.h +13 -0
- data/ext/libxml/ruby_xml_xpointer.o +0 -0
- data/ext/mingw/Rakefile +34 -0
- data/ext/mingw/build.rake +41 -0
- data/ext/vc/libxml_ruby.sln +26 -0
- data/lib/libxml.rb +30 -0
- data/lib/libxml/attr.rb +111 -0
- data/lib/libxml/attr_decl.rb +78 -0
- data/lib/libxml/attributes.rb +12 -0
- data/lib/libxml/document.rb +190 -0
- data/lib/libxml/error.rb +88 -0
- data/lib/libxml/hpricot.rb +76 -0
- data/lib/libxml/html_parser.rb +94 -0
- data/lib/libxml/namespace.rb +60 -0
- data/lib/libxml/namespaces.rb +36 -0
- data/lib/libxml/node.rb +385 -0
- data/lib/libxml/ns.rb +20 -0
- data/lib/libxml/parser.rb +365 -0
- data/lib/libxml/properties.rb +21 -0
- data/lib/libxml/reader.rb +27 -0
- data/lib/libxml/sax_callbacks.rb +178 -0
- data/lib/libxml/sax_parser.rb +56 -0
- data/lib/libxml/tree.rb +27 -0
- data/lib/libxml/xpath_object.rb +14 -0
- data/lib/xml.rb +14 -0
- data/lib/xml/libxml.rb +8 -0
- data/setup.rb +1585 -0
- data/test/etc_doc_to_s.rb +19 -0
- data/test/ets_doc_file.rb +15 -0
- data/test/ets_doc_to_s.rb +21 -0
- data/test/ets_gpx.rb +26 -0
- data/test/ets_node_gc.rb +21 -0
- data/test/ets_test.xml +2 -0
- data/test/ets_tsr.rb +9 -0
- data/test/model/atom.xml +13 -0
- data/test/model/bands.xml +5 -0
- data/test/model/books.xml +146 -0
- data/test/model/merge_bug_data.xml +58 -0
- data/test/model/ruby-lang.html +238 -0
- data/test/model/rubynet.xml +79 -0
- data/test/model/rubynet_project +1 -0
- data/test/model/shiporder.rnc +28 -0
- data/test/model/shiporder.rng +86 -0
- data/test/model/shiporder.xml +23 -0
- data/test/model/shiporder.xsd +31 -0
- data/test/model/soap.xml +27 -0
- data/test/model/xinclude.xml +5 -0
- data/test/tc_attr.rb +170 -0
- data/test/tc_attr_decl.rb +131 -0
- data/test/tc_attributes.rb +133 -0
- data/test/tc_deprecated_require.rb +11 -0
- data/test/tc_document.rb +113 -0
- data/test/tc_document_write.rb +118 -0
- data/test/tc_dtd.rb +123 -0
- data/test/tc_error.rb +136 -0
- data/test/tc_html_parser.rb +138 -0
- data/test/tc_namespace.rb +59 -0
- data/test/tc_namespaces.rb +174 -0
- data/test/tc_node.rb +181 -0
- data/test/tc_node_cdata.rb +49 -0
- data/test/tc_node_comment.rb +30 -0
- data/test/tc_node_copy.rb +40 -0
- data/test/tc_node_edit.rb +158 -0
- data/test/tc_node_text.rb +69 -0
- data/test/tc_node_write.rb +83 -0
- data/test/tc_node_xlink.rb +26 -0
- data/test/tc_parser.rb +330 -0
- data/test/tc_parser_context.rb +186 -0
- data/test/tc_properties.rb +36 -0
- data/test/tc_reader.rb +284 -0
- data/test/tc_relaxng.rb +51 -0
- data/test/tc_sax_parser.rb +274 -0
- data/test/tc_schema.rb +51 -0
- data/test/tc_traversal.rb +220 -0
- data/test/tc_xinclude.rb +19 -0
- data/test/tc_xml.rb +224 -0
- data/test/tc_xpath.rb +193 -0
- data/test/tc_xpath_context.rb +78 -0
- data/test/tc_xpath_expression.rb +35 -0
- data/test/tc_xpointer.rb +72 -0
- data/test/test_suite.rb +33 -0
- metadata +376 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
/* $Id: ruby_xml_xpointer.h 758 2009-01-25 20:36:03Z cfis $ */
|
2
|
+
|
3
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
4
|
+
|
5
|
+
#ifndef __RXML_XPOINTER__
|
6
|
+
#define __RXML_XPOINTER__
|
7
|
+
|
8
|
+
extern VALUE cXMLXPointer;
|
9
|
+
|
10
|
+
void rxml_init_xpointer(void);
|
11
|
+
VALUE rxml_xpointer_point2(VALUE node, VALUE xptr_str);
|
12
|
+
|
13
|
+
#endif
|
Binary file
|
data/ext/mingw/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# We can't use Ruby's standard build procedures
|
2
|
+
# on Windows because the Ruby executable is
|
3
|
+
# built with VC++ while here we want to build
|
4
|
+
# with MingW. So just roll our own...
|
5
|
+
|
6
|
+
require 'fileutils'
|
7
|
+
require 'rbconfig'
|
8
|
+
|
9
|
+
EXTENSION_NAME = "libxml_ruby.#{Config::CONFIG["DLEXT"]}"
|
10
|
+
|
11
|
+
# MingW insists the import library is .dll.a
|
12
|
+
EXTENSION_LIB_NAME = "libxml_ruby.dll.a"
|
13
|
+
|
14
|
+
# This is called when the Windows GEM is installed!
|
15
|
+
task :install do
|
16
|
+
# Gems will pass these two environment variables:
|
17
|
+
# RUBYARCHDIR=#{dest_path}
|
18
|
+
# RUBYLIBDIR=#{dest_path}
|
19
|
+
|
20
|
+
dest_path = ENV['RUBYLIBDIR']
|
21
|
+
|
22
|
+
# Copy the extension
|
23
|
+
cp(EXTENSION_NAME, dest_path)
|
24
|
+
|
25
|
+
# Copy the import library (used by libxslt)
|
26
|
+
cp(EXTENSION_LIB_NAME, dest_path)
|
27
|
+
|
28
|
+
# Copy dlls
|
29
|
+
Dir.glob('*.dll').each do |dll|
|
30
|
+
cp(dll, dest_path)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
task :default => :install
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# We can't use Ruby's standard build procedures
|
2
|
+
# on Windows because the Ruby executable is
|
3
|
+
# built with VC++ while here we want to build
|
4
|
+
# with MingW. So just roll our own...
|
5
|
+
|
6
|
+
require 'rake/clean'
|
7
|
+
require 'rbconfig'
|
8
|
+
|
9
|
+
RUBY_INCLUDE_DIR = Config::CONFIG["archdir"]
|
10
|
+
RUBY_BIN_DIR = Config::CONFIG["bindir"]
|
11
|
+
RUBY_LIB_DIR = Config::CONFIG["libdir"]
|
12
|
+
RUBY_SHARED_LIB = Config::CONFIG["LIBRUBY"]
|
13
|
+
RUBY_SHARED_DLL = RUBY_SHARED_LIB.gsub(/lib$/, 'dll')
|
14
|
+
|
15
|
+
EXTENSION_NAME = "libxml_ruby.#{Config::CONFIG["DLEXT"]}"
|
16
|
+
# MingW insists the import library is .dll.a
|
17
|
+
EXTENSION_LIB_NAME = "libxml_ruby.dll.a"
|
18
|
+
|
19
|
+
CLEAN.include('*.o')
|
20
|
+
CLOBBER.include(EXTENSION_NAME)
|
21
|
+
CLOBBER.include(EXTENSION_LIB_NAME)
|
22
|
+
|
23
|
+
task :default => "libxml"
|
24
|
+
|
25
|
+
SRC = FileList['../libxml/*.c']
|
26
|
+
OBJ = SRC.collect do |file_name|
|
27
|
+
File.basename(file_name).ext('o')
|
28
|
+
end
|
29
|
+
|
30
|
+
SRC.each do |srcfile|
|
31
|
+
objfile = File.basename(srcfile).ext('o')
|
32
|
+
file objfile => srcfile do
|
33
|
+
command = "gcc -c -O2 -Wall -o #{objfile} -I/usr/local/include #{srcfile} -I#{RUBY_INCLUDE_DIR}"
|
34
|
+
sh "sh -c '#{command}'"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
file "libxml" => OBJ do
|
39
|
+
command = "gcc -shared -o #{EXTENSION_NAME} -Wl,--out-implib,#{EXTENSION_LIB_NAME} -L/usr/local/lib #{OBJ} -lxml2 #{RUBY_BIN_DIR}/#{RUBY_SHARED_DLL}"
|
40
|
+
sh "sh -c '#{command}'"
|
41
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
Microsoft Visual Studio Solution File, Format Version 10.00
|
3
|
+
# Visual Studio 2008
|
4
|
+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxml_ruby", "libxml_ruby_18\libxml_ruby.vcproj", "{0B65CD1D-EEB9-41AE-93BB-75496E504152}"
|
5
|
+
EndProject
|
6
|
+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxml_ruby_19", "libxml_ruby_19\libxml_ruby_19.vcproj", "{0E73156F-E619-4FD9-8327-113FE3CC942E}"
|
7
|
+
EndProject
|
8
|
+
Global
|
9
|
+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
10
|
+
Debug|Win32 = Debug|Win32
|
11
|
+
Release|Win32 = Release|Win32
|
12
|
+
EndGlobalSection
|
13
|
+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
14
|
+
{0B65CD1D-EEB9-41AE-93BB-75496E504152}.Debug|Win32.ActiveCfg = Debug|Win32
|
15
|
+
{0B65CD1D-EEB9-41AE-93BB-75496E504152}.Debug|Win32.Build.0 = Debug|Win32
|
16
|
+
{0B65CD1D-EEB9-41AE-93BB-75496E504152}.Release|Win32.ActiveCfg = Release|Win32
|
17
|
+
{0B65CD1D-EEB9-41AE-93BB-75496E504152}.Release|Win32.Build.0 = Release|Win32
|
18
|
+
{0E73156F-E619-4FD9-8327-113FE3CC942E}.Debug|Win32.ActiveCfg = Debug|Win32
|
19
|
+
{0E73156F-E619-4FD9-8327-113FE3CC942E}.Debug|Win32.Build.0 = Debug|Win32
|
20
|
+
{0E73156F-E619-4FD9-8327-113FE3CC942E}.Release|Win32.ActiveCfg = Release|Win32
|
21
|
+
{0E73156F-E619-4FD9-8327-113FE3CC942E}.Release|Win32.Build.0 = Release|Win32
|
22
|
+
EndGlobalSection
|
23
|
+
GlobalSection(SolutionProperties) = preSolution
|
24
|
+
HideSolutionNode = FALSE
|
25
|
+
EndGlobalSection
|
26
|
+
EndGlobal
|
data/lib/libxml.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# If running on Windows, then add the current directory to the PATH
|
2
|
+
# for the current process so it can find the pre-built libxml2 and
|
3
|
+
# iconv2 shared libraries (dlls).
|
4
|
+
if RUBY_PLATFORM.match(/mswin/i)
|
5
|
+
ENV['PATH'] += ";#{File.dirname(__FILE__)}"
|
6
|
+
end
|
7
|
+
|
8
|
+
# Load the C-based binding.
|
9
|
+
require 'libxml_ruby'
|
10
|
+
|
11
|
+
# Load Ruby supporting code.
|
12
|
+
require 'libxml/error'
|
13
|
+
require 'libxml/parser'
|
14
|
+
require 'libxml/document'
|
15
|
+
require 'libxml/namespaces'
|
16
|
+
require 'libxml/namespace'
|
17
|
+
require 'libxml/node'
|
18
|
+
require 'libxml/ns'
|
19
|
+
require 'libxml/attributes'
|
20
|
+
require 'libxml/attr'
|
21
|
+
require 'libxml/attr_decl'
|
22
|
+
require 'libxml/tree'
|
23
|
+
require 'libxml/reader'
|
24
|
+
require 'libxml/html_parser'
|
25
|
+
require 'libxml/sax_parser'
|
26
|
+
require 'libxml/sax_callbacks'
|
27
|
+
require 'libxml/xpath_object'
|
28
|
+
|
29
|
+
# Deprecated
|
30
|
+
require 'libxml/properties'
|
data/lib/libxml/attr.rb
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
module LibXML
|
2
|
+
module XML
|
3
|
+
class Attr
|
4
|
+
include Enumerable
|
5
|
+
|
6
|
+
# call-seq:
|
7
|
+
# attr.child? -> (true|false)
|
8
|
+
#
|
9
|
+
# Returns whether this attribute has child attributes.
|
10
|
+
#
|
11
|
+
def child?
|
12
|
+
not self.children.nil?
|
13
|
+
end
|
14
|
+
|
15
|
+
# call-seq:
|
16
|
+
# attr.doc? -> (true|false)
|
17
|
+
#
|
18
|
+
# Determine whether this attribute is associated with an
|
19
|
+
# XML::Document.
|
20
|
+
def doc?
|
21
|
+
not self.doc.nil?
|
22
|
+
end
|
23
|
+
|
24
|
+
# call-seq:
|
25
|
+
# attr.last? -> (true|false)
|
26
|
+
#
|
27
|
+
# Determine whether this is the last attribute.
|
28
|
+
def last?
|
29
|
+
self.last.nil?
|
30
|
+
end
|
31
|
+
|
32
|
+
# call-seq:
|
33
|
+
# attr.next? -> (true|false)
|
34
|
+
#
|
35
|
+
# Determine whether there is a next attribute.
|
36
|
+
def next?
|
37
|
+
not self.next.nil?
|
38
|
+
end
|
39
|
+
|
40
|
+
# call-seq:
|
41
|
+
# attr.ns? -> (true|false)
|
42
|
+
#
|
43
|
+
# Determine whether this attribute has an associated
|
44
|
+
# namespace.
|
45
|
+
def ns?
|
46
|
+
not self.ns.nil?
|
47
|
+
end
|
48
|
+
|
49
|
+
#
|
50
|
+
# call-seq:
|
51
|
+
# attr.parent? -> (true|false)
|
52
|
+
#
|
53
|
+
# Determine whether this attribute has a parent.
|
54
|
+
def parent?
|
55
|
+
not self.parent.nil?
|
56
|
+
end
|
57
|
+
|
58
|
+
# call-seq:
|
59
|
+
# attr.prev? -> (true|false)
|
60
|
+
#
|
61
|
+
# Determine whether there is a previous attribute.
|
62
|
+
def prev?
|
63
|
+
not self.prev.nil?
|
64
|
+
end
|
65
|
+
|
66
|
+
# Returns this node's type name
|
67
|
+
def node_type_name
|
68
|
+
if node_type == Node::ATTRIBUTE_NODE
|
69
|
+
'attribute'
|
70
|
+
else
|
71
|
+
raise(UnknownType, "Unknown node type: %n", node.node_type);
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Iterates nodes and attributes
|
76
|
+
def siblings(node, &blk)
|
77
|
+
if n = node
|
78
|
+
loop do
|
79
|
+
blk.call(n)
|
80
|
+
break unless n = n.next
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def each_sibling(&blk)
|
86
|
+
siblings(self,&blk)
|
87
|
+
end
|
88
|
+
|
89
|
+
alias :each_attr :each_sibling
|
90
|
+
alias :each :each_sibling
|
91
|
+
|
92
|
+
def to_h
|
93
|
+
inject({}) do |h,a|
|
94
|
+
h[a.name] = a.value
|
95
|
+
h
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def to_a
|
100
|
+
inject([]) do |ary,a|
|
101
|
+
ary << [a.name, a.value]
|
102
|
+
ary
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def to_s
|
107
|
+
"#{name} = #{value}"
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module LibXML
|
2
|
+
module XML
|
3
|
+
class AttrDecl
|
4
|
+
include Enumerable
|
5
|
+
|
6
|
+
# call-seq:
|
7
|
+
# attr_decl.child -> nil
|
8
|
+
#
|
9
|
+
# Obtain this attribute declaration's child attribute(s).
|
10
|
+
# It will always be nil.
|
11
|
+
def child
|
12
|
+
nil
|
13
|
+
end
|
14
|
+
|
15
|
+
# call-seq:
|
16
|
+
# attr_decl.child? -> (true|false)
|
17
|
+
#
|
18
|
+
# Returns whether this attribute declaration has child attributes.
|
19
|
+
#
|
20
|
+
def child?
|
21
|
+
not self.children.nil?
|
22
|
+
end
|
23
|
+
|
24
|
+
# call-seq:
|
25
|
+
# attr_decl.doc? -> (true|false)
|
26
|
+
#
|
27
|
+
# Determine whether this attribute declaration is associated with an
|
28
|
+
# XML::Document.
|
29
|
+
def doc?
|
30
|
+
not self.doc.nil?
|
31
|
+
end
|
32
|
+
|
33
|
+
# call-seq:
|
34
|
+
# attr_decl.next? -> (true|false)
|
35
|
+
#
|
36
|
+
# Determine whether there is a next attribute declaration.
|
37
|
+
def next?
|
38
|
+
not self.next.nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
# call-seq:
|
42
|
+
# attr_decl.parent? -> (true|false)
|
43
|
+
#
|
44
|
+
# Determine whether this attribute declaration has a parent .
|
45
|
+
def parent?
|
46
|
+
not self.parent.nil?
|
47
|
+
end
|
48
|
+
|
49
|
+
# call-seq:
|
50
|
+
# attr_decl.prev? -> (true|false)
|
51
|
+
#
|
52
|
+
# Determine whether there is a previous attribute declaration.
|
53
|
+
def prev?
|
54
|
+
not self.prev.nil?
|
55
|
+
end
|
56
|
+
|
57
|
+
# call-seq:
|
58
|
+
# attr_decl.node_type_name -> 'attribute declaration'
|
59
|
+
#
|
60
|
+
# Returns this attribute declaration's node type name.
|
61
|
+
def node_type_name
|
62
|
+
if node_type == Node::ATTRIBUTE_DECL
|
63
|
+
'attribute declaration'
|
64
|
+
else
|
65
|
+
raise(UnknownType, "Unknown node type: %n", node.node_type);
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# call-seq:
|
70
|
+
# attr_decl.to_s -> string
|
71
|
+
#
|
72
|
+
# Returns a string representation of this attribute declaration.
|
73
|
+
def to_s
|
74
|
+
"#{name} = #{value}"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,190 @@
|
|
1
|
+
module LibXML
|
2
|
+
module XML
|
3
|
+
class Document
|
4
|
+
# call-seq:
|
5
|
+
# XML::Document.document(document) -> XML::Document
|
6
|
+
#
|
7
|
+
# Creates a new document based on the specified document.
|
8
|
+
#
|
9
|
+
# Parameters:
|
10
|
+
#
|
11
|
+
# document - A preparsed document.
|
12
|
+
def self.document(value)
|
13
|
+
Parser.document(value).parse
|
14
|
+
end
|
15
|
+
|
16
|
+
# call-seq:
|
17
|
+
# XML::Document.file(path) -> XML::Document
|
18
|
+
# XML::Document.file(path, :encoding => XML::Encoding::UTF_8,
|
19
|
+
# :options => XML::Parser::Options::NOENT) -> XML::Document
|
20
|
+
#
|
21
|
+
# Creates a new document from the specified file or uri.
|
22
|
+
#
|
23
|
+
# You may provide an optional hash table to control how the
|
24
|
+
# parsing is performed. Valid options are:
|
25
|
+
#
|
26
|
+
# encoding - The document encoding, defaults to nil. Valid values
|
27
|
+
# are the encoding constants defined on XML::Encoding.
|
28
|
+
# options - Parser options. Valid values are the constants defined on
|
29
|
+
# XML::Parser::Options. Mutliple options can be combined
|
30
|
+
# by using Bitwise OR (|).
|
31
|
+
def self.file(value, options = {})
|
32
|
+
Parser.file(value, options).parse
|
33
|
+
end
|
34
|
+
|
35
|
+
# call-seq:
|
36
|
+
# XML::Document.io(io) -> XML::Document
|
37
|
+
# XML::Document.io(io, :encoding => XML::Encoding::UTF_8,
|
38
|
+
# :options => XML::Parser::Options::NOENT
|
39
|
+
# :base_uri="http://libxml.org") -> XML::Document
|
40
|
+
#
|
41
|
+
# Creates a new document from the specified io object.
|
42
|
+
#
|
43
|
+
# Parameters:
|
44
|
+
#
|
45
|
+
# io - io object that contains the xml to parser
|
46
|
+
# base_uri - The base url for the parsed document.
|
47
|
+
# encoding - The document encoding, defaults to nil. Valid values
|
48
|
+
# are the encoding constants defined on XML::Encoding.
|
49
|
+
# options - Parser options. Valid values are the constants defined on
|
50
|
+
# XML::Parser::Options. Mutliple options can be combined
|
51
|
+
# by using Bitwise OR (|).
|
52
|
+
def self.io(value, options = {})
|
53
|
+
Parser.io(value, options).parse
|
54
|
+
end
|
55
|
+
|
56
|
+
# call-seq:
|
57
|
+
# XML::Document.string(string)
|
58
|
+
# XML::Document.string(string, :encoding => XML::Encoding::UTF_8,
|
59
|
+
# :options => XML::Parser::Options::NOENT
|
60
|
+
# :base_uri="http://libxml.org") -> XML::Document
|
61
|
+
#
|
62
|
+
# Creates a new document from the specified string.
|
63
|
+
#
|
64
|
+
# You may provide an optional hash table to control how the
|
65
|
+
# parsing is performed. Valid options are:
|
66
|
+
#
|
67
|
+
# base_uri - The base url for the parsed document.
|
68
|
+
# encoding - The document encoding, defaults to nil. Valid values
|
69
|
+
# are the encoding constants defined on XML::Encoding.
|
70
|
+
# options - Parser options. Valid values are the constants defined on
|
71
|
+
# XML::Parser::Options. Mutliple options can be combined
|
72
|
+
# by using Bitwise OR (|).
|
73
|
+
def self.string(value, options = {})
|
74
|
+
Parser.string(value, options).parse
|
75
|
+
end
|
76
|
+
|
77
|
+
# Returns a new XML::XPathContext for the document.
|
78
|
+
#
|
79
|
+
# call-seq:
|
80
|
+
# document.context(namespaces=nil) -> XPath::Context
|
81
|
+
#
|
82
|
+
# Namespaces is an optional array of XML::NS objects
|
83
|
+
def context(nslist = nil)
|
84
|
+
context = XPath::Context.new(self)
|
85
|
+
context.node = self.root
|
86
|
+
context.register_namespaces_from_node(self.root)
|
87
|
+
context.register_namespaces(nslist) if nslist
|
88
|
+
context
|
89
|
+
end
|
90
|
+
|
91
|
+
# Return the nodes matching the specified xpath expression,
|
92
|
+
# optionally using the specified namespace. For more
|
93
|
+
# information about working with namespaces, please refer
|
94
|
+
# to the XML::XPath documentation.
|
95
|
+
#
|
96
|
+
# Parameters:
|
97
|
+
# * xpath - The xpath expression as a string
|
98
|
+
# * namespaces - An optional list of namespaces (see XML::XPath for information).
|
99
|
+
# * Returns - XML::XPath::Object
|
100
|
+
#
|
101
|
+
# document.find('/foo', 'xlink:http://www.w3.org/1999/xlink')
|
102
|
+
#
|
103
|
+
# IMPORTANT - The returned XML::Node::Set must be freed before
|
104
|
+
# its associated document. In a running Ruby program this will
|
105
|
+
# happen automatically via Ruby's mark and sweep garbage collector.
|
106
|
+
# However, if the program exits, Ruby does not guarantee the order
|
107
|
+
# in which objects are freed
|
108
|
+
# (see http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/17700).
|
109
|
+
# As a result, the associated document may be freed before the node
|
110
|
+
# list, which will cause a segmentation fault.
|
111
|
+
# To avoid this, use the following (non-ruby like) coding style:
|
112
|
+
#
|
113
|
+
# nodes = doc.find('/header')
|
114
|
+
# nodes.each do |node|
|
115
|
+
# ... do stuff ...
|
116
|
+
# end
|
117
|
+
# # nodes = nil # GC.start
|
118
|
+
def find(xpath, nslist = nil)
|
119
|
+
self.context(nslist).find(xpath)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Return the first node matching the specified xpath expression.
|
123
|
+
# For more information, please refer to the documentation
|
124
|
+
# for XML::Document#find.
|
125
|
+
def find_first(xpath, nslist = nil)
|
126
|
+
find(xpath, nslist).first
|
127
|
+
end
|
128
|
+
|
129
|
+
# Returns this node's type name
|
130
|
+
def node_type_name
|
131
|
+
case node_type
|
132
|
+
when XML::Node::DOCUMENT_NODE
|
133
|
+
'document_xml'
|
134
|
+
when XML::Node::DOCB_DOCUMENT_NODE
|
135
|
+
'document_docbook'
|
136
|
+
when XML::Node::HTML_DOCUMENT_NODE
|
137
|
+
'document_html'
|
138
|
+
else
|
139
|
+
raise(UnknownType, "Unknown node type: %n", node.node_type);
|
140
|
+
end
|
141
|
+
end
|
142
|
+
# :enddoc:
|
143
|
+
|
144
|
+
# Specifies if this is an DOCTYPE node
|
145
|
+
def document?
|
146
|
+
node_type == XML::Node::DOCUMENT_NODE
|
147
|
+
end
|
148
|
+
|
149
|
+
# Specifies if this is an docbook node
|
150
|
+
def docbook_doc?
|
151
|
+
node_type == XML::Node::DOCB_DOCUMENT_NODE
|
152
|
+
end
|
153
|
+
|
154
|
+
# Specifies if this is an html node
|
155
|
+
def html_doc?
|
156
|
+
node_type == XML::Node::HTML_DOCUMENT_NODE
|
157
|
+
end
|
158
|
+
|
159
|
+
def dump
|
160
|
+
warn('Document#dump is deprecated. Use Document#to_s instead.')
|
161
|
+
self.to_s
|
162
|
+
end
|
163
|
+
|
164
|
+
def format_dump
|
165
|
+
warn('Document#format_dump is deprecated. Use Document#to_s instead.')
|
166
|
+
self.to_s
|
167
|
+
end
|
168
|
+
|
169
|
+
def debug_dump
|
170
|
+
warn('Document#debug_dump is deprecated. Use Document#debug instead.')
|
171
|
+
self.debug
|
172
|
+
end
|
173
|
+
|
174
|
+
def debug_dump_head
|
175
|
+
warn('Document#debug_dump_head is deprecated. Use Document#debug instead.')
|
176
|
+
self.debug
|
177
|
+
end
|
178
|
+
|
179
|
+
def debug_format_dump
|
180
|
+
warn('Document#debug_format_dump is deprecated. Use Document#to_s instead.')
|
181
|
+
self.to_s
|
182
|
+
end
|
183
|
+
|
184
|
+
def reader
|
185
|
+
warn('Document#reader is deprecated. Use XML::Reader.document(self) instead.')
|
186
|
+
XML::Reader.document(self)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|