libxml-ruby 0.7.0-x86-mswin32-60 → 0.8.0-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +24 -1
- data/README +48 -3
- data/benchmark/depixelate.rb +632 -0
- data/benchmark/hamlet.xml +9055 -0
- data/benchmark/sock_entries.xml +507 -0
- data/benchmark/throughput.rb +39 -0
- data/benchmark/xml_benchmarks.rb +222 -0
- data/doc/classes/LibXML.html +237 -0
- data/doc/classes/LibXML/XML.html +178 -0
- data/doc/classes/{XML → LibXML/XML}/Attr.html +213 -182
- data/doc/classes/{XML → LibXML/XML}/Attributes.html +126 -54
- data/doc/classes/{XML → LibXML/XML}/Document.html +299 -297
- data/doc/classes/{XML → LibXML/XML}/Dtd.html +10 -10
- data/doc/classes/{XML/XInclude → LibXML/XML}/Error.html +4 -4
- data/doc/classes/{XML → LibXML/XML}/HTMLParser.html +40 -40
- data/doc/classes/{XML → LibXML/XML}/InputCallbacks.html +10 -10
- data/doc/classes/{XML → LibXML/XML}/NS.html +46 -46
- data/doc/classes/{XML → LibXML/XML}/Node.html +935 -788
- data/doc/classes/LibXML/XML/Node/FailedModify.html +111 -0
- data/doc/classes/{XML → LibXML/XML}/Node/Set.html +69 -68
- data/doc/classes/{XML → LibXML/XML}/Node/SetNamespace.html +4 -4
- data/doc/classes/{XML/Node/FailedModify.html → LibXML/XML/Node/UnknownType.html} +4 -4
- data/doc/classes/{XML → LibXML/XML}/Parser.html +426 -389
- data/doc/classes/{XML → LibXML/XML}/Parser/Context.html +208 -208
- data/doc/classes/{XML → LibXML/XML}/Parser/ParseError.html +4 -4
- data/doc/classes/{XML → LibXML/XML}/Reader.html +288 -287
- data/doc/classes/{XML → LibXML/XML}/SaxParser.html +52 -52
- data/doc/classes/{XML/XPath/Context.html → LibXML/XML/Schema.html} +60 -32
- data/doc/classes/{XML → LibXML/XML}/State.html +4 -4
- data/doc/classes/{XML/Node/UnknownType.html → LibXML/XML/Tree.html} +5 -5
- data/doc/classes/{XML → LibXML/XML}/XInclude.html +5 -5
- data/doc/classes/{XML → LibXML/XML/XInclude}/Error.html +5 -5
- data/doc/classes/{XML → LibXML/XML}/XMLParserOptions.html +5 -5
- data/doc/classes/{XML → LibXML/XML}/XPath.html +23 -64
- data/doc/classes/LibXML/XML/XPath/Context.html +403 -0
- data/doc/classes/{XML/XPointer/Context → LibXML/XML/XPath}/InvalidPath.html +4 -4
- data/doc/classes/LibXML/XML/XPath/Object.html +623 -0
- data/doc/classes/{XML → LibXML/XML}/XPointer.html +12 -12
- data/doc/classes/{XML → LibXML/XML}/XPointer/Context.html +5 -5
- data/doc/classes/{XML/XPath → LibXML/XML/XPointer/Context}/InvalidPath.html +5 -5
- data/doc/classes/{XML → LibXML/XML}/XPointer/InvalidExpression.html +4 -4
- data/doc/classes/XML.html +17 -123
- data/doc/created.rid +1 -1
- data/doc/files/CHANGES.html +49 -25
- data/doc/files/LICENSE.html +1 -1
- data/doc/files/README.html +79 -4
- data/doc/files/VERSION.html +2 -2
- data/doc/files/ext/libxml/cbg_c.html +1 -1
- data/doc/files/ext/libxml/libxml_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_attr_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_attributes_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_document_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_dtd_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_html_parser_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_input_cbg_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_node_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_node_set_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_ns_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_parser_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_parser_context_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_reader_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_sax_parser_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_schema_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_state_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_xinclude_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_xpath_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_xpath_context_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_xpath_object_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_xpointer_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_xpointer_context_c.html +1 -1
- data/doc/files/lib/libxml/attr_rb.html +108 -0
- data/doc/files/lib/libxml/attributes_rb.html +108 -0
- data/doc/files/lib/libxml/document_rb.html +108 -0
- data/doc/files/lib/libxml/node_rb.html +108 -0
- data/doc/files/lib/libxml/node_set_rb.html +108 -0
- data/doc/files/lib/libxml/parser_options_rb.html +107 -0
- data/doc/files/{ext/libxml/ruby_xml_tree_c.html → lib/libxml/parser_rb.html} +4 -4
- data/doc/files/lib/libxml/properties_rb.html +108 -0
- data/doc/files/lib/libxml/tree_rb.html +107 -0
- data/doc/files/lib/libxml_rb.html +12 -3
- data/doc/fr_class_index.html +34 -32
- data/doc/fr_file_index.html +9 -1
- data/doc/fr_method_index.html +362 -347
- data/ext/libxml/cbg.c +76 -76
- data/ext/libxml/libxml.c +4 -3
- data/ext/libxml/ruby_libxml.h +1 -1
- data/ext/libxml/ruby_xml_attr.c +4 -3
- data/ext/libxml/ruby_xml_attr.h +16 -16
- data/ext/libxml/ruby_xml_attributes.c +267 -266
- data/ext/libxml/ruby_xml_attributes.h +17 -17
- data/ext/libxml/ruby_xml_document.c +30 -59
- data/ext/libxml/ruby_xml_document.h +27 -27
- data/ext/libxml/ruby_xml_dtd.c +2 -1
- data/ext/libxml/ruby_xml_dtd.h +17 -17
- data/ext/libxml/ruby_xml_html_parser.c +3 -2
- data/ext/libxml/ruby_xml_html_parser.h +29 -29
- data/ext/libxml/ruby_xml_input_cbg.c +2 -1
- data/ext/libxml/ruby_xml_input_cbg.h +20 -20
- data/ext/libxml/ruby_xml_node.c +127 -470
- data/ext/libxml/ruby_xml_node.h +17 -17
- data/ext/libxml/ruby_xml_node_set.c +5 -4
- data/ext/libxml/ruby_xml_node_set.h +20 -20
- data/ext/libxml/ruby_xml_ns.c +3 -2
- data/ext/libxml/ruby_xml_ns.h +12 -12
- data/ext/libxml/ruby_xml_parser.c +20 -48
- data/ext/libxml/ruby_xml_parser.h +31 -31
- data/ext/libxml/ruby_xml_parser_context.c +3 -2
- data/ext/libxml/ruby_xml_parser_context.h +20 -20
- data/ext/libxml/ruby_xml_reader.c +2 -1
- data/ext/libxml/ruby_xml_sax_parser.c +3 -2
- data/ext/libxml/ruby_xml_sax_parser.h +56 -56
- data/ext/libxml/ruby_xml_schema.c +6 -0
- data/ext/libxml/ruby_xml_schema.h +16 -16
- data/ext/libxml/ruby_xml_state.c +13 -12
- data/ext/libxml/ruby_xml_state.h +1 -1
- data/ext/libxml/ruby_xml_xinclude.c +3 -2
- data/ext/libxml/ruby_xml_xinclude.h +13 -13
- data/ext/libxml/ruby_xml_xpath.c +35 -228
- data/ext/libxml/ruby_xml_xpath.h +22 -23
- data/ext/libxml/ruby_xml_xpath_context.c +223 -62
- data/ext/libxml/ruby_xml_xpath_context.h +15 -20
- data/ext/libxml/ruby_xml_xpath_object.c +63 -19
- data/ext/libxml/ruby_xml_xpointer.c +19 -15
- data/ext/libxml/ruby_xml_xpointer.h +27 -27
- data/ext/libxml/ruby_xml_xpointer_context.c +3 -2
- data/ext/libxml/ruby_xml_xpointer_context.h +18 -18
- data/ext/libxml/version.h +9 -9
- data/lib/libxml.rb +16 -128
- data/lib/libxml/attr.rb +45 -0
- data/lib/libxml/attributes.rb +15 -0
- data/lib/libxml/document.rb +54 -0
- data/lib/libxml/node.rb +132 -0
- data/lib/libxml/node_set.rb +27 -0
- data/lib/libxml/parser.rb +42 -0
- data/lib/libxml/parser_options.rb +25 -0
- data/lib/libxml/properties.rb +19 -0
- data/lib/libxml/tree.rb +29 -0
- data/lib/libxml_ruby.so +0 -0
- data/mingw/libxml_ruby.so +0 -0
- data/{work/task/setup → setup.rb} +1585 -1616
- data/test/gc.log +0 -0
- data/test/model/books.xml +147 -0
- data/{work/test/runner.rb → test/model/default_validation_bug.rb} +0 -0
- data/test/model/merge_bug_data.xml +58 -0
- data/test/model/rubynet.xml +78 -0
- data/test/model/rubynet_project +1 -0
- data/test/model/saxtest.xml +5 -0
- data/test/model/shiporder.xml +23 -0
- data/test/model/shiporder.xsd +31 -0
- data/test/model/simple.xml +7 -0
- data/test/model/soap.xml +27 -0
- data/test/model/xinclude.xml +5 -0
- data/test/tc_deprecated_require.rb +13 -0
- data/test/tc_xml_document.rb +57 -16
- data/test/tc_xml_document_write.rb +125 -10
- data/test/tc_xml_dtd.rb +22 -1
- data/test/tc_xml_node.rb +13 -0
- data/test/tc_xml_node_edit.rb +1 -1
- data/test/tc_xml_node_xlink.rb +1 -1
- data/test/tc_xml_parser.rb +64 -7
- data/test/tc_xml_properties.rb +42 -0
- data/test/tc_xml_reader.rb +4 -4
- data/test/tc_xml_sax_parser.rb +50 -50
- data/test/tc_xml_schema.rb +2 -2
- data/test/tc_xml_traversal.rb +220 -0
- data/test/tc_xml_xinclude.rb +12 -15
- data/test/tc_xml_xpath.rb +74 -6
- data/test/tc_xml_xpath_context.rb +72 -0
- data/test/test_suite.rb +6 -4
- data/vc/libxml_ruby.vcproj +1 -9
- metadata +92 -65
- data/doc/classes/XML/SiblingEnum.html +0 -142
- data/doc/classes/XML/Tree.html +0 -224
- data/doc/classes/XML/XPath/Object.html +0 -439
- data/ext/libxml/ruby_xml_tree.c +0 -43
- data/ext/libxml/ruby_xml_tree.h +0 -12
- data/test/ets_copy_bug2.rb +0 -21
- data/test/tc_xml_document_write2.rb +0 -54
- data/test/tc_xml_document_write3.rb +0 -96
- data/test/tc_xml_sax_parser2.rb +0 -51
- data/work/Rakefile +0 -247
- data/work/task/make +0 -26
- data/work/task/memory +0 -37
- data/work/task/rdoc +0 -39
- data/work/task/test +0 -29
- data/work/test/ets_runner.rb +0 -33
- data/work/test/libxml_test.rb +0 -3
- data/work/test/runner_ets.rb +0 -33
data/ext/libxml/ruby_xml_tree.c
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
/* $Id: ruby_xml_tree.c 300 2008-07-01 19:14:15Z cfis $ */
|
2
|
-
|
3
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
4
|
-
|
5
|
-
#include "ruby_libxml.h"
|
6
|
-
#include "ruby_xml_tree.h"
|
7
|
-
|
8
|
-
VALUE cXMLTree;
|
9
|
-
|
10
|
-
// Rdoc needs to know
|
11
|
-
#ifdef RDOC_NEVER_DEFINED
|
12
|
-
mXML = rb_define_module("XML");
|
13
|
-
#endif
|
14
|
-
|
15
|
-
void
|
16
|
-
ruby_init_xml_tree(void) {
|
17
|
-
cXMLTree = rb_define_class_under(mXML, "Tree", rb_cObject);
|
18
|
-
|
19
|
-
rb_define_const(cXMLTree, "ELEMENT_NODE", INT2FIX(XML_ELEMENT_NODE));
|
20
|
-
rb_define_const(cXMLTree, "ATTRIBUTE_NODE", INT2FIX(XML_ATTRIBUTE_NODE));
|
21
|
-
rb_define_const(cXMLTree, "TEXT_NODE", INT2FIX(XML_TEXT_NODE));
|
22
|
-
rb_define_const(cXMLTree, "CDATA_SECTION_NODE", INT2FIX(XML_CDATA_SECTION_NODE));
|
23
|
-
rb_define_const(cXMLTree, "ENTITY_REF_NODE", INT2FIX(XML_ENTITY_REF_NODE));
|
24
|
-
rb_define_const(cXMLTree, "ENTITY_NODE", INT2FIX(XML_ENTITY_NODE));
|
25
|
-
rb_define_const(cXMLTree, "PI_NODE", INT2FIX(XML_PI_NODE));
|
26
|
-
rb_define_const(cXMLTree, "COMMENT_NODE", INT2FIX(XML_COMMENT_NODE));
|
27
|
-
rb_define_const(cXMLTree, "DOCUMENT_NODE", INT2FIX(XML_DOCUMENT_NODE));
|
28
|
-
rb_define_const(cXMLTree, "DOCUMENT_TYPE_NODE", INT2FIX(XML_DOCUMENT_TYPE_NODE));
|
29
|
-
rb_define_const(cXMLTree, "DOCUMENT_FRAG_NODE", INT2FIX(XML_DOCUMENT_FRAG_NODE));
|
30
|
-
rb_define_const(cXMLTree, "NOTATION_NODE", INT2FIX(XML_NOTATION_NODE));
|
31
|
-
rb_define_const(cXMLTree, "HTML_DOCUMENT_NODE", INT2FIX(XML_HTML_DOCUMENT_NODE));
|
32
|
-
rb_define_const(cXMLTree, "DTD_NODE", INT2FIX(XML_DTD_NODE));
|
33
|
-
rb_define_const(cXMLTree, "ELEMENT_DECL", INT2FIX(XML_ELEMENT_DECL));
|
34
|
-
rb_define_const(cXMLTree, "ATTRIBUTE_DECL", INT2FIX(XML_ATTRIBUTE_DECL));
|
35
|
-
rb_define_const(cXMLTree, "ENTITY_DECL", INT2FIX(XML_ENTITY_DECL));
|
36
|
-
rb_define_const(cXMLTree, "NAMESPACE_DECL", INT2FIX(XML_NAMESPACE_DECL));
|
37
|
-
rb_define_const(cXMLTree, "XINCLUDE_START", INT2FIX(XML_XINCLUDE_START));
|
38
|
-
rb_define_const(cXMLTree, "XINCLUDE_END", INT2FIX(XML_XINCLUDE_END));
|
39
|
-
|
40
|
-
#ifdef LIBXML_DOCB_ENABLED
|
41
|
-
rb_define_const(cXMLTree, "DOCB_DOCUMENT_NODE", INT2FIX(XML_DOCB_DOCUMENT_NODE));
|
42
|
-
#endif
|
43
|
-
}
|
data/ext/libxml/ruby_xml_tree.h
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
/* $Id: ruby_xml_tree.h 39 2006-02-21 20:40:16Z roscopeco $ */
|
2
|
-
|
3
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
4
|
-
|
5
|
-
#ifndef __RUBY_XML_TREE__
|
6
|
-
#define __RUBY_XML_TREE__
|
7
|
-
|
8
|
-
extern VALUE cXMLTree;
|
9
|
-
|
10
|
-
void ruby_init_xml_tree(void);
|
11
|
-
|
12
|
-
#endif
|
data/test/ets_copy_bug2.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'libxml'
|
2
|
-
|
3
|
-
# This will cause a segmentation fault by
|
4
|
-
# freeing a xml_node_object twice. Haven't
|
5
|
-
# figured out why this is happening yet.
|
6
|
-
2.times do
|
7
|
-
doc = XML::Document.new('1.0')
|
8
|
-
doc.root = XML::Node.new("header")
|
9
|
-
|
10
|
-
doc2 = XML::Document.new('1.0')
|
11
|
-
doc2.root = XML::Node.new("footer")
|
12
|
-
|
13
|
-
4000.times do
|
14
|
-
doc.root << doc2.root.copy(false)
|
15
|
-
end
|
16
|
-
|
17
|
-
nodes = doc.find('/header/footer')
|
18
|
-
nodes = nil
|
19
|
-
|
20
|
-
end
|
21
|
-
puts 'hi'
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require "libxml"
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
class TC_XML_Document_Write2 < Test::Unit::TestCase
|
5
|
-
def setup()
|
6
|
-
@doc = XML::Document.new('1.0')
|
7
|
-
assert_instance_of(XML::Document, @doc)
|
8
|
-
end
|
9
|
-
|
10
|
-
def teardown()
|
11
|
-
@doc = nil
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_ruby_xml_document_write_root()
|
15
|
-
xml = "<?xml version=\"1.0\"?>\n<rubynet/>\n"
|
16
|
-
@doc.root = XML::Node.new('rubynet')
|
17
|
-
assert_instance_of(XML::Node, @doc.root)
|
18
|
-
assert_instance_of(XML::Document, @doc.root.doc)
|
19
|
-
assert_equal(xml, @doc.to_s)
|
20
|
-
end # def test_ruby_xml_document_write_root()
|
21
|
-
|
22
|
-
def test_ruby_xml_document_write_root2()
|
23
|
-
xml = "<?xml version=\"1.0\"?>\n<rubynet/>\n"
|
24
|
-
@doc.root = XML::Node.new('rubynet')
|
25
|
-
assert_instance_of(XML::Node, @doc.root)
|
26
|
-
assert_instance_of(XML::Document, @doc.root.doc)
|
27
|
-
assert_equal(xml, @doc.to_s(false))
|
28
|
-
end # def test_ruby_xml_document_write_root()
|
29
|
-
|
30
|
-
def test_ruby_xml_document_write_root3()
|
31
|
-
xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rubynet/>\n"
|
32
|
-
@doc.root = XML::Node.new('rubynet')
|
33
|
-
@doc.encoding = 'UTF-8'
|
34
|
-
assert_instance_of(XML::Node, @doc.root)
|
35
|
-
assert_instance_of(XML::Document, @doc.root.doc)
|
36
|
-
assert_equal(xml, @doc.to_s)
|
37
|
-
end # def test_ruby_xml_document_write_root()
|
38
|
-
|
39
|
-
def test_ruby_xml_document_write_root4()
|
40
|
-
xml = "<?xml version=\"1.0\"?>\n<rubynet/>\n"
|
41
|
-
@doc.root = XML::Node.new('rubynet')
|
42
|
-
assert_instance_of(XML::Node, @doc.root)
|
43
|
-
assert_instance_of(XML::Document, @doc.root.doc)
|
44
|
-
assert_equal(xml, @doc.to_s(false))
|
45
|
-
end # def test_ruby_xml_document_write_root()
|
46
|
-
|
47
|
-
def test_ruby_xml_document_write_root5()
|
48
|
-
xml = "<?xml version=\"1.0\"?>\n<rubynet/>\n"
|
49
|
-
@doc.root = XML::Node.new('rubynet')
|
50
|
-
assert_instance_of(XML::Node, @doc.root)
|
51
|
-
assert_instance_of(XML::Document, @doc.root.doc)
|
52
|
-
assert_equal(xml, @doc.to_s(true))
|
53
|
-
end # def test_ruby_xml_document_write_root()
|
54
|
-
end
|
@@ -1,96 +0,0 @@
|
|
1
|
-
require "libxml"
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
class TC_XML_Document_Write3 < Test::Unit::TestCase
|
5
|
-
def setup()
|
6
|
-
@doc = XML::Document.new('1.0')
|
7
|
-
assert_instance_of(XML::Document, @doc)
|
8
|
-
@doc.root = XML::Node.new('rubynet')
|
9
|
-
end
|
10
|
-
|
11
|
-
def teardown()
|
12
|
-
@doc = nil
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_ruby_xml_document_write_child()
|
16
|
-
xml = "<?xml version=\"1.0\"?>\n<rubynet>\n <pkg/>\n</rubynet>\n"
|
17
|
-
@doc.root.child = XML::Node.new('pkg')
|
18
|
-
assert_equal(xml, @doc.to_s)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_ruby_xml_document_write_content_append()
|
22
|
-
xml = "<?xml version=\"1.0\"?>\n"
|
23
|
-
xml << "<rubynet>\n"
|
24
|
-
xml << " <pkg>\n"
|
25
|
-
xml << " <meta>\n"
|
26
|
-
xml << " <pkgname>libxml</pkgname>\n"
|
27
|
-
xml << " </meta>\n"
|
28
|
-
xml << " </pkg>\n"
|
29
|
-
xml << "</rubynet>\n"
|
30
|
-
pkg = @doc.root.child = XML::Node.new('pkg')
|
31
|
-
meta = pkg.child = XML::Node.new('meta')
|
32
|
-
assert_equal meta, meta << (pkgname = XML::Node.new('pkgname'))
|
33
|
-
pkgname << 'libxml'
|
34
|
-
assert_equal(xml, @doc.to_s)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_ruby_xml_document_write_node_search_href()
|
38
|
-
prefix = 'xlink'
|
39
|
-
uri = 'http://www.rubynet.org'
|
40
|
-
xml = "<?xml version=\"1.0\"?>\n"
|
41
|
-
xml << "<rubynet xmlns:#{prefix}=\"#{uri}\">\n"
|
42
|
-
xml << " <pkg/>\n"
|
43
|
-
xml << "</rubynet>\n"
|
44
|
-
@doc = XML::Parser.string(xml).parse
|
45
|
-
assert_equal(xml, @doc.to_s)
|
46
|
-
ns = @doc.root.search_href(uri)
|
47
|
-
assert_instance_of(XML::NS, ns)
|
48
|
-
assert_equal(uri, ns.href)
|
49
|
-
assert_equal(prefix, ns.prefix)
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_ruby_xml_document_write_sibling()
|
53
|
-
xml = "<?xml version=\"1.0\"?>\n<rubynet>\n <pkg/>\n <pkg2/>\n</rubynet>\n"
|
54
|
-
child = @doc.root.child = XML::Node.new('pkg')
|
55
|
-
assert_instance_of(XML::Node, child)
|
56
|
-
child.sibling = XML::Node.new('pkg2')
|
57
|
-
assert_equal(xml, @doc.to_s)
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_ruby_xml_document_write_set_doc_property()
|
61
|
-
xml = "<?xml version=\"1.0\"?>\n"
|
62
|
-
xml << "<rubynet xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n"
|
63
|
-
xml << " <pkg/>\n"
|
64
|
-
xml << "</rubynet>\n"
|
65
|
-
@doc.root['xmlns:xlink'] = "http://www.w3.org/1999/xlink"
|
66
|
-
pkg = @doc.root.child = XML::Node.new('pkg')
|
67
|
-
assert_equal(xml, @doc.to_s)
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_ruby_xml_document_write_set_node_base()
|
71
|
-
xml = "<?xml version=\"1.0\"?>\n"
|
72
|
-
xml << "<rubynet>\n"
|
73
|
-
xml << " <pkg xml:base=\"http://www.rubynet.org/\"/>\n"
|
74
|
-
xml << "</rubynet>\n"
|
75
|
-
pkg = @doc.root.child = XML::Node.new('pkg')
|
76
|
-
pkg.base = 'http://www.rubynet.org/'
|
77
|
-
assert_equal(xml, @doc.to_s)
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_ruby_xml_document_write_set_node_property()
|
81
|
-
xml = "<?xml version=\"1.0\"?>\n"
|
82
|
-
xml << "<rubynet xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n"
|
83
|
-
xml << " <pkg version=\"1.0\">\n"
|
84
|
-
xml << " <meta>\n"
|
85
|
-
xml << " <pkgname>libxml</pkgname>\n"
|
86
|
-
xml << " </meta>\n"
|
87
|
-
xml << " </pkg>\n"
|
88
|
-
xml << "</rubynet>\n"
|
89
|
-
@doc.root['xmlns:xlink'] = "http://www.w3.org/1999/xlink"
|
90
|
-
pkg = @doc.root.child = XML::Node.new('pkg')
|
91
|
-
pkg['version'] = '1.0'
|
92
|
-
meta = pkg.child = XML::Node.new('meta')
|
93
|
-
pkgname = meta.child = XML::Node.new('pkgname', 'libxml')
|
94
|
-
assert_equal(xml, @doc.to_s)
|
95
|
-
end
|
96
|
-
end
|
data/test/tc_xml_sax_parser2.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'libxml'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
# TODO this is woefully inadequate
|
5
|
-
|
6
|
-
class TC_XML_SaxParser2 < Test::Unit::TestCase
|
7
|
-
def setup()
|
8
|
-
@xp = XML::SaxParser.new
|
9
|
-
end
|
10
|
-
|
11
|
-
def teardown()
|
12
|
-
@xp = nil
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_string_without_callbacks
|
16
|
-
@xp.string = File.read(File.join(File.dirname(__FILE__), 'model/saxtest.xml'))
|
17
|
-
assert_equal true, @xp.parse
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_file_without_callbacks
|
21
|
-
@xp.filename = File.join(File.dirname(__FILE__), 'model/saxtest.xml')
|
22
|
-
assert_equal true, @xp.parse
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_callbacks_with_string
|
26
|
-
@xp.callbacks = TestCaseCallbacks.new
|
27
|
-
@xp.string = File.read(File.join(File.dirname(__FILE__), 'model/saxtest.xml'))
|
28
|
-
do_test
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_callbacks_with_file
|
32
|
-
@xp.callbacks = TestCaseCallbacks.new
|
33
|
-
@xp.filename = File.join(File.dirname(__FILE__), 'model/saxtest.xml')
|
34
|
-
do_test
|
35
|
-
end
|
36
|
-
|
37
|
-
def do_test
|
38
|
-
@xp.parse
|
39
|
-
|
40
|
-
assert_equal [1], @xp.callbacks.test[:startdoc]
|
41
|
-
assert_equal [[2,'test',{'uga'=>'booga','foo'=>'bar'}],[3,'fixnum',{}],[6,'fixnum',{}]],
|
42
|
-
@xp.callbacks.test[:startel]
|
43
|
-
assert_equal [[4,'one'],[7,'two'],[9,"\n "],[11,"\n "],[13,"\n "],[15,"\n"]],
|
44
|
-
@xp.callbacks.test[:chars]
|
45
|
-
assert_equal [[10, ' msg ']], @xp.callbacks.test[:comment]
|
46
|
-
assert_equal [[12, 'custom', 'foo="bar"']], @xp.callbacks.test[:pinstr]
|
47
|
-
assert_equal [[14, 'here it goes']], @xp.callbacks.test[:cdata]
|
48
|
-
assert_equal [[5,'fixnum'],[8,'fixnum'],[16,'test']], @xp.callbacks.test[:endel]
|
49
|
-
assert_equal [17], @xp.callbacks.test[:enddoc]
|
50
|
-
end
|
51
|
-
end # TC_XML_Sax_Parser
|
data/work/Rakefile
DELETED
@@ -1,247 +0,0 @@
|
|
1
|
-
require 'net/ftp'
|
2
|
-
require 'rake/clean'
|
3
|
-
require 'rake/testtask'
|
4
|
-
require 'rake/rdoctask'
|
5
|
-
require 'rake/gempackagetask'
|
6
|
-
|
7
|
-
CLEAN.include '**/*.o'
|
8
|
-
CLEAN.include '**/*.so'
|
9
|
-
|
10
|
-
CLOBBER.include 'doc/rdoc'
|
11
|
-
CLOBBER.include '**/*.log'
|
12
|
-
CLOBBER.include '**/Makefile'
|
13
|
-
CLOBBER.include '**/extconf.h'
|
14
|
-
|
15
|
-
desc "Default task (compile, test and memory test)"
|
16
|
-
task :default => [:compile, :test, :memory]
|
17
|
-
|
18
|
-
desc "Compile extensions."
|
19
|
-
task :compile do
|
20
|
-
sh "task/make"
|
21
|
-
end
|
22
|
-
|
23
|
-
desc "Run unit test suite."
|
24
|
-
task :test do
|
25
|
-
sh "task/test"
|
26
|
-
end
|
27
|
-
|
28
|
-
desc "Run memory test suite."
|
29
|
-
task :memory do
|
30
|
-
sh "task/memory"
|
31
|
-
end
|
32
|
-
|
33
|
-
desc "Generate rdoc documentation."
|
34
|
-
task :rdoc do
|
35
|
-
sh "task/rdoc"
|
36
|
-
end
|
37
|
-
|
38
|
-
desc "Install to local site directory."
|
39
|
-
task :setup do
|
40
|
-
sh "task/setup"
|
41
|
-
end
|
42
|
-
|
43
|
-
__END__
|
44
|
-
|
45
|
-
# THIS IS THE OLD RAKEFILE. WE LEAVE IT HERE FOR THE TIME BEING
|
46
|
-
# SO WE CAN REFERENCE IT TO IMPROVE THE NEW SCRIPTS IF NEEDED.
|
47
|
-
|
48
|
-
# Determine the current version of the software
|
49
|
-
if File.read('ext/xml/libxml.h') =~ /\s*RUBY_LIBXML_VERSION\s*['"](\d.+)['"]/
|
50
|
-
CURRENT_VERSION = $1
|
51
|
-
else
|
52
|
-
CURRENT_VERSION = "0.0.0"
|
53
|
-
end
|
54
|
-
|
55
|
-
if ENV['REL']
|
56
|
-
PKG_VERSION = ENV['REL']
|
57
|
-
else
|
58
|
-
PKG_VERSION = CURRENT_VERSION
|
59
|
-
end
|
60
|
-
|
61
|
-
task :test_ver do
|
62
|
-
puts PKG_VERSION
|
63
|
-
end
|
64
|
-
|
65
|
-
# Make tasks -----------------------------------------------------
|
66
|
-
MAKECMD = ENV['MAKE_CMD'] || 'make'
|
67
|
-
MAKEOPTS = ENV['MAKE_OPTS'] || ''
|
68
|
-
|
69
|
-
file 'ext/xml/Makefile' => 'ext/xml/extconf.rb' do
|
70
|
-
Dir.chdir('ext/xml') do
|
71
|
-
ruby 'extconf.rb'
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def make(target = '')
|
76
|
-
Dir.chdir('ext/xml') do
|
77
|
-
pid = fork { exec "#{MAKECMD} #{MAKEOPTS} #{target}" }
|
78
|
-
Process.waitpid pid
|
79
|
-
end
|
80
|
-
$?.exitstatus
|
81
|
-
end
|
82
|
-
|
83
|
-
# Let make handle dependencies between c/o/so - we'll just run it.
|
84
|
-
file 'ext/xml/libxml.so' => 'ext/xml/Makefile' do
|
85
|
-
m = make
|
86
|
-
fail "Make failed (status #{m})" unless m == 0
|
87
|
-
end
|
88
|
-
|
89
|
-
desc "Compile the shared object"
|
90
|
-
task :compile => 'ext/xml/libxml.so'
|
91
|
-
|
92
|
-
desc "Install to your site_ruby directory"
|
93
|
-
task :install => :compile do
|
94
|
-
m = make 'install'
|
95
|
-
fail "Make install failed (status #{m})" unless m == 0
|
96
|
-
end
|
97
|
-
|
98
|
-
# Test Tasks ---------------------------------------------------------
|
99
|
-
task :ta => :alltests
|
100
|
-
task :tu => :unittests
|
101
|
-
task :test => :unittests
|
102
|
-
task :tm => :memtests
|
103
|
-
|
104
|
-
Rake::TestTask.new(:alltests) do |t|
|
105
|
-
t.test_files = FileList[
|
106
|
-
'tests/runner.rb',
|
107
|
-
'tests/contrib/*.rb',
|
108
|
-
]
|
109
|
-
t.verbose = true
|
110
|
-
end
|
111
|
-
|
112
|
-
Rake::TestTask.new(:unittests) do |t|
|
113
|
-
t.test_files = FileList['tests/runner.rb']
|
114
|
-
t.verbose = false
|
115
|
-
end
|
116
|
-
|
117
|
-
Rake::TestTask.new(:memtests) do |t|
|
118
|
-
t.test_files = FileList[
|
119
|
-
'tests/runner_ets.rb'
|
120
|
-
]
|
121
|
-
t.verbose = true
|
122
|
-
end
|
123
|
-
|
124
|
-
#Rake::TestTask.new(:funtests) do |t|
|
125
|
-
# t.test_files = FileList['test/fun*.rb']
|
126
|
-
#t.warning = true
|
127
|
-
#t.warning = true
|
128
|
-
#end
|
129
|
-
|
130
|
-
task :unittests => :compile
|
131
|
-
task :alltests => :compile
|
132
|
-
task :memtests => :compile
|
133
|
-
|
134
|
-
# RDoc Tasks ---------------------------------------------------------
|
135
|
-
desc "Create the RDOC documentation tree"
|
136
|
-
rd = Rake::RDocTask.new(:doc) do |rdoc|
|
137
|
-
rdoc.rdoc_dir = 'html'
|
138
|
-
rdoc.title = "Libxml-Ruby API"
|
139
|
-
rdoc.options << '--main' << 'README'
|
140
|
-
rdoc.rdoc_files.include('README', 'LICENSE', 'TODO')
|
141
|
-
rdoc.rdoc_files.include('ext/xml/ruby_xml*.c', 'ext/xml/libxml.rb')
|
142
|
-
rdoc.rdoc_files.include('*.rdoc')
|
143
|
-
end
|
144
|
-
|
145
|
-
desc "Publish the RDoc documentation to project web site"
|
146
|
-
task :pubdoc => [ :doc ] do
|
147
|
-
unless ENV['RUBYFORGE_ACCT']
|
148
|
-
raise "Need to set RUBYFORGE_ACCT to your rubyforge.org user name (e.g. 'fred')"
|
149
|
-
end
|
150
|
-
require 'rake/contrib/sshpublisher'
|
151
|
-
Rake::SshDirPublisher.new(
|
152
|
-
"#{ENV['RUBYFORGE_ACCT']}@rubyforge.org",
|
153
|
-
"/var/www/gforge-projects/libxml/doc",
|
154
|
-
"html"
|
155
|
-
).upload
|
156
|
-
end
|
157
|
-
|
158
|
-
# Packaging / Version number tasks -----------------------------------
|
159
|
-
# Used during release packaging if a REL is supplied
|
160
|
-
task :update_version do
|
161
|
-
unless PKG_VERSION == CURRENT_VERSION
|
162
|
-
pkg_vernum = PKG_VERSION.tr('.','').sub(/^0*/,'')
|
163
|
-
pkg_vernum << '0' until pkg_vernum.length > 2
|
164
|
-
|
165
|
-
File.open('ext/xml/libxml.h.new','w+') do |f|
|
166
|
-
maj, min, mic, patch = /(\d+)\.(\d+)(?:\.(\d+))?(?:\.(\d+))?/.match(PKG_VERSION).captures
|
167
|
-
f << File.read('ext/xml/libxml.h').
|
168
|
-
gsub(/RUBY_LIBXML_VERSION\s+"(\d.+)"/) { "RUBY_LIBXML_VERSION \"#{PKG_VERSION}\"" }.
|
169
|
-
gsub(/RUBY_LIBXML_VERNUM\s+\d+/) { "RUBY_LIBXML_VERNUM #{pkg_vernum}" }.
|
170
|
-
gsub(/RUBY_LIBXML_VER_MAJ\s+\d+/) { "RUBY_LIBXML_VER_MAJ #{maj}" }.
|
171
|
-
gsub(/RUBY_LIBXML_VER_MIN\s+\d+/) { "RUBY_LIBXML_VER_MIN #{min}" }.
|
172
|
-
gsub(/RUBY_LIBXML_VER_MIC\s+\d+/) { "RUBY_LIBXML_VER_MIC #{mic || 0}" }.
|
173
|
-
gsub(/RUBY_LIBXML_VER_PATCH\s+\d+/) { "RUBY_LIBXML_VER_PATCH #{patch || 0}" }
|
174
|
-
end
|
175
|
-
mv('ext/xml/libxml.h.new', 'ext/xml/libxml.h')
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
PKG_FILES = FileList[
|
180
|
-
'ext/xml/*.rb',
|
181
|
-
'ext/xml/extconf.rb',
|
182
|
-
'[A-Z]*',
|
183
|
-
'ext/xml/*.c',
|
184
|
-
'ext/xml/*.inc',
|
185
|
-
'ext/xml/ruby_xml*.h',
|
186
|
-
'ext/xml/libxml.h',
|
187
|
-
'tests/**/*',
|
188
|
-
]
|
189
|
-
|
190
|
-
if ! defined?(Gem)
|
191
|
-
warn "Package Target requires RubyGEMs"
|
192
|
-
else
|
193
|
-
spec = Gem::Specification.new do |s|
|
194
|
-
|
195
|
-
#### Basic information.
|
196
|
-
|
197
|
-
s.name = 'libxml-ruby'
|
198
|
-
s.version = PKG_VERSION
|
199
|
-
s.summary = "LibXML2 bindings for Ruby"
|
200
|
-
s.description = <<-EOF
|
201
|
-
C-language bindings for Gnome LibXML2 and Ruby. Supports
|
202
|
-
high-speed, feature rich XML processing in Ruby apps.
|
203
|
-
EOF
|
204
|
-
s.extensions = 'ext/xml/extconf.rb'
|
205
|
-
|
206
|
-
#### Which files are to be included in this gem?
|
207
|
-
|
208
|
-
s.files = PKG_FILES.to_a
|
209
|
-
|
210
|
-
#### Load-time details
|
211
|
-
s.require_path = 'lib'
|
212
|
-
|
213
|
-
#### Documentation and testing.
|
214
|
-
s.has_rdoc = true
|
215
|
-
s.extra_rdoc_files = rd.rdoc_files.to_a
|
216
|
-
s.rdoc_options <<
|
217
|
-
'--title' << 'Libxml-Ruby API' <<
|
218
|
-
'--main' << 'README'
|
219
|
-
|
220
|
-
s.test_files = Dir.glob('tests/*runner.rb')
|
221
|
-
|
222
|
-
#### Author and project details.
|
223
|
-
|
224
|
-
s.author = "Sean Chittenden"
|
225
|
-
s.email = "libxml-devel@rubyforge.org"
|
226
|
-
s.homepage = "http://libxml.rubyforge.org"
|
227
|
-
s.rubyforge_project = "libxml"
|
228
|
-
end
|
229
|
-
|
230
|
-
# Quick fix for Ruby 1.8.3 / YAML bug
|
231
|
-
if (RUBY_VERSION == '1.8.3')
|
232
|
-
def spec.to_yaml
|
233
|
-
out = super
|
234
|
-
out = '--- ' + out unless out =~ /^---/
|
235
|
-
out
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
package_task = Rake::GemPackageTask.new(spec) do |pkg|
|
240
|
-
pkg.need_zip = true
|
241
|
-
pkg.need_tar_gz = true
|
242
|
-
pkg.package_dir = 'pkg'
|
243
|
-
end
|
244
|
-
|
245
|
-
desc "Build a full release"
|
246
|
-
task :release => [:clobber, :update_version, :compile, :test, :package]
|
247
|
-
end
|