libxml-ruby 0.8.1-x86-mswin32-60 → 0.8.2-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.
Files changed (164) hide show
  1. data/CHANGES +21 -0
  2. data/RAKEFILE +213 -0
  3. data/README +32 -11
  4. data/doc/rdoc/classes/LibXML.html +4 -0
  5. data/doc/rdoc/classes/LibXML/XML.html +7 -0
  6. data/doc/rdoc/classes/LibXML/XML/Attr.html +187 -177
  7. data/doc/rdoc/classes/LibXML/XML/Attributes.html +62 -61
  8. data/doc/rdoc/classes/LibXML/XML/Document.html +318 -254
  9. data/doc/rdoc/classes/LibXML/XML/Dtd.html +62 -8
  10. data/doc/rdoc/classes/LibXML/XML/Error.html +6 -0
  11. data/doc/rdoc/classes/LibXML/XML/HTMLParser.html +59 -41
  12. data/doc/rdoc/classes/LibXML/XML/InputCallbacks.html +12 -6
  13. data/doc/rdoc/classes/LibXML/XML/NS.html +65 -50
  14. data/doc/rdoc/classes/LibXML/XML/Node.html +671 -630
  15. data/doc/rdoc/classes/LibXML/XML/Node/FailedModify.html +12 -0
  16. data/doc/rdoc/classes/LibXML/XML/Node/Set.html +64 -60
  17. data/doc/rdoc/classes/LibXML/XML/Node/SetNamespace.html +12 -0
  18. data/doc/rdoc/classes/LibXML/XML/Node/UnknownType.html +12 -0
  19. data/doc/rdoc/classes/LibXML/XML/Parser.html +407 -383
  20. data/doc/rdoc/classes/LibXML/XML/Parser/Context.html +241 -219
  21. data/doc/rdoc/classes/LibXML/XML/Parser/ParseError.html +12 -0
  22. data/doc/rdoc/classes/LibXML/XML/Reader.html +421 -331
  23. data/doc/rdoc/classes/LibXML/XML/RelaxNG.html +237 -0
  24. data/doc/rdoc/classes/LibXML/XML/SaxParser.html +79 -60
  25. data/doc/rdoc/classes/LibXML/XML/Schema.html +109 -22
  26. data/doc/rdoc/classes/LibXML/XML/State.html +6 -0
  27. data/doc/rdoc/classes/LibXML/XML/XInclude.html +6 -0
  28. data/doc/rdoc/classes/LibXML/XML/XInclude/Error.html +6 -0
  29. data/doc/rdoc/classes/LibXML/XML/XPath.html +4 -48
  30. data/doc/rdoc/classes/LibXML/XML/XPath/Context.html +6 -5
  31. data/doc/rdoc/classes/LibXML/XML/XPath/InvalidPath.html +61 -0
  32. data/doc/rdoc/classes/LibXML/XML/XPath/Object.html +12 -8
  33. data/doc/rdoc/classes/LibXML/XML/XPointer.html +14 -8
  34. data/doc/rdoc/classes/LibXML/XML/XPointer/Context.html +6 -0
  35. data/doc/rdoc/classes/LibXML/XML/XPointer/Context/InvalidPath.html +6 -0
  36. data/doc/rdoc/classes/LibXML/XML/XPointer/InvalidExpression.html +13 -0
  37. data/doc/rdoc/created.rid +1 -1
  38. data/doc/rdoc/files/CHANGES.html +38 -10
  39. data/doc/rdoc/files/LICENSE.html +1 -1
  40. data/doc/rdoc/files/README.html +57 -23
  41. data/doc/rdoc/files/VERSION.html +1 -1
  42. data/doc/rdoc/files/ext/libxml/cbg_c.html +1 -1
  43. data/doc/rdoc/files/ext/libxml/libxml_c.html +1 -1
  44. data/doc/rdoc/files/ext/libxml/ruby_xml_attr_c.html +1 -1
  45. data/doc/rdoc/files/ext/libxml/ruby_xml_attributes_c.html +1 -1
  46. data/doc/rdoc/files/ext/libxml/ruby_xml_document_c.html +1 -1
  47. data/doc/rdoc/files/ext/libxml/ruby_xml_dtd_c.html +1 -1
  48. data/doc/rdoc/files/ext/libxml/ruby_xml_html_parser_c.html +1 -1
  49. data/doc/rdoc/files/ext/libxml/ruby_xml_input_cbg_c.html +1 -1
  50. data/doc/rdoc/files/ext/libxml/ruby_xml_node_c.html +1 -1
  51. data/doc/rdoc/files/ext/libxml/ruby_xml_node_set_c.html +1 -1
  52. data/doc/rdoc/files/ext/libxml/ruby_xml_ns_c.html +1 -1
  53. data/doc/rdoc/files/ext/libxml/ruby_xml_parser_c.html +1 -1
  54. data/doc/rdoc/files/ext/libxml/ruby_xml_parser_context_c.html +1 -1
  55. data/doc/rdoc/files/ext/libxml/ruby_xml_reader_c.html +1 -1
  56. data/doc/rdoc/{classes/XML.html → files/ext/libxml/ruby_xml_relaxng_c.html} +16 -35
  57. data/doc/rdoc/files/ext/libxml/ruby_xml_sax_parser_c.html +1 -1
  58. data/doc/rdoc/files/ext/libxml/ruby_xml_schema_c.html +1 -1
  59. data/doc/rdoc/files/ext/libxml/ruby_xml_state_c.html +1 -1
  60. data/doc/rdoc/files/ext/libxml/ruby_xml_xinclude_c.html +1 -1
  61. data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_c.html +1 -1
  62. data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_context_c.html +1 -1
  63. data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_object_c.html +1 -1
  64. data/doc/rdoc/files/ext/libxml/ruby_xml_xpointer_c.html +1 -1
  65. data/doc/rdoc/files/ext/libxml/ruby_xml_xpointer_context_c.html +1 -1
  66. data/doc/rdoc/files/lib/libxml/attr_rb.html +1 -1
  67. data/doc/rdoc/files/lib/libxml/attributes_rb.html +1 -1
  68. data/doc/rdoc/files/lib/libxml/document_rb.html +1 -1
  69. data/doc/rdoc/files/lib/libxml/node_rb.html +1 -1
  70. data/doc/rdoc/files/lib/libxml/node_set_rb.html +1 -1
  71. data/doc/rdoc/files/lib/libxml/parser_options_rb.html +1 -1
  72. data/doc/rdoc/files/lib/libxml/parser_rb.html +1 -1
  73. data/doc/rdoc/files/lib/libxml/properties_rb.html +1 -1
  74. data/doc/rdoc/files/lib/libxml/tree_rb.html +1 -1
  75. data/doc/rdoc/files/lib/libxml_rb.html +2 -2
  76. data/doc/rdoc/files/lib/xml/libxml_rb.html +12 -2
  77. data/doc/rdoc/files/lib/xml_rb.html +134 -0
  78. data/doc/rdoc/fr_class_index.html +1 -1
  79. data/doc/rdoc/fr_file_index.html +2 -0
  80. data/doc/rdoc/fr_method_index.html +349 -344
  81. data/ext/libxml/libxml.c +2 -1
  82. data/ext/libxml/ruby_libxml.h +1 -0
  83. data/ext/libxml/ruby_xml_attr.c +8 -2
  84. data/ext/libxml/ruby_xml_attributes.c +5 -5
  85. data/ext/libxml/ruby_xml_document.c +41 -2
  86. data/ext/libxml/ruby_xml_dtd.c +169 -169
  87. data/ext/libxml/ruby_xml_html_parser.c +449 -449
  88. data/ext/libxml/ruby_xml_input_cbg.c +165 -165
  89. data/ext/libxml/ruby_xml_node.c +1 -1
  90. data/ext/libxml/ruby_xml_node_set.c +172 -172
  91. data/ext/libxml/ruby_xml_ns.c +145 -145
  92. data/ext/libxml/ruby_xml_parser.c +1398 -1398
  93. data/ext/libxml/ruby_xml_parser_context.c +697 -697
  94. data/ext/libxml/ruby_xml_reader.c +44 -0
  95. data/ext/libxml/ruby_xml_reader.h +14 -14
  96. data/ext/libxml/ruby_xml_relaxng.c +97 -0
  97. data/ext/libxml/ruby_xml_relaxng.h +15 -0
  98. data/ext/libxml/ruby_xml_sax_parser.c +486 -486
  99. data/ext/libxml/ruby_xml_schema.c +1 -1
  100. data/ext/libxml/ruby_xml_state.c +4 -4
  101. data/ext/libxml/ruby_xml_xinclude.c +21 -21
  102. data/ext/libxml/ruby_xml_xpath.c +89 -89
  103. data/ext/libxml/ruby_xml_xpath_context.c +283 -283
  104. data/ext/libxml/ruby_xml_xpath_object.c +5 -5
  105. data/ext/libxml/ruby_xml_xpointer.c +104 -104
  106. data/ext/libxml/ruby_xml_xpointer_context.c +22 -22
  107. data/ext/libxml/version.h +2 -2
  108. data/ext/libxml/version.h.rej +17 -0
  109. data/ext/mingw/Rakefile +41 -0
  110. data/{mingw → lib}/libiconv-2.dll +0 -0
  111. data/lib/libxml.rb +15 -4
  112. data/lib/libxml2-2.dll +0 -0
  113. data/lib/libxml_ruby.dll.a +0 -0
  114. data/lib/libxml_ruby.so +0 -0
  115. data/lib/xml.rb +14 -0
  116. data/lib/xml/libxml.rb +4 -1
  117. data/test/etc_doc_to_s.rb +1 -1
  118. data/test/ets_copy_bug.rb +1 -1
  119. data/test/ets_copy_bug3.rb +1 -1
  120. data/test/ets_doc_file.rb +1 -1
  121. data/test/ets_doc_to_s.rb +1 -1
  122. data/test/ets_node_gc.rb +1 -1
  123. data/test/ets_tsr.rb +1 -1
  124. data/test/model/shiporder.rnc +28 -0
  125. data/test/model/shiporder.rng +86 -0
  126. data/test/{tc_xml_attributes.rb → tc_attributes.rb} +1 -10
  127. data/test/{tc_xml_document.rb → tc_document.rb} +1 -1
  128. data/test/{tc_xml_document_write.rb → tc_document_write.rb} +1 -1
  129. data/test/{tc_xml_dtd.rb → tc_dtd.rb} +1 -1
  130. data/test/{tc_xml_html_parser.rb → tc_html_parser.rb} +1 -1
  131. data/test/{tc_xml_node.rb → tc_node.rb} +1 -1
  132. data/test/{tc_xml_node_attr.rb → tc_node_attr.rb} +1 -1
  133. data/test/{tc_xml_node_cdata.rb → tc_node_cdata.rb} +24 -5
  134. data/test/{tc_xml_node_comment.rb → tc_node_comment.rb} +1 -1
  135. data/test/{tc_xml_node_copy.rb → tc_node_copy.rb} +1 -1
  136. data/test/{tc_xml_node_edit.rb → tc_node_edit.rb} +1 -1
  137. data/test/{tc_xml_node_set.rb → tc_node_set.rb} +1 -1
  138. data/test/{tc_xml_node_set2.rb → tc_node_set2.rb} +1 -1
  139. data/test/{tc_xml_node_text.rb → tc_node_text.rb} +1 -1
  140. data/test/{tc_xml_node_xlink.rb → tc_node_xlink.rb} +2 -2
  141. data/test/{tc_xml_parser.rb → tc_parser.rb} +1 -1
  142. data/test/{tc_xml_parser_context.rb → tc_parser_context.rb} +1 -1
  143. data/test/{tc_xml_properties.rb → tc_properties.rb} +1 -7
  144. data/test/{tc_xml_reader.rb → tc_reader.rb} +1 -1
  145. data/test/tc_relaxng.rb +39 -0
  146. data/test/{tc_xml_sax_parser.rb → tc_sax_parser.rb} +1 -1
  147. data/test/{tc_xml_schema.rb → tc_schema.rb} +1 -1
  148. data/test/{tc_xml_traversal.rb → tc_traversal.rb} +1 -1
  149. data/test/{tc_xml_xinclude.rb → tc_xinclude.rb} +1 -1
  150. data/test/{tc_xml_xpath.rb → tc_xpath.rb} +1 -1
  151. data/test/{tc_xml_xpath_context.rb → tc_xpath_context.rb} +1 -1
  152. data/test/{tc_xml_xpointer.rb → tc_xpointer.rb} +1 -1
  153. data/test/test_suite.rb +26 -25
  154. metadata +103 -100
  155. data/benchmark/depixelate.rb +0 -632
  156. data/benchmark/hamlet.xml +0 -9055
  157. data/benchmark/sock_entries.xml +0 -507
  158. data/benchmark/throughput.rb +0 -39
  159. data/benchmark/xml_benchmarks.rb +0 -227
  160. data/mingw/libxml2-2.dll +0 -0
  161. data/mingw/libxml_ruby.so +0 -0
  162. data/test/gc.log +0 -0
  163. data/vc/libxml_ruby.sln +0 -20
  164. data/vc/libxml_ruby.vcproj +0 -389
