libxml-ruby 0.8.3-x86-mswin32-60 → 0.9.0-x86-mswin32-60
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.
- data/CHANGES +18 -0
- data/RAKEFILE +15 -39
- data/README +48 -47
- data/ext/libxml/libxml.c +847 -22
- data/ext/libxml/ruby_libxml.h +71 -95
- data/ext/libxml/ruby_xml_attr.c +500 -500
- data/ext/libxml/ruby_xml_attributes.c +1 -1
- data/ext/libxml/ruby_xml_document.c +1144 -1135
- data/ext/libxml/ruby_xml_document.h +4 -11
- data/ext/libxml/ruby_xml_dtd.c +27 -0
- data/ext/libxml/ruby_xml_encoding.c +164 -0
- data/ext/libxml/ruby_xml_encoding.h +13 -0
- data/ext/libxml/ruby_xml_error.c +941 -0
- data/ext/libxml/ruby_xml_error.h +13 -0
- data/ext/libxml/ruby_xml_html_parser.c +71 -387
- data/ext/libxml/ruby_xml_html_parser.h +1 -17
- data/ext/libxml/ruby_xml_input.c +179 -0
- data/ext/libxml/ruby_xml_input.h +18 -0
- data/ext/libxml/ruby_xml_input_cbg.c +17 -3
- data/ext/libxml/ruby_xml_node.c +1566 -1582
- data/ext/libxml/ruby_xml_node.h +1 -4
- data/ext/libxml/ruby_xml_ns.c +14 -3
- data/ext/libxml/ruby_xml_parser.c +164 -1398
- data/ext/libxml/ruby_xml_parser.h +5 -17
- data/ext/libxml/ruby_xml_parser_context.c +131 -169
- data/ext/libxml/ruby_xml_parser_context.h +2 -9
- data/ext/libxml/ruby_xml_reader.c +910 -945
- data/ext/libxml/ruby_xml_relaxng.c +32 -3
- data/ext/libxml/ruby_xml_sax_parser.c +106 -364
- data/ext/libxml/ruby_xml_sax_parser.h +1 -37
- data/ext/libxml/ruby_xml_schema.c +174 -145
- data/ext/libxml/ruby_xml_xinclude.c +9 -5
- data/ext/libxml/ruby_xml_xpath.c +25 -6
- data/ext/libxml/ruby_xml_xpath.h +1 -2
- data/ext/libxml/ruby_xml_xpath_context.c +17 -19
- data/ext/libxml/ruby_xml_xpath_object.c +60 -56
- data/ext/libxml/ruby_xml_xpointer.c +11 -5
- data/ext/libxml/sax_parser_callbacks.inc +42 -37
- data/ext/libxml/version.h +3 -3
- data/ext/mingw/Rakefile +20 -27
- data/ext/mingw/build.rake +41 -0
- data/{lib → ext/mingw}/libiconv-2.dll +0 -0
- data/ext/mingw/libxml2-2.dll +0 -0
- data/ext/mingw/libxml_ruby.dll.a +0 -0
- data/ext/mingw/libxml_ruby.so +0 -0
- data/ext/vc/libxml_ruby.vcproj +23 -15
- data/lib/libxml.rb +8 -2
- data/lib/libxml/document.rb +16 -4
- data/lib/libxml/error.rb +84 -0
- data/lib/libxml/hpricot.rb +76 -0
- data/lib/libxml/html_parser.rb +61 -0
- data/lib/libxml/node.rb +36 -25
- data/lib/libxml/parser.rb +312 -33
- data/lib/libxml/parser_context.rb +17 -0
- data/lib/libxml/properties.rb +15 -2
- data/lib/libxml/reader.rb +15 -0
- data/lib/libxml/sax_callbacks.rb +179 -0
- data/lib/libxml/sax_parser.rb +42 -0
- data/lib/libxml/tree.rb +1 -2
- data/lib/libxml/xpath_object.rb +12 -0
- data/test/model/atom.xml +4 -0
- data/test/tc_attributes.rb +43 -19
- data/test/tc_document.rb +1 -1
- data/test/tc_document_write.rb +15 -8
- data/test/tc_dtd.rb +36 -20
- data/test/tc_encoding.rb +13 -0
- data/test/tc_error.rb +136 -0
- data/test/tc_node.rb +2 -3
- data/test/tc_node_copy.rb +1 -1
- data/test/tc_node_edit.rb +6 -0
- data/test/tc_ns.rb +18 -0
- data/test/tc_parser.rb +113 -228
- data/test/tc_parser_context.rb +1 -2
- data/test/tc_reader.rb +24 -14
- data/test/tc_relaxng.rb +18 -6
- data/test/tc_sax_parser.rb +48 -13
- data/test/tc_schema.rb +20 -8
- data/test/tc_well_formed.rb +2 -1
- data/test/tc_xml.rb +212 -0
- data/test/tc_xpath.rb +60 -46
- data/test/tc_xpointer.rb +7 -11
- data/test/test_suite.rb +4 -3
- metadata +32 -115
- data/doc/rdoc/classes/LibXML.html +0 -241
- data/doc/rdoc/classes/LibXML/XML.html +0 -185
- data/doc/rdoc/classes/LibXML/XML/Attr.html +0 -1010
- data/doc/rdoc/classes/LibXML/XML/Attributes.html +0 -526
- data/doc/rdoc/classes/LibXML/XML/Document.html +0 -1489
- data/doc/rdoc/classes/LibXML/XML/Dtd.html +0 -213
- data/doc/rdoc/classes/LibXML/XML/Error.html +0 -117
- data/doc/rdoc/classes/LibXML/XML/HTMLParser.html +0 -348
- data/doc/rdoc/classes/LibXML/XML/InputCallbacks.html +0 -160
- data/doc/rdoc/classes/LibXML/XML/NS.html +0 -381
- data/doc/rdoc/classes/LibXML/XML/Node.html +0 -3396
- data/doc/rdoc/classes/LibXML/XML/Node/FailedModify.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/Node/Set.html +0 -440
- data/doc/rdoc/classes/LibXML/XML/Node/SetNamespace.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/Node/UnknownType.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/Parser.html +0 -2239
- data/doc/rdoc/classes/LibXML/XML/Parser/Context.html +0 -1255
- data/doc/rdoc/classes/LibXML/XML/Parser/ParseError.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/Reader.html +0 -2264
- data/doc/rdoc/classes/LibXML/XML/RelaxNG.html +0 -237
- data/doc/rdoc/classes/LibXML/XML/SaxParser.html +0 -415
- data/doc/rdoc/classes/LibXML/XML/Schema.html +0 -308
- data/doc/rdoc/classes/LibXML/XML/State.html +0 -124
- data/doc/rdoc/classes/LibXML/XML/Tree.html +0 -111
- data/doc/rdoc/classes/LibXML/XML/XInclude.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/XInclude/Error.html +0 -117
- data/doc/rdoc/classes/LibXML/XML/XMLParserOptions.html +0 -198
- data/doc/rdoc/classes/LibXML/XML/XPath.html +0 -184
- data/doc/rdoc/classes/LibXML/XML/XPath/Context.html +0 -404
- data/doc/rdoc/classes/LibXML/XML/XPath/InvalidPath.html +0 -172
- data/doc/rdoc/classes/LibXML/XML/XPath/Object.html +0 -627
- data/doc/rdoc/classes/LibXML/XML/XPointer.html +0 -170
- data/doc/rdoc/classes/LibXML/XML/XPointer/Context.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/XPointer/Context/InvalidPath.html +0 -117
- data/doc/rdoc/classes/LibXML/XML/XPointer/InvalidExpression.html +0 -124
- data/doc/rdoc/classes/singleton.html +0 -114
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/CHANGES.html +0 -442
- data/doc/rdoc/files/LICENSE.html +0 -133
- data/doc/rdoc/files/README.html +0 -388
- data/doc/rdoc/files/VERSION.html +0 -107
- data/doc/rdoc/files/ext/libxml/cbg_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/libxml_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_attr_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_attributes_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_document_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_dtd_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_html_parser_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_input_cbg_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_node_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_node_set_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_ns_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_parser_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_parser_context_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_reader_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_relaxng_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_sax_parser_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_schema_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_state_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xinclude_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_context_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_object_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpointer_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpointer_context_c.html +0 -101
- data/doc/rdoc/files/lib/libxml/attr_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/attributes_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/document_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/node_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/node_set_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/parser_options_rb.html +0 -107
- data/doc/rdoc/files/lib/libxml/parser_rb.html +0 -101
- data/doc/rdoc/files/lib/libxml/properties_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/tree_rb.html +0 -107
- data/doc/rdoc/files/lib/libxml_rb.html +0 -124
- data/doc/rdoc/files/lib/xml/libxml_rb.html +0 -124
- data/doc/rdoc/files/lib/xml_rb.html +0 -134
- data/doc/rdoc/fr_class_index.html +0 -62
- data/doc/rdoc/fr_file_index.html +0 -66
- data/doc/rdoc/fr_method_index.html +0 -392
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
- data/ext/libxml/ruby_xml_node_set.c +0 -172
- data/ext/libxml/ruby_xml_node_set.h +0 -20
- data/ext/libxml/ruby_xml_xpointer_context.c +0 -22
- data/ext/libxml/ruby_xml_xpointer_context.h +0 -18
- data/lib/libxml/node_set.rb +0 -27
- data/lib/libxml2-2.dll +0 -0
- data/lib/libxml_ruby.dll.a +0 -0
- data/lib/libxml_ruby.so +0 -0
- data/test/tc_node_set.rb +0 -24
- data/test/tc_node_set2.rb +0 -37
data/doc/rdoc/files/LICENSE.html
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>File: LICENSE</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="fileHeader">
|
50
|
-
<h1>LICENSE</h1>
|
51
|
-
<table class="header-table">
|
52
|
-
<tr class="top-aligned-row">
|
53
|
-
<td><strong>Path:</strong></td>
|
54
|
-
<td>LICENSE
|
55
|
-
</td>
|
56
|
-
</tr>
|
57
|
-
<tr class="top-aligned-row">
|
58
|
-
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Fri Jul 18 21:38:00 -0600 2008</td>
|
60
|
-
</tr>
|
61
|
-
</table>
|
62
|
-
</div>
|
63
|
-
<!-- banner header -->
|
64
|
-
|
65
|
-
<div id="bodyContent">
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
<div id="contextContent">
|
70
|
-
|
71
|
-
<div id="description">
|
72
|
-
<p>
|
73
|
-
<a href="../classes/LibXML.html">LibXML</a>-Ruby
|
74
|
-
</p>
|
75
|
-
<pre>
|
76
|
-
Copyright (c) 2002-2006 Sean Chittenden <sean@chittenden.org> and contributors
|
77
|
-
Copyright (c) 2001 Wai-Sun "Squidster" Chia <waisun.chia@compaq.com>
|
78
|
-
</pre>
|
79
|
-
<p>
|
80
|
-
Permission is hereby granted, free of charge, to any person obtaining a
|
81
|
-
copy of this software and associated documentation files (the
|
82
|
-
"Software"), to deal in the Software without restriction,
|
83
|
-
including without limitation the rights to use, copy, modify, merge,
|
84
|
-
publish, distribute, sublicense, and/or sell copies of the Software, and to
|
85
|
-
permit persons to whom the Software is furnished to do so, subject to the
|
86
|
-
following conditions:
|
87
|
-
</p>
|
88
|
-
<p>
|
89
|
-
The above copyright notice and this permission notice shall be included in
|
90
|
-
all copies or substantial portions of the Software.
|
91
|
-
</p>
|
92
|
-
<p>
|
93
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
94
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
95
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
96
|
-
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
97
|
-
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
98
|
-
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
99
|
-
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
100
|
-
</p>
|
101
|
-
|
102
|
-
</div>
|
103
|
-
|
104
|
-
|
105
|
-
</div>
|
106
|
-
|
107
|
-
|
108
|
-
</div>
|
109
|
-
|
110
|
-
|
111
|
-
<!-- if includes -->
|
112
|
-
|
113
|
-
<div id="section">
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
<!-- if method_list -->
|
123
|
-
|
124
|
-
|
125
|
-
</div>
|
126
|
-
|
127
|
-
|
128
|
-
<div id="validator-badges">
|
129
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
130
|
-
</div>
|
131
|
-
|
132
|
-
</body>
|
133
|
-
</html>
|
data/doc/rdoc/files/README.html
DELETED
@@ -1,388 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>File: README</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="fileHeader">
|
50
|
-
<h1>README</h1>
|
51
|
-
<table class="header-table">
|
52
|
-
<tr class="top-aligned-row">
|
53
|
-
<td><strong>Path:</strong></td>
|
54
|
-
<td>README
|
55
|
-
</td>
|
56
|
-
</tr>
|
57
|
-
<tr class="top-aligned-row">
|
58
|
-
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Mon Jul 21 20:37:43 -0600 2008</td>
|
60
|
-
</tr>
|
61
|
-
</table>
|
62
|
-
</div>
|
63
|
-
<!-- banner header -->
|
64
|
-
|
65
|
-
<div id="bodyContent">
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
<div id="contextContent">
|
70
|
-
|
71
|
-
<div id="description">
|
72
|
-
<h1><a href="../classes/LibXML.html">LibXML</a> Ruby</h1>
|
73
|
-
<h2>Overview</h2>
|
74
|
-
<p>
|
75
|
-
The libxml gem provides Ruby language bindings for GNOME‘s Libxml2
|
76
|
-
XML toolkit. It is free software, released under the MIT License.
|
77
|
-
</p>
|
78
|
-
<p>
|
79
|
-
libxml-ruby provides several advantages over REXML:
|
80
|
-
</p>
|
81
|
-
<ul>
|
82
|
-
<li>Speed - libxml is many times faster than REXML
|
83
|
-
|
84
|
-
</li>
|
85
|
-
<li>Features - libxml provides a number of additional features over REXML,
|
86
|
-
including XML Schema Validation, RelaxNg validation, xslt (see
|
87
|
-
libxslt-ruby)
|
88
|
-
|
89
|
-
</li>
|
90
|
-
<li>Conformance - libxml passes all 1800+ tests from the OASIS XML Tests Suite
|
91
|
-
|
92
|
-
</li>
|
93
|
-
</ul>
|
94
|
-
<h2>Requirements</h2>
|
95
|
-
<p>
|
96
|
-
libxml-ruby requires Ruby 1.8.4 or higher. It is dependent on the following
|
97
|
-
libraries to function properly:
|
98
|
-
</p>
|
99
|
-
<ul>
|
100
|
-
<li>libm (math routines: very standard)
|
101
|
-
|
102
|
-
</li>
|
103
|
-
<li>libz (zlib)
|
104
|
-
|
105
|
-
</li>
|
106
|
-
<li>libiconv
|
107
|
-
|
108
|
-
</li>
|
109
|
-
<li>libxml2
|
110
|
-
|
111
|
-
</li>
|
112
|
-
</ul>
|
113
|
-
<p>
|
114
|
-
If you are running Linux or Unix you‘ll need a C compiler so the
|
115
|
-
extension can be compiled when it is installed. If you are running Windows,
|
116
|
-
then install the Windows specific RubyGem which includes an already built
|
117
|
-
extension.
|
118
|
-
</p>
|
119
|
-
<h2>INSTALLATION</h2>
|
120
|
-
<p>
|
121
|
-
The easiest way to install libxml-ruby is via Ruby Gems. To install:
|
122
|
-
</p>
|
123
|
-
<p>
|
124
|
-
<tt>gem install libxml-ruby</tt>
|
125
|
-
</p>
|
126
|
-
<p>
|
127
|
-
If you are running Windows, make sure to install the Win32 RubyGem which
|
128
|
-
includes an already built binary file. The binary is built against libxml2
|
129
|
-
version 2.6.32 and iconv version 1.11. Both of these are also included as
|
130
|
-
pre-built binaries, and should be put either in the libxml/lib directory or
|
131
|
-
on the Windows path.
|
132
|
-
</p>
|
133
|
-
<p>
|
134
|
-
The Windows binaries are built with MingW and include libxml-ruby, libxml2
|
135
|
-
and iconv. The gem also includes a Microsoft VC++ 2008 solution. If you
|
136
|
-
wish to run a debug version of libxml-ruby on Windows, then it is highly
|
137
|
-
recommended you use VC++.
|
138
|
-
</p>
|
139
|
-
<h2>Functionality</h2>
|
140
|
-
<p>
|
141
|
-
libxml is a highly conformant XML parser, passing all 1800+ tests from the
|
142
|
-
OASIS XML Tests Suite. In addition, it includes rich functionality such as:
|
143
|
-
</p>
|
144
|
-
<ul>
|
145
|
-
<li>SAX
|
146
|
-
|
147
|
-
</li>
|
148
|
-
<li>DOM
|
149
|
-
|
150
|
-
</li>
|
151
|
-
<li>HTML Parsing
|
152
|
-
|
153
|
-
</li>
|
154
|
-
<li>XMLReader
|
155
|
-
|
156
|
-
</li>
|
157
|
-
<li>XPath
|
158
|
-
|
159
|
-
</li>
|
160
|
-
<li>XPointer
|
161
|
-
|
162
|
-
</li>
|
163
|
-
<li>DTDs
|
164
|
-
|
165
|
-
</li>
|
166
|
-
<li>RelaxNG Schemas
|
167
|
-
|
168
|
-
</li>
|
169
|
-
<li>XML Schema
|
170
|
-
|
171
|
-
</li>
|
172
|
-
<li>XSLT (split into the libxslt-ruby bindings)
|
173
|
-
|
174
|
-
</li>
|
175
|
-
</ul>
|
176
|
-
<p>
|
177
|
-
libxml-ruby provides impressive coverage of libxml‘s functionality
|
178
|
-
through an easy-to-use C api.
|
179
|
-
</p>
|
180
|
-
<h2>Performance</h2>
|
181
|
-
<p>
|
182
|
-
In addition to being feature rich and conformation, the main reason people
|
183
|
-
use libxml-ruby is for performance. Here are the results of a couple simple
|
184
|
-
benchmarks recently blogged about on the Web (you can find them in the
|
185
|
-
benchmark directory of the libxml distribution).
|
186
|
-
</p>
|
187
|
-
<p>
|
188
|
-
From <a
|
189
|
-
href="http://depixelate.com/2008/4/23/ruby-xml-parsing-benchmarks">depixelate.com/2008/4/23/ruby-xml-parsing-benchmarks</a>
|
190
|
-
</p>
|
191
|
-
<pre>
|
192
|
-
user system total real
|
193
|
-
libxml 0.032000 0.000000 0.032000 ( 0.031000)
|
194
|
-
Hpricot 0.640000 0.031000 0.671000 ( 0.890000)
|
195
|
-
REXML 1.813000 0.047000 1.860000 ( 2.031000)
|
196
|
-
</pre>
|
197
|
-
<p>
|
198
|
-
From <a
|
199
|
-
href="https://svn.concord.org/svn/projects/trunk/common/ruby/xml_benchmarks">svn.concord.org/svn/projects/trunk/common/ruby/xml_benchmarks</a>/
|
200
|
-
</p>
|
201
|
-
<pre>
|
202
|
-
user system total real
|
203
|
-
libxml 0.641000 0.031000 0.672000 ( 0.672000)
|
204
|
-
hpricot 5.359000 0.062000 5.421000 ( 5.516000)
|
205
|
-
rexml 22.859000 0.047000 22.906000 ( 23.203000)
|
206
|
-
</pre>
|
207
|
-
<h2>USAGE</h2>
|
208
|
-
<p>
|
209
|
-
For in-depth information about using libxml-ruby please refer to its online
|
210
|
-
Rdoc documentation.
|
211
|
-
</p>
|
212
|
-
<p>
|
213
|
-
All libxml classes are in the <a
|
214
|
-
href="../classes/LibXML/XML.html">LibXML::XML</a> module. The simplest way
|
215
|
-
to use libxml is to require ‘xml’. This will mixin the <a
|
216
|
-
href="../classes/LibXML.html">LibXML</a> module into the global namespace,
|
217
|
-
allowing you to write code like this:
|
218
|
-
</p>
|
219
|
-
<p>
|
220
|
-
require ‘xml’ document = XML::Document.new
|
221
|
-
</p>
|
222
|
-
<p>
|
223
|
-
If you prefer not to add the <a href="../classes/LibXML.html">LibXML</a>
|
224
|
-
module to the global namepace, then write your code like this:
|
225
|
-
</p>
|
226
|
-
<p>
|
227
|
-
require ‘libxml‘
|
228
|
-
</p>
|
229
|
-
<p>
|
230
|
-
class MyClass
|
231
|
-
</p>
|
232
|
-
<pre>
|
233
|
-
def some_method
|
234
|
-
document = LibXML::XML::Document.new
|
235
|
-
end
|
236
|
-
</pre>
|
237
|
-
<p>
|
238
|
-
end
|
239
|
-
</p>
|
240
|
-
<p>
|
241
|
-
Some simple examples are shown below.
|
242
|
-
</p>
|
243
|
-
<h3>READING</h3>
|
244
|
-
<p>
|
245
|
-
There are several ways to read xml documents.
|
246
|
-
</p>
|
247
|
-
<pre>
|
248
|
-
require 'xml'
|
249
|
-
doc = XML::Document.file('output.xml')
|
250
|
-
root = doc.root
|
251
|
-
|
252
|
-
puts "Root element name: #{root.name}"
|
253
|
-
|
254
|
-
elem3 = root.find('elem3').to_a.first
|
255
|
-
puts "Elem3: #{elem3['attr']}"
|
256
|
-
|
257
|
-
doc.find('//root_node/foo/bar').each do |node|
|
258
|
-
puts "Node path: #{node.path} \t Contents: #{node.content}"
|
259
|
-
end
|
260
|
-
</pre>
|
261
|
-
<p>
|
262
|
-
And your terminal should look like:
|
263
|
-
</p>
|
264
|
-
<pre>
|
265
|
-
Root element name: root_node
|
266
|
-
Elem3: baz
|
267
|
-
Node path: /root_node/foo/bar[1] Contents: 1
|
268
|
-
Node path: /root_node/foo/bar[2] Contents: 2
|
269
|
-
Node path: /root_node/foo/bar[3] Contents: 3
|
270
|
-
Node path: /root_node/foo/bar[4] Contents: 4
|
271
|
-
Node path: /root_node/foo/bar[5] Contents: 5
|
272
|
-
Node path: /root_node/foo/bar[6] Contents: 6
|
273
|
-
Node path: /root_node/foo/bar[7] Contents: 7
|
274
|
-
Node path: /root_node/foo/bar[8] Contents: 8
|
275
|
-
Node path: /root_node/foo/bar[9] Contents: 9
|
276
|
-
Node path: /root_node/foo/bar[10] Contents: 10
|
277
|
-
</pre>
|
278
|
-
<h3>WRITING</h3>
|
279
|
-
<p>
|
280
|
-
To write a simple document:
|
281
|
-
</p>
|
282
|
-
<pre>
|
283
|
-
require 'xml'
|
284
|
-
|
285
|
-
doc = XML::Document.new()
|
286
|
-
doc.root = XML::Node.new('root_node')
|
287
|
-
root = doc.root
|
288
|
-
|
289
|
-
root << elem1 = XML::Node.new('elem1')
|
290
|
-
elem1['attr1'] = 'val1'
|
291
|
-
elem1['attr2'] = 'val2'
|
292
|
-
|
293
|
-
root << elem2 = XML::Node.new('elem2')
|
294
|
-
elem2['attr1'] = 'val1'
|
295
|
-
elem2['attr2'] = 'val2'
|
296
|
-
|
297
|
-
root << elem3 = XML::Node.new('elem3')
|
298
|
-
elem3 << elem4 = XML::Node.new('elem4')
|
299
|
-
elem3 << elem5 = XML::Node.new('elem5')
|
300
|
-
|
301
|
-
elem5 << elem6 = XML::Node.new('elem6')
|
302
|
-
elem6 << 'Content for element 6'
|
303
|
-
|
304
|
-
elem3['attr'] = 'baz'
|
305
|
-
|
306
|
-
format = true
|
307
|
-
doc.save('output.xml', format)
|
308
|
-
</pre>
|
309
|
-
<p>
|
310
|
-
The file output.xml contains:
|
311
|
-
</p>
|
312
|
-
<pre>
|
313
|
-
<?xml version="1.0"?>
|
314
|
-
<root_node>
|
315
|
-
<elem1 attr1="val1" attr2="val2"/>
|
316
|
-
<elem2 attr1="val1" attr2="val2"/>
|
317
|
-
<elem3 attr="baz">
|
318
|
-
<elem4/>
|
319
|
-
<elem5>
|
320
|
-
<elem6>Content for element 6</elem6>
|
321
|
-
</elem5>
|
322
|
-
</elem3>
|
323
|
-
<foo>
|
324
|
-
<bar>1</bar>
|
325
|
-
<bar>2</bar>
|
326
|
-
<bar>3</bar>
|
327
|
-
<bar>4</bar>
|
328
|
-
<bar>5</bar>
|
329
|
-
<bar>6</bar>
|
330
|
-
<bar>7</bar>
|
331
|
-
<bar>8</bar>
|
332
|
-
<bar>9</bar>
|
333
|
-
<bar>10</bar>
|
334
|
-
</foo>
|
335
|
-
</root_node>
|
336
|
-
</pre>
|
337
|
-
<h2>DOCUMENTATION</h2>
|
338
|
-
<p>
|
339
|
-
RDoc comments are included - run ‘rake doc’ to generate
|
340
|
-
documentation. You can find the latest documentation at:
|
341
|
-
</p>
|
342
|
-
<ul>
|
343
|
-
<li><a href="http://libxml.rubyforge.org/rdoc">libxml.rubyforge.org/rdoc</a>/
|
344
|
-
|
345
|
-
</li>
|
346
|
-
</ul>
|
347
|
-
<h2>License</h2>
|
348
|
-
<p>
|
349
|
-
See LICENSE for license information.
|
350
|
-
</p>
|
351
|
-
<h2>MORE INFORMATION</h2>
|
352
|
-
<p>
|
353
|
-
For more information please refer to the documentation. If you have any
|
354
|
-
questions, please send email to libxml-devel@rubyforge.org.
|
355
|
-
</p>
|
356
|
-
|
357
|
-
</div>
|
358
|
-
|
359
|
-
|
360
|
-
</div>
|
361
|
-
|
362
|
-
|
363
|
-
</div>
|
364
|
-
|
365
|
-
|
366
|
-
<!-- if includes -->
|
367
|
-
|
368
|
-
<div id="section">
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
<!-- if method_list -->
|
378
|
-
|
379
|
-
|
380
|
-
</div>
|
381
|
-
|
382
|
-
|
383
|
-
<div id="validator-badges">
|
384
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
385
|
-
</div>
|
386
|
-
|
387
|
-
</body>
|
388
|
-
</html>
|