libxml-ruby 0.8.3 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. data/CHANGES +18 -0
  2. data/RAKEFILE +15 -39
  3. data/README +48 -47
  4. data/ext/libxml/libxml.c +847 -22
  5. data/ext/libxml/ruby_libxml.h +71 -95
  6. data/ext/libxml/ruby_xml_attr.c +500 -500
  7. data/ext/libxml/ruby_xml_attributes.c +1 -1
  8. data/ext/libxml/ruby_xml_document.c +1144 -1135
  9. data/ext/libxml/ruby_xml_document.h +4 -11
  10. data/ext/libxml/ruby_xml_dtd.c +27 -0
  11. data/ext/libxml/ruby_xml_encoding.c +164 -0
  12. data/ext/libxml/ruby_xml_encoding.h +13 -0
  13. data/ext/libxml/ruby_xml_error.c +941 -0
  14. data/ext/libxml/ruby_xml_error.h +13 -0
  15. data/ext/libxml/ruby_xml_html_parser.c +71 -387
  16. data/ext/libxml/ruby_xml_html_parser.h +1 -17
  17. data/ext/libxml/ruby_xml_input.c +179 -0
  18. data/ext/libxml/ruby_xml_input.h +18 -0
  19. data/ext/libxml/ruby_xml_input_cbg.c +17 -3
  20. data/ext/libxml/ruby_xml_node.c +1566 -1582
  21. data/ext/libxml/ruby_xml_node.h +1 -4
  22. data/ext/libxml/ruby_xml_ns.c +14 -3
  23. data/ext/libxml/ruby_xml_parser.c +164 -1398
  24. data/ext/libxml/ruby_xml_parser.h +5 -17
  25. data/ext/libxml/ruby_xml_parser_context.c +131 -169
  26. data/ext/libxml/ruby_xml_parser_context.h +2 -9
  27. data/ext/libxml/ruby_xml_reader.c +910 -945
  28. data/ext/libxml/ruby_xml_relaxng.c +32 -3
  29. data/ext/libxml/ruby_xml_sax_parser.c +106 -364
  30. data/ext/libxml/ruby_xml_sax_parser.h +1 -37
  31. data/ext/libxml/ruby_xml_schema.c +174 -145
  32. data/ext/libxml/ruby_xml_xinclude.c +9 -5
  33. data/ext/libxml/ruby_xml_xpath.c +25 -6
  34. data/ext/libxml/ruby_xml_xpath.h +1 -2
  35. data/ext/libxml/ruby_xml_xpath_context.c +17 -19
  36. data/ext/libxml/ruby_xml_xpath_object.c +60 -56
  37. data/ext/libxml/ruby_xml_xpointer.c +11 -5
  38. data/ext/libxml/sax_parser_callbacks.inc +42 -37
  39. data/ext/libxml/version.h +3 -3
  40. data/ext/mingw/Rakefile +20 -27
  41. data/ext/mingw/build.rake +41 -0
  42. data/ext/vc/libxml_ruby.vcproj +23 -15
  43. data/lib/libxml.rb +8 -2
  44. data/lib/libxml/document.rb +16 -4
  45. data/lib/libxml/error.rb +84 -0
  46. data/lib/libxml/hpricot.rb +76 -0
  47. data/lib/libxml/html_parser.rb +61 -0
  48. data/lib/libxml/node.rb +36 -25
  49. data/lib/libxml/parser.rb +312 -33
  50. data/lib/libxml/parser_context.rb +17 -0
  51. data/lib/libxml/properties.rb +15 -2
  52. data/lib/libxml/reader.rb +15 -0
  53. data/lib/libxml/sax_callbacks.rb +179 -0
  54. data/lib/libxml/sax_parser.rb +42 -0
  55. data/lib/libxml/tree.rb +1 -2
  56. data/lib/libxml/xpath_object.rb +12 -0
  57. data/test/model/atom.xml +4 -0
  58. data/test/tc_attributes.rb +43 -19
  59. data/test/tc_document.rb +1 -1
  60. data/test/tc_document_write.rb +15 -8
  61. data/test/tc_dtd.rb +36 -20
  62. data/test/tc_encoding.rb +13 -0
  63. data/test/tc_error.rb +136 -0
  64. data/test/tc_node.rb +2 -3
  65. data/test/tc_node_copy.rb +1 -1
  66. data/test/tc_node_edit.rb +6 -0
  67. data/test/tc_ns.rb +18 -0
  68. data/test/tc_parser.rb +113 -228
  69. data/test/tc_parser_context.rb +1 -2
  70. data/test/tc_reader.rb +24 -14
  71. data/test/tc_relaxng.rb +18 -6
  72. data/test/tc_sax_parser.rb +48 -13
  73. data/test/tc_schema.rb +20 -8
  74. data/test/tc_well_formed.rb +2 -1
  75. data/test/tc_xml.rb +212 -0
  76. data/test/tc_xpath.rb +60 -46
  77. data/test/tc_xpointer.rb +7 -11
  78. data/test/test_suite.rb +4 -3
  79. metadata +26 -109
  80. data/doc/rdoc/classes/LibXML.html +0 -241
  81. data/doc/rdoc/classes/LibXML/XML.html +0 -185
  82. data/doc/rdoc/classes/LibXML/XML/Attr.html +0 -1010
  83. data/doc/rdoc/classes/LibXML/XML/Attributes.html +0 -526
  84. data/doc/rdoc/classes/LibXML/XML/Document.html +0 -1489
  85. data/doc/rdoc/classes/LibXML/XML/Dtd.html +0 -213
  86. data/doc/rdoc/classes/LibXML/XML/Error.html +0 -117
  87. data/doc/rdoc/classes/LibXML/XML/HTMLParser.html +0 -348
  88. data/doc/rdoc/classes/LibXML/XML/InputCallbacks.html +0 -160
  89. data/doc/rdoc/classes/LibXML/XML/NS.html +0 -381
  90. data/doc/rdoc/classes/LibXML/XML/Node.html +0 -3396
  91. data/doc/rdoc/classes/LibXML/XML/Node/FailedModify.html +0 -123
  92. data/doc/rdoc/classes/LibXML/XML/Node/Set.html +0 -440
  93. data/doc/rdoc/classes/LibXML/XML/Node/SetNamespace.html +0 -123
  94. data/doc/rdoc/classes/LibXML/XML/Node/UnknownType.html +0 -123
  95. data/doc/rdoc/classes/LibXML/XML/Parser.html +0 -2239
  96. data/doc/rdoc/classes/LibXML/XML/Parser/Context.html +0 -1255
  97. data/doc/rdoc/classes/LibXML/XML/Parser/ParseError.html +0 -123
  98. data/doc/rdoc/classes/LibXML/XML/Reader.html +0 -2264
  99. data/doc/rdoc/classes/LibXML/XML/RelaxNG.html +0 -237
  100. data/doc/rdoc/classes/LibXML/XML/SaxParser.html +0 -415
  101. data/doc/rdoc/classes/LibXML/XML/Schema.html +0 -308
  102. data/doc/rdoc/classes/LibXML/XML/State.html +0 -124
  103. data/doc/rdoc/classes/LibXML/XML/Tree.html +0 -111
  104. data/doc/rdoc/classes/LibXML/XML/XInclude.html +0 -123
  105. data/doc/rdoc/classes/LibXML/XML/XInclude/Error.html +0 -117
  106. data/doc/rdoc/classes/LibXML/XML/XMLParserOptions.html +0 -198
  107. data/doc/rdoc/classes/LibXML/XML/XPath.html +0 -184
  108. data/doc/rdoc/classes/LibXML/XML/XPath/Context.html +0 -404
  109. data/doc/rdoc/classes/LibXML/XML/XPath/InvalidPath.html +0 -172
  110. data/doc/rdoc/classes/LibXML/XML/XPath/Object.html +0 -627
  111. data/doc/rdoc/classes/LibXML/XML/XPointer.html +0 -170
  112. data/doc/rdoc/classes/LibXML/XML/XPointer/Context.html +0 -123
  113. data/doc/rdoc/classes/LibXML/XML/XPointer/Context/InvalidPath.html +0 -117
  114. data/doc/rdoc/classes/LibXML/XML/XPointer/InvalidExpression.html +0 -124
  115. data/doc/rdoc/classes/singleton.html +0 -114
  116. data/doc/rdoc/created.rid +0 -1
  117. data/doc/rdoc/files/CHANGES.html +0 -442
  118. data/doc/rdoc/files/LICENSE.html +0 -133
  119. data/doc/rdoc/files/README.html +0 -388
  120. data/doc/rdoc/files/VERSION.html +0 -107
  121. data/doc/rdoc/files/ext/libxml/cbg_c.html +0 -101
  122. data/doc/rdoc/files/ext/libxml/libxml_c.html +0 -101
  123. data/doc/rdoc/files/ext/libxml/ruby_xml_attr_c.html +0 -101
  124. data/doc/rdoc/files/ext/libxml/ruby_xml_attributes_c.html +0 -101
  125. data/doc/rdoc/files/ext/libxml/ruby_xml_document_c.html +0 -101
  126. data/doc/rdoc/files/ext/libxml/ruby_xml_dtd_c.html +0 -101
  127. data/doc/rdoc/files/ext/libxml/ruby_xml_html_parser_c.html +0 -101
  128. data/doc/rdoc/files/ext/libxml/ruby_xml_input_cbg_c.html +0 -101
  129. data/doc/rdoc/files/ext/libxml/ruby_xml_node_c.html +0 -101
  130. data/doc/rdoc/files/ext/libxml/ruby_xml_node_set_c.html +0 -101
  131. data/doc/rdoc/files/ext/libxml/ruby_xml_ns_c.html +0 -101
  132. data/doc/rdoc/files/ext/libxml/ruby_xml_parser_c.html +0 -101
  133. data/doc/rdoc/files/ext/libxml/ruby_xml_parser_context_c.html +0 -101
  134. data/doc/rdoc/files/ext/libxml/ruby_xml_reader_c.html +0 -101
  135. data/doc/rdoc/files/ext/libxml/ruby_xml_relaxng_c.html +0 -101
  136. data/doc/rdoc/files/ext/libxml/ruby_xml_sax_parser_c.html +0 -101
  137. data/doc/rdoc/files/ext/libxml/ruby_xml_schema_c.html +0 -101
  138. data/doc/rdoc/files/ext/libxml/ruby_xml_state_c.html +0 -101
  139. data/doc/rdoc/files/ext/libxml/ruby_xml_xinclude_c.html +0 -101
  140. data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_c.html +0 -101
  141. data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_context_c.html +0 -101
  142. data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_object_c.html +0 -101
  143. data/doc/rdoc/files/ext/libxml/ruby_xml_xpointer_c.html +0 -101
  144. data/doc/rdoc/files/ext/libxml/ruby_xml_xpointer_context_c.html +0 -101
  145. data/doc/rdoc/files/lib/libxml/attr_rb.html +0 -108
  146. data/doc/rdoc/files/lib/libxml/attributes_rb.html +0 -108
  147. data/doc/rdoc/files/lib/libxml/document_rb.html +0 -108
  148. data/doc/rdoc/files/lib/libxml/node_rb.html +0 -108
  149. data/doc/rdoc/files/lib/libxml/node_set_rb.html +0 -108
  150. data/doc/rdoc/files/lib/libxml/parser_options_rb.html +0 -107
  151. data/doc/rdoc/files/lib/libxml/parser_rb.html +0 -101
  152. data/doc/rdoc/files/lib/libxml/properties_rb.html +0 -108
  153. data/doc/rdoc/files/lib/libxml/tree_rb.html +0 -107
  154. data/doc/rdoc/files/lib/libxml_rb.html +0 -124
  155. data/doc/rdoc/files/lib/xml/libxml_rb.html +0 -124
  156. data/doc/rdoc/files/lib/xml_rb.html +0 -134
  157. data/doc/rdoc/fr_class_index.html +0 -62
  158. data/doc/rdoc/fr_file_index.html +0 -66
  159. data/doc/rdoc/fr_method_index.html +0 -392
  160. data/doc/rdoc/index.html +0 -24
  161. data/doc/rdoc/rdoc-style.css +0 -208
  162. data/ext/libxml/ruby_xml_node_set.c +0 -172
  163. data/ext/libxml/ruby_xml_node_set.h +0 -20
  164. data/ext/libxml/ruby_xml_xpointer_context.c +0 -22
  165. data/ext/libxml/ruby_xml_xpointer_context.h +0 -18
  166. data/lib/libxml/node_set.rb +0 -27
  167. data/test/tc_node_set.rb +0 -24
  168. data/test/tc_node_set2.rb +0 -37