@@ -78,6 +78,90 @@
78
78
 
79
79
  <div id="contextContent">
80
80
 
81
+ <div id="description">
82
+ <pre>
83
+ TODO what is this patch doing here?
84
+
85
+ xmlSchemaParserCtxtPtr parser;
86
+ xmlSchemaPtr sptr;
87
+ xmlSchemaValidCtxtPtr vptr;
88
+ </pre>
89
+ <p>
90
+ + int is_invalid;
91
+ </p>
92
+ <pre>
93
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, &quot;z&quot;, &amp;source) == FAILURE) {
94
+ return;
95
+ </pre>
96
+ <p>
97
+ @@ -598,26 +598,24 @@
98
+ </p>
99
+ <pre>
100
+ convert_to_string_ex(&amp;source);
101
+ parser = xmlSchemaNewParserCtxt(Z_STRVAL_P(source));
102
+ sptr = xmlSchemaParse(parser);
103
+ break;
104
+ case SCHEMA_BLOB:
105
+ convert_to_string_ex(&amp;source);
106
+ parser = xmlSchemaNewMemParserCtxt(Z_STRVAL_P(source), Z_STRLEN_P(source));
107
+ sptr = xmlSchemaParse(parser);
108
+ break;
109
+ }
110
+
111
+ vptr = xmlSchemaNewValidCtxt(sptr);
112
+ </pre>
113
+ <p>
114
+ + is_invalid = xmlSchemaValidateDoc(vptr, (xmlDocPtr) sxe-&gt;<a
115
+ href="Schema.html#M000222">document</a>-&gt;ptr);
116
+ </p>
117
+ <pre>
118
+ xmlSchemaFree(sptr);
119
+ xmlSchemaFreeValidCtxt(vptr);
120
+ xmlSchemaFreeParserCtxt(parser);
121
+ </pre>
122
+ <ul>
123
+ <li>if (is_valid) {
124
+
125
+ </li>
126
+ <li>RETURN_TRUE;
127
+
128
+ </li>
129
+ <li>} else {
130
+
131
+ </li>
132
+ </ul>
133
+ <p>
134
+ + if (is_invalid) {
135
+ </p>
136
+ <pre>
137
+ RETURN_FALSE;
138
+ </pre>
139
+ <p>
140
+ + } else { + RETURN_TRUE;
141
+ </p>
142
+ <pre>
143
+ }
144
+ }
145
+ }}}
146
+ </pre>
147
+ <p>
148
+ @@ -695,7 +693,7 @@
149
+ </p>
150
+ <pre>
151
+ {
152
+ if (!strcmp(method, &quot;xsearch&quot;)) {
153
+ simplexml_ce_xpath_search(INTERNAL_FUNCTION_PARAM_PASSTHRU);
154
+ </pre>
155
+ <p>
156
+ -ifdef xmlSchemaParserCtxtPtr +ifdef LIBXML_SCHEMAS_ENABLED
157
+ </p>
158
+ <pre>
159
+ } else if (!strcmp(method, &quot;validate_schema_file&quot;)) {
160
+ simplexml_ce_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, SCHEMA_FILE);
161
+ } else if (!strcmp(method, &quot;validate_schema_buffer&quot;)) {
162
+ </pre>
163
+
164
+ </div>
81
165
 
82
166
 
83
167
  </div>
@@ -86,9 +170,9 @@
86
170
  <h3 class="section-bar">Methods</h3>
87
171
 
88
172
  <div class="name-list">
89
- <a href="#M000219">document</a>&nbsp;&nbsp;
90
- <a href="#M000218">from_string</a>&nbsp;&nbsp;
91
- <a href="#M000217">new</a>&nbsp;&nbsp;
173
+ <a href="#M000222">document</a>&nbsp;&nbsp;
174
+ <a href="#M000221">from_string</a>&nbsp;&nbsp;
175
+ <a href="#M000220">new</a>&nbsp;&nbsp;
92
176
  </div>
93
177
  </div>
94
178
 
@@ -110,11 +194,11 @@
110
194
  <div id="methods">
111
195
  <h3 class="section-bar">Public Class methods</h3>
112
196
 
113
- <div id="method-M000219" class="method-detail">
114
- <a name="M000219"></a>
197
+ <div id="method-M000222" class="method-detail">
198
+ <a name="M000222"></a>
115
199
 
116
200
  <div class="method-heading">
117
- <a href="#M000219" class="method-signature">
201
+ <a href="#M000222" class="method-signature">
118
202
  <span class="method-name">XML::Schema.document(document) &rarr; schema<br />
119
203
  </span>
120
204
  </a>
@@ -122,17 +206,18 @@
122
206
 
123
207
  <div class="method-description">
124
208
  <p>
125
- Create a new schema from the specified URI.
209
+ Create a <a href="Schema.html#M000220">new</a> schema from the specified <a
210
+ href="Schema.html#M000222">document</a>.
126
211
  </p>
127
212
  <p><a class="source-toggle" href="#"
128
- onclick="toggleCode('M000219-source');return false;">[Source]</a></p>
129
- <div class="method-source-code" id="M000219-source">
213
+ onclick="toggleCode('M000222-source');return false;">[Source]</a></p>
214
+ <div class="method-source-code" id="M000222-source">
130
215
  <pre>
131
216
  /*
132
217
  * call-seq:
133
218
  * XML::Schema.document(document) -&gt; schema
134
219
  *
135
- * Create a new schema from the specified URI.
220
+ * Create a new schema from the specified document.
136
221
  */
137
222
  VALUE
138
223
  ruby_xml_schema_init_from_document(VALUE class, VALUE document) {
@@ -142,11 +227,11 @@ ruby_xml_schema_init_from_document(VALUE class, VALUE document) {
142
227
  </div>
143
228
  </div>
144
229
 
145
- <div id="method-M000218" class="method-detail">
146
- <a name="M000218"></a>
230
+ <div id="method-M000221" class="method-detail">
231
+ <a name="M000221"></a>
147
232
 
148
233
  <div class="method-heading">
149
- <a href="#M000218" class="method-signature">
234
+ <a href="#M000221" class="method-signature">
150
235
  <span class="method-name">XML::Schema.string("schema_data") &rarr; "value"<br />
151
236
  </span>
152
237
  </a>
@@ -154,11 +239,12 @@ ruby_xml_schema_init_from_document(VALUE class, VALUE document) {
154
239
 
155
240
  <div class="method-description">
156
241
  <p>
157
- Create a new schema using the specified string.
242
+ Create a <a href="Schema.html#M000220">new</a> schema using the specified
243
+ string.
158
244
  </p>
159
245
  <p><a class="source-toggle" href="#"
160
- onclick="toggleCode('M000218-source');return false;">[Source]</a></p>
161
- <div class="method-source-code" id="M000218-source">
246
+ onclick="toggleCode('M000221-source');return false;">[Source]</a></p>
247
+ <div class="method-source-code" id="M000221-source">
162
248
  <pre>
163
249
  /*
164
250
  * call-seq:
@@ -174,11 +260,11 @@ ruby_xml_schema_init_from_string(VALUE self, VALUE schema_str) {
174
260
  </div>
175
261
  </div>
176
262
 
177
- <div id="method-M000217" class="method-detail">
178
- <a name="M000217"></a>
263
+ <div id="method-M000220" class="method-detail">
264
+ <a name="M000220"></a>
179
265
 
180
266
  <div class="method-heading">
181
- <a href="#M000217" class="method-signature">
267
+ <a href="#M000220" class="method-signature">
182
268
  <span class="method-name">XML::Schema.new(schema_uri) &rarr; schema<br />
183
269
  </span>
184
270
  </a>
@@ -186,11 +272,12 @@ ruby_xml_schema_init_from_string(VALUE self, VALUE schema_str) {
186
272
 
187
273
  <div class="method-description">
188
274
  <p>
189
- Create a new schema from the specified URI.
275
+ Create a <a href="Schema.html#M000220">new</a> schema from the specified
276
+ URI.
190
277
  </p>
191
278
  <p><a class="source-toggle" href="#"
192
- onclick="toggleCode('M000217-source');return false;">[Source]</a></p>
193
- <div class="method-source-code" id="M000217-source">
279
+ onclick="toggleCode('M000220-source');return false;">[Source]</a></p>
280
+ <div class="method-source-code" id="M000220-source">
194
281
  <pre>
195
282
  /*
196
283
  * call-seq:
@@ -78,6 +78,12 @@
78
78
 
79
79
  <div id="contextContent">
80
80
 
81
+ <div id="description">
82
+ <p>
83
+ $Id$
84
+ </p>
85
+
86
+ </div>
81
87
 
82
88
 
83
89
  </div>
@@ -78,6 +78,12 @@
78
78
 
79
79
  <div id="contextContent">
80
80
 
81
+ <div id="description">
82
+ <p>
83
+ Please see the LICENSE file for copyright and distribution information
84
+ </p>
85
+
86
+ </div>
81
87
 
82
88
 
83
89
  </div>
@@ -78,6 +78,12 @@
78
78
 
79
79
  <div id="contextContent">
80
80
 
81
+ <div id="description">
82
+ <p>
83
+ Please see the LICENSE file for copyright and distribution information
84
+ </p>
85
+
86
+ </div>
81
87
 
82
88
 
83
89
  </div>
@@ -74,59 +74,15 @@
74
74
 
75
75
  <div id="description">
76
76
  <p>
77
- The <a href="XPath.html">XML::XPath</a> module is used to query <a
78
- href="../XML.html">XML</a> documents. It is usually accessed via the <a
79
- href="Document.html#M000354">XML::Document#find</a> or <a
80
- href="Node.html#M000170">XML::Node#find</a> methods. For example:
77
+ call-seq:
81
78
  </p>
82
79
  <pre>
83
- document.find('/foo', namespaces) -&gt; XML::XPath::Object
80
+ nodes.debug -&gt; (true|false)
84
81
  </pre>
85
82
  <p>
86
- The optional namespaces parameter can be a string, array or hash table.
83
+ Dump libxml debugging information to stdout. Requires Libxml be compiled
84
+ with debugging enabled.
87
85
  </p>
88
- <pre>
89
- document.find('/foo', 'xlink:http://www.w3.org/1999/xlink')
90
- document.find('/foo', ['xlink:http://www.w3.org/1999/xlink',
91
- 'xi:http://www.w3.org/2001/XInclude')
92
- document.find('/foo', 'xlink' =&gt; 'http://www.w3.org/1999/xlink',
93
- 'xi' =&gt; 'http://www.w3.org/2001/XInclude')
94
- </pre>
95
- <h3>Working With Namespaces</h3>
96
- <p>
97
- Finding namespaced elements and attributes can be tricky. Lets work through
98
- some examples using the following xml document:
99
- </p>
100
- <pre>
101
- &lt;soap:Envelope xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
102
- &lt;soap:Body&gt;
103
- &lt;getManufacturerNamesResponse xmlns=&quot;http://services.somewhere.com&quot;&gt;
104
- &lt;IDAndNameList xmlns=&quot;http://services.somewhere.com&quot;&gt;
105
- &lt;ns1:IdAndName xmlns:ns1=&quot;http://domain.somewhere.com&quot;/&gt;
106
- &lt;/IDAndNameList&gt;
107
- &lt;/getManufacturerNamesResponse&gt;
108
- &lt;/soap:Envelope&gt;
109
-
110
- # Since the soap namespace is defined on the root
111
- # node we can directly use it.
112
- doc.find('/soap:Envelope')
113
-
114
- # Since the ns1 namespace is not defined on the root node
115
- # we have to first register it with the xpath engine.
116
- doc.find('//ns1:IdAndName',
117
- 'ns1:http://domain.somewhere.com')
118
-
119
- # Since the getManufacturerNamesResponse element uses a default
120
- # namespace we first have to give it a prefix and register
121
- # it with the xpath engine.
122
- doc.find('//ns:getManufacturerNamesResponse',
123
- 'ns:http://services.somewhere.com')
124
-
125
- # Here is an example showing a complex namespace aware
126
- # xpath expression.
127
- doc.find('/soap:Envelope/soap:Body/ns0:getManufacturerNamesResponse/ns0:IDAndNameList/ns1:IdAndName',
128
- ['ns0:http://services.somewhere.com', 'ns1:http://domain.somewhere.com'])
129
- </pre>
130
86
 
131
87
  </div>
132
88
 
@@ -85,8 +85,8 @@
85
85
  The <a href="Context.html">XML::XPath::Context</a> class is used to
86
86
  evaluate <a href="../XPath.html">XPath</a> expressions. Generally, you
87
87
  should not directly use this class, but instead use the <a
88
- href="../Document.html#M000354">XML::Document#find</a> and <a
89
- href="../Node.html#M000170">XML::Node#find</a> methods.
88
+ href="../Document.html#M000359">XML::Document#find</a> and <a
89
+ href="../Node.html#M000173">XML::Node#find</a> methods.
90
90
  </p>
91
91
  <pre>
92
92
  doc = XML::Document.string('&lt;header&gt;content&lt;/header&gt;')
@@ -157,9 +157,10 @@ href="../Node.html#M000170">XML::Node#find</a> methods.
157
157
 
158
158
  <div class="method-description">
159
159
  <p>
160
- Creates a new <a href="../XPath.html">XPath</a> context for the specified
161
- document. The context can then be used to evaluate an <a
162
- href="../XPath.html">XPath</a> expression.
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.
163
164
  </p>
164
165
  <pre>
165
166
  doc = XML::Document.string('&lt;header&gt;&lt;first&gt;hi&lt;/first&gt;&lt;/header&gt;')
@@ -78,6 +78,67 @@
78
78
 
79
79
  <div id="contextContent">
80
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>
81
142
 
82
143
 
83
144
  </div>
@@ -160,7 +160,7 @@ href="../XPointer.html">XML::XPointer</a> expression.
160
160
 
161
161
  <div class="method-description">
162
162
  <p>
163
- array index into set of nodes
163
+ array index into <a href="Object.html#M000017">set</a> of nodes
164
164
  </p>
165
165
  <p><a class="source-toggle" href="#"
166
166
  onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
@@ -226,7 +226,8 @@ ruby_xml_xpath_object_debug(VALUE self) {
226
226
 
227
227
  <div class="method-description">
228
228
  <p>
229
- Call the supplied block for each node in this set.
229
+ Call the supplied block for <a href="Object.html#M000007">each</a> node in
230
+ this <a href="Object.html#M000017">set</a>.
230
231
  </p>
231
232
  <p><a class="source-toggle" href="#"
232
233
  onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
@@ -303,7 +304,8 @@ ruby_xml_xpath_object_empty_q(VALUE self) {
303
304
 
304
305
  <div class="method-description">
305
306
  <p>
306
- Returns the first node in this node set, or nil if none exist.
307
+ Returns the <a href="Object.html#M000010">first</a> node in this node <a
308
+ href="Object.html#M000017">set</a>, or nil if none exist.
307
309
  </p>
308
310
  <p><a class="source-toggle" href="#"
309
311
  onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
@@ -335,7 +337,8 @@ ruby_xml_xpath_object_first(VALUE self) {
335
337
 
336
338
  <div class="method-description">
337
339
  <p>
338
- Obtain the length of the nodesetval node list.
340
+ Obtain the <a href="Object.html#M000011">length</a> of the nodesetval node
341
+ list.
339
342
  </p>
340
343
  <p><a class="source-toggle" href="#"
341
344
  onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
@@ -413,7 +416,8 @@ ruby_xml_xpath_object_set(VALUE self)
413
416
 
414
417
  <div class="method-description">
415
418
  <p>
416
- Obtain the length of the nodesetval node list.
419
+ Obtain the <a href="Object.html#M000011">length</a> of the nodesetval node
420
+ list.
417
421
  </p>
418
422
  <p><a class="source-toggle" href="#"
419
423
  onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
@@ -445,8 +449,8 @@ ruby_xml_xpath_object_length(VALUE self) {
445
449
 
446
450
  <div class="method-description">
447
451
  <p>
448
- Returns the original <a href="../XPath.html">XPath</a> expression as a
449
- string.
452
+ Returns the original <a href="../XPath.html">XPath</a> expression as a <a
453
+ href="Object.html#M000015">string</a>.
450
454
  </p>
451
455
  <p><a class="source-toggle" href="#"
452
456
  onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
@@ -487,7 +491,7 @@ ruby_xml_xpath_object_string(VALUE self)
487
491
 
488
492
  <div class="method-description">
489
493
  <p>
490
- Obtain an array of the nodes in this set.
494
+ Obtain an array of the nodes in this <a href="Object.html#M000017">set</a>.
491
495
  </p>
492
496
  <p><a class="source-toggle" href="#"
493
497
  onclick="toggleCode('M000013-source');return false;">[Source]</a></p>