@@ -1,404 +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>Class: LibXML::XML::XPath::Context</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="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">LibXML::XML::XPath::Context</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../../../files/ext/libxml/ruby_xml_xpath_c.html">
59
- ext/libxml/ruby_xml_xpath.c
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- <a href="Object.html">
69
- Object
70
- </a>
71
- </td>
72
- </tr>
73
- </table>
74
- </div>
75
- <!-- banner header -->
76
-
77
- <div id="bodyContent">
78
-
79
-
80
-
81
- <div id="contextContent">
82
-
83
- <div id="description">
84
- <p>
85
- The <a href="Context.html">XML::XPath::Context</a> class is used to
86
- evaluate <a href="../XPath.html">XPath</a> expressions. Generally, you
87
- should not directly use this class, but instead use the <a
88
- href="../Document.html#M000359">XML::Document#find</a> and <a
89
- href="../Node.html#M000173">XML::Node#find</a> methods.
90
- </p>
91
- <pre>
92
- doc = XML::Document.string('&lt;header&gt;content&lt;/header&gt;')
93
- context = XPath::Context.new(doc)
94
- context.node = doc.root
95
- context.register_namespaces_from_node(doc.root)
96
- nodes = context.find('/header')
97
- </pre>
98
-
99
- </div>
100
-
101
-
102
- </div>
103
-
104
- <div id="method-list">
105
- <h3 class="section-bar">Methods</h3>
106
-
107
- <div class="name-list">
108
- <a href="#M000006">find</a>&nbsp;&nbsp;
109
- <a href="#M000001">new</a>&nbsp;&nbsp;
110
- <a href="#M000005">node=</a>&nbsp;&nbsp;
111
- <a href="#M000004">register_namespace</a>&nbsp;&nbsp;
112
- <a href="#M000002">register_namespaces</a>&nbsp;&nbsp;
113
- <a href="#M000003">register_namespaces_from_node</a>&nbsp;&nbsp;
114
- </div>
115
- </div>
116
-
117
- </div>
118
-
119
-
120
- <!-- if includes -->
121
-
122
- <div id="section">
123
-
124
-
125
-
126
-
127
-
128
- <div id="attribute-list">
129
- <h3 class="section-bar">Attributes</h3>
130
-
131
- <div class="name-list">
132
- <table>
133
- <tr class="top-aligned-row context-row">
134
- <td class="context-item-name">doc</td>
135
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
136
- <td class="context-item-desc"></td>
137
- </tr>
138
- </table>
139
- </div>
140
- </div>
141
-
142
-
143
-
144
- <!-- if method_list -->
145
- <div id="methods">
146
- <h3 class="section-bar">Public Class methods</h3>
147
-
148
- <div id="method-M000001" class="method-detail">
149
- <a name="M000001"></a>
150
-
151
- <div class="method-heading">
152
- <a href="#M000001" class="method-signature">
153
- <span class="method-name">XPath::Context.new(node) &rarr; XPath::Context<br />
154
- </span>
155
- </a>
156
- </div>
157
-
158
- <div class="method-description">
159
- <p>
160
- Creates a <a href="Context.html#M000001">new</a> <a
161
- href="../XPath.html">XPath</a> context for the specified document. The
162
- context can then be used to evaluate an <a href="../XPath.html">XPath</a>
163
- expression.
164
- </p>
165
- <pre>
166
- doc = XML::Document.string('&lt;header&gt;&lt;first&gt;hi&lt;/first&gt;&lt;/header&gt;')
167
- context = XPath::Context.new(doc)
168
- nodes = XPath::Object.new('//first', context)
169
- nodes.length == 1
170
- </pre>
171
- <p><a class="source-toggle" href="#"
172
- onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
173
- <div class="method-source-code" id="M000001-source">
174
- <pre>
175
- /* call-seq:
176
- * XPath::Context.new(node) -&gt; XPath::Context
177
- *
178
- * Creates a new XPath context for the specified document. The
179
- * context can then be used to evaluate an XPath expression.
180
- *
181
- * doc = XML::Document.string('&lt;header&gt;&lt;first&gt;hi&lt;/first&gt;&lt;/header&gt;')
182
- * context = XPath::Context.new(doc)
183
- * nodes = XPath::Object.new('//first', context)
184
- * nodes.length == 1
185
- */
186
- VALUE
187
- ruby_xml_xpath_context_initialize(VALUE self, VALUE node) {
188
-
189
- </pre>
190
- </div>
191
- </div>
192
- </div>
193
-
194
- <h3 class="section-bar">Public Instance methods</h3>
195
-
196
- <div id="method-M000006" class="method-detail">
197
- <a name="M000006"></a>
198
-
199
- <div class="method-heading">
200
- <a href="#M000006" class="method-signature">
201
- <span class="method-name">context.find("xpath") &rarr; XML::XPath::Object<br />
202
- </span>
203
- </a>
204
- </div>
205
-
206
- <div class="method-description">
207
- <p>
208
- Find nodes matching the specified <a href="../XPath.html">XPath</a>
209
- expression
210
- </p>
211
- <p><a class="source-toggle" href="#"
212
- onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
213
- <div class="method-source-code" id="M000006-source">
214
- <pre>
215
- /*
216
- * call-seq:
217
- * context.find(&quot;xpath&quot;) -&gt; XML::XPath::Object
218
- *
219
- * Find nodes matching the specified XPath expression
220
- */
221
- VALUE
222
- ruby_xml_xpath_context_find(VALUE self, VALUE xpath_expr) {
223
-
224
- </pre>
225
- </div>
226
- </div>
227
- </div>
228
-
229
- <div id="method-M000005" class="method-detail">
230
- <a name="M000005"></a>
231
-
232
- <div class="method-heading">
233
- <a href="#M000005" class="method-signature">
234
- <span class="method-name">context.node = node<br />
235
- </span>
236
- </a>
237
- </div>
238
-
239
- <div class="method-description">
240
- <p>
241
- Set the current node used by the <a href="../XPath.html">XPath</a> engine
242
- </p>
243
- <pre>
244
- doc = XML::Document.string('&lt;header&gt;&lt;first&gt;hi&lt;/first&gt;&lt;/header&gt;')
245
- context.node = doc.root.first
246
- </pre>
247
- <p><a class="source-toggle" href="#"
248
- onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
249
- <div class="method-source-code" id="M000005-source">
250
- <pre>
251
- /*
252
- * call-seq:
253
- * context.node = node
254
- *
255
- * Set the current node used by the XPath engine
256
-
257
- * doc = XML::Document.string('&lt;header&gt;&lt;first&gt;hi&lt;/first&gt;&lt;/header&gt;')
258
- * context.node = doc.root.first
259
- */
260
- VALUE
261
- ruby_xml_xpath_context_node_set(VALUE self, VALUE node) {
262
-
263
- </pre>
264
- </div>
265
- </div>
266
- </div>
267
-
268
- <div id="method-M000004" class="method-detail">
269
- <a name="M000004"></a>
270
-
271
- <div class="method-heading">
272
- <a href="#M000004" class="method-signature">
273
- <span class="method-name">context.register_namespace(prefix, uri) &rarr; (true|false)<br />
274
- </span>
275
- </a>
276
- </div>
277
-
278
- <div class="method-description">
279
- <p>
280
- Register the specified namespace URI with the specified prefix in this
281
- context.
282
- </p>
283
- <pre>
284
- context.register_namespace('xi', 'http://www.w3.org/2001/XInclude')
285
- </pre>
286
- <p><a class="source-toggle" href="#"
287
- onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
288
- <div class="method-source-code" id="M000004-source">
289
- <pre>
290
- /*
291
- * call-seq:
292
- * context.register_namespace(prefix, uri) -&gt; (true|false)
293
- *
294
- * Register the specified namespace URI with the specified prefix
295
- * in this context.
296
-
297
- * context.register_namespace('xi', 'http://www.w3.org/2001/XInclude')
298
- */
299
- VALUE
300
- ruby_xml_xpath_context_register_namespace(VALUE self, VALUE prefix, VALUE uri) {
301
-
302
- </pre>
303
- </div>
304
- </div>
305
- </div>
306
-
307
- <div id="method-M000002" class="method-detail">
308
- <a name="M000002"></a>
309
-
310
- <div class="method-heading">
311
- <a href="#M000002" class="method-signature">
312
- <span class="method-name">context.register_namespaces(["prefix:uri"]) &rarr; self<br />
313
- </span>
314
- </a>
315
- </div>
316
-
317
- <div class="method-description">
318
- <p>
319
- Register the specified namespaces in this context.
320
- </p>
321
- <pre>
322
- context.register_namespaces('xi:http://www.w3.org/2001/XInclude')
323
- context.register_namespaces(['xlink:http://www.w3.org/1999/xlink',
324
- 'xi:http://www.w3.org/2001/XInclude')
325
- context.register_namespaces('xlink' =&gt; 'http://www.w3.org/1999/xlink',
326
- 'xi' =&gt; 'http://www.w3.org/2001/XInclude')
327
- </pre>
328
- <p><a class="source-toggle" href="#"
329
- onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
330
- <div class="method-source-code" id="M000002-source">
331
- <pre>
332
- /*
333
- * call-seq:
334
- * context.register_namespaces([&quot;prefix:uri&quot;]) -&gt; self
335
- *
336
- * Register the specified namespaces in this context.
337
- *
338
- * context.register_namespaces('xi:http://www.w3.org/2001/XInclude')
339
- * context.register_namespaces(['xlink:http://www.w3.org/1999/xlink',
340
- * 'xi:http://www.w3.org/2001/XInclude')
341
- * context.register_namespaces('xlink' =&gt; 'http://www.w3.org/1999/xlink',
342
- * 'xi' =&gt; 'http://www.w3.org/2001/XInclude')
343
- */
344
- VALUE
345
- ruby_xml_xpath_context_register_namespaces(VALUE self, VALUE nslist) {
346
-
347
- </pre>
348
- </div>
349
- </div>
350
- </div>
351
-
352
- <div id="method-M000003" class="method-detail">
353
- <a name="M000003"></a>
354
-
355
- <div class="method-heading">
356
- <a href="#M000003" class="method-signature">
357
- <span class="method-name">context.register_namespaces_from_node(node) &rarr; self<br />
358
- </span>
359
- </a>
360
- </div>
361
-
362
- <div class="method-description">
363
- <p>
364
- Helper method to read in namespaces defined on a node.
365
- </p>
366
- <pre>
367
- doc = XML::Document.string('&lt;header&gt;&lt;first&gt;hi&lt;/first&gt;&lt;/header&gt;')
368
- context = XPath::Context.new(doc)
369
- context.register_namespaces_from_node(doc.root)
370
- </pre>
371
- <p><a class="source-toggle" href="#"
372
- onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
373
- <div class="method-source-code" id="M000003-source">
374
- <pre>
375
- /* call-seq:
376
- * context.register_namespaces_from_node(node) -&gt; self
377
- *
378
- * Helper method to read in namespaces defined on a node.
379
- *
380
- * doc = XML::Document.string('&lt;header&gt;&lt;first&gt;hi&lt;/first&gt;&lt;/header&gt;')
381
- * context = XPath::Context.new(doc)
382
- * context.register_namespaces_from_node(doc.root)
383
- */
384
- VALUE
385
- ruby_xml_xpath_context_register_namespaces_from_node(VALUE self, VALUE node) {
386
-
387
- </pre>
388
- </div>
389
- </div>
390
- </div>
391
-
392
-
393
- </div>
394
-
395
-
396
- </div>
397
-
398
-
399
- <div id="validator-badges">
400
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
401
- </div>
402
-
403
- </body>
404
- </html>
@@ -1,172 +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>Class: LibXML::XML::XPath::InvalidPath</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="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">LibXML::XML::XPath::InvalidPath</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../../../files/ext/libxml/ruby_xml_xpath_c.html">
59
- ext/libxml/ruby_xml_xpath.c
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- eXMLError
69
- </td>
70
- </tr>
71
- </table>
72
- </div>
73
- <!-- banner header -->
74
-
75
- <div id="bodyContent">
76
-
77
-
78
-
79
- <div id="contextContent">
80
-
81
- <div id="description">
82
- <p>
83
- <a href="../Document.html">Document</a>-class: <a
84
- href="../XPath.html">LibXML::XML::XPath</a>
85
- </p>
86
- <p>
87
- The <a href="../XPath.html">XML::XPath</a> module is used to query <a
88
- href="../../XML.html">XML</a> documents. It is usually accessed via the <a
89
- href="../Document.html#M000359">XML::Document#find</a> or <a
90
- href="../Node.html#M000173">XML::Node#find</a> methods. For example:
91
- </p>
92
- <pre>
93
- document.find('/foo', namespaces) -&gt; XML::XPath::Object
94
- </pre>
95
- <p>
96
- The optional namespaces parameter can be a string, array or hash table.
97
- </p>
98
- <pre>
99
- document.find('/foo', 'xlink:http://www.w3.org/1999/xlink')
100
- document.find('/foo', ['xlink:http://www.w3.org/1999/xlink',
101
- 'xi:http://www.w3.org/2001/XInclude')
102
- document.find('/foo', 'xlink' =&gt; 'http://www.w3.org/1999/xlink',
103
- 'xi' =&gt; 'http://www.w3.org/2001/XInclude')
104
- </pre>
105
- <h3>Working With Namespaces</h3>
106
- <p>
107
- Finding namespaced elements and attributes can be tricky. Lets work through
108
- some examples using the following xml document:
109
- </p>
110
- <pre>
111
- &lt;soap:Envelope xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
112
- &lt;soap:Body&gt;
113
- &lt;getManufacturerNamesResponse xmlns=&quot;http://services.somewhere.com&quot;&gt;
114
- &lt;IDAndNameList xmlns=&quot;http://services.somewhere.com&quot;&gt;
115
- &lt;ns1:IdAndName xmlns:ns1=&quot;http://domain.somewhere.com&quot;/&gt;
116
- &lt;/IDAndNameList&gt;
117
- &lt;/getManufacturerNamesResponse&gt;
118
- &lt;/soap:Envelope&gt;
119
-
120
- # Since the soap namespace is defined on the root
121
- # node we can directly use it.
122
- doc.find('/soap:Envelope')
123
-
124
- # Since the ns1 namespace is not defined on the root node
125
- # we have to first register it with the xpath engine.
126
- doc.find('//ns1:IdAndName',
127
- 'ns1:http://domain.somewhere.com')
128
-
129
- # Since the getManufacturerNamesResponse element uses a default
130
- # namespace we first have to give it a prefix and register
131
- # it with the xpath engine.
132
- doc.find('//ns:getManufacturerNamesResponse',
133
- 'ns:http://services.somewhere.com')
134
-
135
- # Here is an example showing a complex namespace aware
136
- # xpath expression.
137
- doc.find('/soap:Envelope/soap:Body/ns0:getManufacturerNamesResponse/ns0:IDAndNameList/ns1:IdAndName',
138
- ['ns0:http://services.somewhere.com', 'ns1:http://domain.somewhere.com'])
139
- </pre>
140
-
141
- </div>
142
-
143
-
144
- </div>
145
-
146
-
147
- </div>
148
-
149
-
150
- <!-- if includes -->
151
-
152
- <div id="section">
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
- <!-- if method_list -->
162
-
163
-
164
- </div>
165
-
166
-
167
- <div id="validator-badges">
168
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
169
- </div>
170
-
171
- </body>
172
- </html>