nokogiri 1.11.0.rc1-java → 1.11.2-java

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/LICENSE-DEPENDENCIES.md +1015 -947
  4. data/LICENSE.md +1 -1
  5. data/README.md +171 -94
  6. data/ext/java/nokogiri/EncodingHandler.java +78 -59
  7. data/ext/java/nokogiri/HtmlDocument.java +137 -114
  8. data/ext/java/nokogiri/HtmlElementDescription.java +104 -87
  9. data/ext/java/nokogiri/HtmlEntityLookup.java +31 -26
  10. data/ext/java/nokogiri/HtmlSaxParserContext.java +220 -192
  11. data/ext/java/nokogiri/HtmlSaxPushParser.java +164 -139
  12. data/ext/java/nokogiri/NokogiriService.java +597 -526
  13. data/ext/java/nokogiri/XmlAttr.java +120 -96
  14. data/ext/java/nokogiri/XmlAttributeDecl.java +97 -76
  15. data/ext/java/nokogiri/XmlCdata.java +35 -26
  16. data/ext/java/nokogiri/XmlComment.java +48 -37
  17. data/ext/java/nokogiri/XmlDocument.java +642 -540
  18. data/ext/java/nokogiri/XmlDocumentFragment.java +127 -107
  19. data/ext/java/nokogiri/XmlDtd.java +450 -384
  20. data/ext/java/nokogiri/XmlElement.java +25 -18
  21. data/ext/java/nokogiri/XmlElementContent.java +345 -286
  22. data/ext/java/nokogiri/XmlElementDecl.java +126 -95
  23. data/ext/java/nokogiri/XmlEntityDecl.java +121 -97
  24. data/ext/java/nokogiri/XmlEntityReference.java +51 -42
  25. data/ext/java/nokogiri/XmlNamespace.java +177 -145
  26. data/ext/java/nokogiri/XmlNode.java +1843 -1590
  27. data/ext/java/nokogiri/XmlNodeSet.java +361 -299
  28. data/ext/java/nokogiri/XmlProcessingInstruction.java +49 -39
  29. data/ext/java/nokogiri/XmlReader.java +513 -418
  30. data/ext/java/nokogiri/XmlRelaxng.java +92 -72
  31. data/ext/java/nokogiri/XmlSaxParserContext.java +330 -280
  32. data/ext/java/nokogiri/XmlSaxPushParser.java +229 -190
  33. data/ext/java/nokogiri/XmlSchema.java +335 -210
  34. data/ext/java/nokogiri/XmlSyntaxError.java +113 -87
  35. data/ext/java/nokogiri/XmlText.java +57 -46
  36. data/ext/java/nokogiri/XmlXpathContext.java +242 -178
  37. data/ext/java/nokogiri/XsltStylesheet.java +282 -239
  38. data/ext/java/nokogiri/internals/ClosedStreamException.java +5 -2
  39. data/ext/java/nokogiri/internals/HtmlDomParserContext.java +203 -160
  40. data/ext/java/nokogiri/internals/IgnoreSchemaErrorsErrorHandler.java +17 -10
  41. data/ext/java/nokogiri/internals/NokogiriBlockingQueueInputStream.java +43 -16
  42. data/ext/java/nokogiri/internals/NokogiriDomParser.java +65 -50
  43. data/ext/java/nokogiri/internals/NokogiriEntityResolver.java +107 -88
  44. data/ext/java/nokogiri/internals/NokogiriErrorHandler.java +25 -18
  45. data/ext/java/nokogiri/internals/NokogiriHandler.java +316 -254
  46. data/ext/java/nokogiri/internals/NokogiriHelpers.java +738 -622
  47. data/ext/java/nokogiri/internals/NokogiriNamespaceCache.java +186 -143
  48. data/ext/java/nokogiri/internals/NokogiriNamespaceContext.java +81 -59
  49. data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler.java +66 -49
  50. data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler4NekoHtml.java +86 -69
  51. data/ext/java/nokogiri/internals/NokogiriStrictErrorHandler.java +44 -29
  52. data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +121 -48
  53. data/ext/java/nokogiri/internals/NokogiriXPathFunctionResolver.java +34 -22
  54. data/ext/java/nokogiri/internals/NokogiriXPathVariableResolver.java +25 -17
  55. data/ext/java/nokogiri/internals/NokogiriXsltErrorListener.java +57 -42
  56. data/ext/java/nokogiri/internals/ParserContext.java +206 -179
  57. data/ext/java/nokogiri/internals/ReaderNode.java +478 -371
  58. data/ext/java/nokogiri/internals/SaveContextVisitor.java +822 -707
  59. data/ext/java/nokogiri/internals/SchemaErrorHandler.java +28 -19
  60. data/ext/java/nokogiri/internals/XalanDTMManagerPatch.java +129 -123
  61. data/ext/java/nokogiri/internals/XmlDeclHandler.java +5 -4
  62. data/ext/java/nokogiri/internals/XmlDomParserContext.java +208 -177
  63. data/ext/java/nokogiri/internals/XmlSaxParser.java +24 -17
  64. data/ext/java/nokogiri/internals/c14n/AttrCompare.java +71 -68
  65. data/ext/java/nokogiri/internals/c14n/C14nHelper.java +137 -118
  66. data/ext/java/nokogiri/internals/c14n/CanonicalFilter.java +27 -21
  67. data/ext/java/nokogiri/internals/c14n/CanonicalizationException.java +74 -61
  68. data/ext/java/nokogiri/internals/c14n/Canonicalizer.java +230 -205
  69. data/ext/java/nokogiri/internals/c14n/Canonicalizer11.java +572 -547
  70. data/ext/java/nokogiri/internals/c14n/Canonicalizer11_OmitComments.java +17 -10
  71. data/ext/java/nokogiri/internals/c14n/Canonicalizer11_WithComments.java +17 -10
  72. data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315.java +323 -302
  73. data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315Excl.java +232 -219
  74. data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclOmitComments.java +22 -15
  75. data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclWithComments.java +23 -16
  76. data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315OmitComments.java +23 -16
  77. data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315WithComments.java +22 -15
  78. data/ext/java/nokogiri/internals/c14n/CanonicalizerBase.java +575 -545
  79. data/ext/java/nokogiri/internals/c14n/CanonicalizerPhysical.java +141 -120
  80. data/ext/java/nokogiri/internals/c14n/CanonicalizerSpi.java +39 -38
  81. data/ext/java/nokogiri/internals/c14n/Constants.java +13 -10
  82. data/ext/java/nokogiri/internals/c14n/ElementProxy.java +279 -247
  83. data/ext/java/nokogiri/internals/c14n/HelperNodeList.java +66 -53
  84. data/ext/java/nokogiri/internals/c14n/IgnoreAllErrorHandler.java +44 -37
  85. data/ext/java/nokogiri/internals/c14n/InclusiveNamespaces.java +135 -120
  86. data/ext/java/nokogiri/internals/c14n/InvalidCanonicalizerException.java +59 -48
  87. data/ext/java/nokogiri/internals/c14n/NameSpaceSymbTable.java +384 -334
  88. data/ext/java/nokogiri/internals/c14n/NodeFilter.java +25 -24
  89. data/ext/java/nokogiri/internals/c14n/UtfHelpper.java +151 -140
  90. data/ext/java/nokogiri/internals/c14n/XMLUtils.java +456 -423
  91. data/ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java +1466 -1500
  92. data/ext/java/nokogiri/internals/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java +626 -570
  93. data/ext/nokogiri/depend +37 -358
  94. data/ext/nokogiri/extconf.rb +585 -374
  95. data/ext/nokogiri/html_document.c +78 -82
  96. data/ext/nokogiri/html_element_description.c +84 -71
  97. data/ext/nokogiri/html_entity_lookup.c +21 -16
  98. data/ext/nokogiri/html_sax_parser_context.c +69 -66
  99. data/ext/nokogiri/html_sax_push_parser.c +42 -34
  100. data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
  101. data/ext/nokogiri/nokogiri.c +192 -93
  102. data/ext/nokogiri/test_global_handlers.c +40 -0
  103. data/ext/nokogiri/xml_attr.c +15 -15
  104. data/ext/nokogiri/xml_attribute_decl.c +18 -18
  105. data/ext/nokogiri/xml_cdata.c +13 -18
  106. data/ext/nokogiri/xml_comment.c +19 -26
  107. data/ext/nokogiri/xml_document.c +225 -163
  108. data/ext/nokogiri/xml_document_fragment.c +13 -15
  109. data/ext/nokogiri/xml_dtd.c +54 -48
  110. data/ext/nokogiri/xml_element_content.c +30 -27
  111. data/ext/nokogiri/xml_element_decl.c +22 -22
  112. data/ext/nokogiri/xml_encoding_handler.c +17 -11
  113. data/ext/nokogiri/xml_entity_decl.c +32 -30
  114. data/ext/nokogiri/xml_entity_reference.c +16 -18
  115. data/ext/nokogiri/xml_namespace.c +56 -49
  116. data/ext/nokogiri/xml_node.c +338 -286
  117. data/ext/nokogiri/xml_node_set.c +168 -156
  118. data/ext/nokogiri/xml_processing_instruction.c +17 -19
  119. data/ext/nokogiri/xml_reader.c +195 -172
  120. data/ext/nokogiri/xml_relax_ng.c +52 -28
  121. data/ext/nokogiri/xml_sax_parser.c +118 -118
  122. data/ext/nokogiri/xml_sax_parser_context.c +103 -86
  123. data/ext/nokogiri/xml_sax_push_parser.c +36 -27
  124. data/ext/nokogiri/xml_schema.c +111 -34
  125. data/ext/nokogiri/xml_syntax_error.c +42 -21
  126. data/ext/nokogiri/xml_text.c +13 -17
  127. data/ext/nokogiri/xml_xpath_context.c +206 -123
  128. data/ext/nokogiri/xslt_stylesheet.c +158 -161
  129. data/lib/nokogiri.rb +4 -8
  130. data/lib/nokogiri/css/parser.rb +62 -62
  131. data/lib/nokogiri/css/parser.y +2 -2
  132. data/lib/nokogiri/css/parser_extras.rb +38 -36
  133. data/lib/nokogiri/css/xpath_visitor.rb +70 -42
  134. data/lib/nokogiri/extension.rb +26 -0
  135. data/lib/nokogiri/html/document.rb +12 -26
  136. data/lib/nokogiri/html/document_fragment.rb +15 -15
  137. data/lib/nokogiri/nokogiri.jar +0 -0
  138. data/lib/nokogiri/version.rb +2 -148
  139. data/lib/nokogiri/version/constant.rb +5 -0
  140. data/lib/nokogiri/version/info.rb +205 -0
  141. data/lib/nokogiri/xml/builder.rb +2 -2
  142. data/lib/nokogiri/xml/document.rb +48 -18
  143. data/lib/nokogiri/xml/document_fragment.rb +4 -6
  144. data/lib/nokogiri/xml/node.rb +599 -279
  145. data/lib/nokogiri/xml/parse_options.rb +6 -0
  146. data/lib/nokogiri/xml/reader.rb +2 -9
  147. data/lib/nokogiri/xml/relax_ng.rb +6 -2
  148. data/lib/nokogiri/xml/schema.rb +12 -4
  149. data/lib/nokogiri/xml/searchable.rb +24 -16
  150. data/lib/nokogiri/xml/xpath.rb +1 -3
  151. data/lib/nokogiri/xml/xpath/syntax_error.rb +1 -1
  152. metadata +87 -158
  153. data/ext/nokogiri/html_document.h +0 -10
  154. data/ext/nokogiri/html_element_description.h +0 -10
  155. data/ext/nokogiri/html_entity_lookup.h +0 -8
  156. data/ext/nokogiri/html_sax_parser_context.h +0 -11
  157. data/ext/nokogiri/html_sax_push_parser.h +0 -9
  158. data/ext/nokogiri/nokogiri.h +0 -122
  159. data/ext/nokogiri/xml_attr.h +0 -9
  160. data/ext/nokogiri/xml_attribute_decl.h +0 -9
  161. data/ext/nokogiri/xml_cdata.h +0 -9
  162. data/ext/nokogiri/xml_comment.h +0 -9
  163. data/ext/nokogiri/xml_document.h +0 -23
  164. data/ext/nokogiri/xml_document_fragment.h +0 -10
  165. data/ext/nokogiri/xml_dtd.h +0 -10
  166. data/ext/nokogiri/xml_element_content.h +0 -10
  167. data/ext/nokogiri/xml_element_decl.h +0 -9
  168. data/ext/nokogiri/xml_encoding_handler.h +0 -8
  169. data/ext/nokogiri/xml_entity_decl.h +0 -10
  170. data/ext/nokogiri/xml_entity_reference.h +0 -9
  171. data/ext/nokogiri/xml_io.c +0 -61
  172. data/ext/nokogiri/xml_io.h +0 -11
  173. data/ext/nokogiri/xml_libxml2_hacks.c +0 -112
  174. data/ext/nokogiri/xml_libxml2_hacks.h +0 -12
  175. data/ext/nokogiri/xml_namespace.h +0 -14
  176. data/ext/nokogiri/xml_node.h +0 -13
  177. data/ext/nokogiri/xml_node_set.h +0 -12
  178. data/ext/nokogiri/xml_processing_instruction.h +0 -9
  179. data/ext/nokogiri/xml_reader.h +0 -10
  180. data/ext/nokogiri/xml_relax_ng.h +0 -9
  181. data/ext/nokogiri/xml_sax_parser.h +0 -39
  182. data/ext/nokogiri/xml_sax_parser_context.h +0 -10
  183. data/ext/nokogiri/xml_sax_push_parser.h +0 -9
  184. data/ext/nokogiri/xml_schema.h +0 -9
  185. data/ext/nokogiri/xml_syntax_error.h +0 -13
  186. data/ext/nokogiri/xml_text.h +0 -9
  187. data/ext/nokogiri/xml_xpath_context.h +0 -10
  188. data/ext/nokogiri/xslt_stylesheet.h +0 -14
@@ -1,10 +0,0 @@
1
- #ifndef NOKOGIRI_HTML_DOCUMENT
2
- #define NOKOGIRI_HTML_DOCUMENT
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_html_document();
7
-
8
- extern VALUE cNokogiriHtmlDocument ;
9
-
10
- #endif
@@ -1,10 +0,0 @@
1
- #ifndef NOKOGIRI_HTML_ELEMENT_DESCRIPTION
2
- #define NOKOGIRI_HTML_ELEMENT_DESCRIPTION
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_html_element_description();
7
-
8
- extern VALUE cNokogiriHtmlElementDescription ;
9
-
10
- #endif
@@ -1,8 +0,0 @@
1
- #ifndef NOKOGIRI_HTML_ENTITY_LOOKUP
2
- #define NOKOGIRI_HTML_ENTITY_LOOKUP
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_html_entity_lookup();
7
-
8
- #endif
@@ -1,11 +0,0 @@
1
- #ifndef NOKOGIRI_HTML_SAX_PARSER_CONTEXT
2
- #define NOKOGIRI_HTML_SAX_PARSER_CONTEXT
3
-
4
- #include <nokogiri.h>
5
-
6
- extern VALUE cNokogiriHtmlSaxParserContext;
7
-
8
- void init_html_sax_parser_context();
9
-
10
- #endif
11
-
@@ -1,9 +0,0 @@
1
- #ifndef NOKOGIRI_HTML_SAX_PUSH_PARSER
2
- #define NOKOGIRI_HTML_SAX_PUSH_PARSER
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_html_sax_push_parser();
7
-
8
- extern VALUE cNokogiriHtmlSaxPushParser ;
9
- #endif
@@ -1,122 +0,0 @@
1
- #ifndef NOKOGIRI_NATIVE
2
- #define NOKOGIRI_NATIVE
3
-
4
- #include <stdlib.h>
5
- #include <string.h>
6
- #include <assert.h>
7
- #include <stdarg.h>
8
-
9
- #ifdef USE_INCLUDED_VASPRINTF
10
- int vasprintf (char **strp, const char *fmt, va_list ap);
11
- #else
12
-
13
- #define _GNU_SOURCE
14
- # include <stdio.h>
15
- #undef _GNU_SOURCE
16
-
17
- #endif
18
-
19
- #include <libxml/parser.h>
20
- #include <libxml/entities.h>
21
- #include <libxml/parserInternals.h>
22
- #include <libxml/xpath.h>
23
- #include <libxml/xpathInternals.h>
24
- #include <libxml/xmlreader.h>
25
- #include <libxml/xmlsave.h>
26
- #include <libxml/xmlschemas.h>
27
- #include <libxml/HTMLparser.h>
28
- #include <libxml/HTMLtree.h>
29
- #include <libxml/relaxng.h>
30
- #include <libxml/xinclude.h>
31
- #include <libxslt/extensions.h>
32
- #include <libxslt/xsltconfig.h>
33
- #include <libxml/c14n.h>
34
- #include <ruby.h>
35
- #include <ruby/st.h>
36
- #include <ruby/encoding.h>
37
-
38
- #ifndef NORETURN
39
- # if defined(__GNUC__)
40
- # define NORETURN(name) __attribute__((noreturn)) name
41
- # else
42
- # define NORETURN(name) name
43
- # endif
44
- #endif
45
-
46
- #define NOKOGIRI_STR_NEW2(str) \
47
- NOKOGIRI_STR_NEW(str, strlen((const char *)(str)))
48
-
49
- #define NOKOGIRI_STR_NEW(str, len) \
50
- rb_external_str_new_with_enc((const char *)(str), (long)(len), rb_utf8_encoding())
51
-
52
- #define RBSTR_OR_QNIL(_str) \
53
- (_str ? NOKOGIRI_STR_NEW2(_str) : Qnil)
54
-
55
- #include <xml_libxml2_hacks.h>
56
-
57
- #include <xml_io.h>
58
- #include <xml_document.h>
59
- #include <html_entity_lookup.h>
60
- #include <html_document.h>
61
- #include <xml_node.h>
62
- #include <xml_text.h>
63
- #include <xml_cdata.h>
64
- #include <xml_attr.h>
65
- #include <xml_processing_instruction.h>
66
- #include <xml_entity_reference.h>
67
- #include <xml_document_fragment.h>
68
- #include <xml_comment.h>
69
- #include <xml_node_set.h>
70
- #include <xml_dtd.h>
71
- #include <xml_attribute_decl.h>
72
- #include <xml_element_decl.h>
73
- #include <xml_entity_decl.h>
74
- #include <xml_xpath_context.h>
75
- #include <xml_element_content.h>
76
- #include <xml_sax_parser_context.h>
77
- #include <xml_sax_parser.h>
78
- #include <xml_sax_push_parser.h>
79
- #include <xml_reader.h>
80
- #include <html_sax_parser_context.h>
81
- #include <html_sax_push_parser.h>
82
- #include <xslt_stylesheet.h>
83
- #include <xml_syntax_error.h>
84
- #include <xml_schema.h>
85
- #include <xml_relax_ng.h>
86
- #include <html_element_description.h>
87
- #include <xml_namespace.h>
88
- #include <xml_encoding_handler.h>
89
-
90
- extern VALUE mNokogiri ;
91
- extern VALUE mNokogiriXml ;
92
- extern VALUE mNokogiriXmlSax ;
93
- extern VALUE mNokogiriHtml ;
94
- extern VALUE mNokogiriHtmlSax ;
95
- extern VALUE mNokogiriXslt ;
96
-
97
- void nokogiri_root_node(xmlNodePtr);
98
- void nokogiri_root_nsdef(xmlNsPtr, xmlDocPtr);
99
-
100
- #ifdef DEBUG
101
-
102
- #define NOKOGIRI_DEBUG_START(p) if (getenv("NOKOGIRI_NO_FREE")) return ; if (getenv("NOKOGIRI_DEBUG")) fprintf(stderr,"nokogiri: %s:%d %p start\n", __FILE__, __LINE__, p);
103
- #define NOKOGIRI_DEBUG_END(p) if (getenv("NOKOGIRI_DEBUG")) fprintf(stderr,"nokogiri: %s:%d %p end\n", __FILE__, __LINE__, p);
104
-
105
- #else
106
-
107
- #define NOKOGIRI_DEBUG_START(p)
108
- #define NOKOGIRI_DEBUG_END(p)
109
-
110
- #endif
111
-
112
- #ifndef __builtin_expect
113
- # if defined(__GNUC__)
114
- # define __builtin_expect(expr, c) __builtin_expect((long)(expr), (long)(c))
115
- # endif
116
- #endif
117
-
118
- #define XMLNS_PREFIX "xmlns"
119
- #define XMLNS_PREFIX_LEN 6 /* including either colon or \0 */
120
- #define XMLNS_BUFFER_LEN 128
121
-
122
- #endif
@@ -1,9 +0,0 @@
1
- #ifndef NOKOGIRI_XML_ATTR
2
- #define NOKOGIRI_XML_ATTR
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_attr();
7
-
8
- extern VALUE cNokogiriXmlAttr;
9
- #endif
@@ -1,9 +0,0 @@
1
- #ifndef NOKOGIRI_XML_ATTRIBUTE_DECL
2
- #define NOKOGIRI_XML_ATTRIBUTE_DECL
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_attribute_decl();
7
-
8
- extern VALUE cNokogiriXmlAttributeDecl;
9
- #endif
@@ -1,9 +0,0 @@
1
- #ifndef NOKOGIRI_XML_CDATA
2
- #define NOKOGIRI_XML_CDATA
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_cdata();
7
-
8
- extern VALUE cNokogiriXmlCData;
9
- #endif
@@ -1,9 +0,0 @@
1
- #ifndef NOKOGIRI_XML_COMMENT
2
- #define NOKOGIRI_XML_COMMENT
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_comment();
7
-
8
- extern VALUE cNokogiriXmlComment;
9
- #endif
@@ -1,23 +0,0 @@
1
- #ifndef NOKOGIRI_XML_DOCUMENT
2
- #define NOKOGIRI_XML_DOCUMENT
3
-
4
- #include <nokogiri.h>
5
-
6
- struct _nokogiriTuple {
7
- VALUE doc;
8
- st_table *unlinkedNodes;
9
- VALUE node_cache;
10
- };
11
- typedef struct _nokogiriTuple nokogiriTuple;
12
- typedef nokogiriTuple * nokogiriTuplePtr;
13
-
14
- void init_xml_document();
15
- VALUE Nokogiri_wrap_xml_document(VALUE klass, xmlDocPtr doc);
16
-
17
- #define DOC_RUBY_OBJECT_TEST(x) ((nokogiriTuplePtr)(x->_private))
18
- #define DOC_RUBY_OBJECT(x) (((nokogiriTuplePtr)(x->_private))->doc)
19
- #define DOC_UNLINKED_NODE_HASH(x) (((nokogiriTuplePtr)(x->_private))->unlinkedNodes)
20
- #define DOC_NODE_CACHE(x) (((nokogiriTuplePtr)(x->_private))->node_cache)
21
-
22
- extern VALUE cNokogiriXmlDocument ;
23
- #endif
@@ -1,10 +0,0 @@
1
- #ifndef NOKOGIRI_XML_DOCUMENT_FRAGMENT
2
- #define NOKOGIRI_XML_DOCUMENT_FRAGMENT
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_document_fragment();
7
-
8
- extern VALUE cNokogiriXmlDocumentFragment;
9
- #endif
10
-
@@ -1,10 +0,0 @@
1
- #ifndef NOKOGIRI_XML_DTD
2
- #define NOKOGIRI_XML_DTD
3
-
4
- #include <nokogiri.h>
5
-
6
- extern VALUE cNokogiriXmlDtd;
7
-
8
- void init_xml_dtd();
9
-
10
- #endif
@@ -1,10 +0,0 @@
1
- #ifndef NOKOGIRI_XML_ELEMENT_CONTENT
2
- #define NOKOGIRI_XML_ELEMENT_CONTENT
3
-
4
- #include <nokogiri.h>
5
-
6
-
7
- VALUE Nokogiri_wrap_element_content(VALUE doc, xmlElementContentPtr element);
8
- void init_xml_element_content();
9
-
10
- #endif
@@ -1,9 +0,0 @@
1
- #ifndef NOKOGIRI_XML_ELEMENT_DECL
2
- #define NOKOGIRI_XML_ELEMENT_DECL
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_element_decl();
7
-
8
- extern VALUE cNokogiriXmlElementDecl;
9
- #endif
@@ -1,8 +0,0 @@
1
- #ifndef NOKOGIRI_XML_ENCODING_HANDLER
2
- #define NOKOGIRI_XML_ENCODING_HANDLER
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_encoding_handler();
7
-
8
- #endif
@@ -1,10 +0,0 @@
1
- #ifndef NOKOGIRI_XML_ENTITY_DECL
2
- #define NOKOGIRI_XML_ENTITY_DECL
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_entity_decl();
7
-
8
- extern VALUE cNokogiriXmlEntityDecl;
9
- #endif
10
-
@@ -1,9 +0,0 @@
1
- #ifndef NOKOGIRI_XML_ENTITY_REFERENCE
2
- #define NOKOGIRI_XML_ENTITY_REFERENCE
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_entity_reference();
7
-
8
- extern VALUE cNokogiriXmlEntityReference;
9
- #endif
@@ -1,61 +0,0 @@
1
- #include <xml_io.h>
2
-
3
- static ID id_read, id_write;
4
-
5
- VALUE read_check(VALUE *args) {
6
- return rb_funcall(args[0], id_read, 1, args[1]);
7
- }
8
-
9
- VALUE read_failed(void) {
10
- return Qundef;
11
- }
12
-
13
- int io_read_callback(void * ctx, char * buffer, int len) {
14
- VALUE string, args[2];
15
- size_t str_len, safe_len;
16
-
17
- args[0] = (VALUE)ctx;
18
- args[1] = INT2NUM(len);
19
-
20
- string = rb_rescue(read_check, (VALUE)args, read_failed, 0);
21
-
22
- if (NIL_P(string)) return 0;
23
- if (string == Qundef) return -1;
24
- if (TYPE(string) != T_STRING) return -1;
25
-
26
- str_len = (size_t)RSTRING_LEN(string);
27
- safe_len = str_len > (size_t)len ? (size_t)len : str_len;
28
- memcpy(buffer, StringValuePtr(string), safe_len);
29
-
30
- return (int)safe_len;
31
- }
32
-
33
- VALUE write_check(VALUE *args) {
34
- return rb_funcall(args[0], id_write, 1, args[1]);
35
- }
36
-
37
- VALUE write_failed(void) {
38
- return Qundef;
39
- }
40
-
41
- int io_write_callback(void * ctx, char * buffer, int len) {
42
- VALUE args[2], size;
43
-
44
- args[0] = (VALUE)ctx;
45
- args[1] = rb_str_new(buffer, (long)len);
46
-
47
- size = rb_rescue(write_check, (VALUE)args, write_failed, 0);
48
-
49
- if (size == Qundef) return -1;
50
-
51
- return NUM2INT(size);
52
- }
53
-
54
- int io_close_callback(void * ctx) {
55
- return 0;
56
- }
57
-
58
- void init_nokogiri_io() {
59
- id_read = rb_intern("read");
60
- id_write = rb_intern("write");
61
- }
@@ -1,11 +0,0 @@
1
- #ifndef NOKOGIRI_XML_IO
2
- #define NOKOGIRI_XML_IO
3
-
4
- #include <nokogiri.h>
5
-
6
- int io_read_callback(void * ctx, char * buffer, int len);
7
- int io_write_callback(void * ctx, char * buffer, int len);
8
- int io_close_callback(void * ctx);
9
- void init_nokogiri_io();
10
-
11
- #endif
@@ -1,112 +0,0 @@
1
- #ifndef HAVE_XMLFIRSTELEMENTCHILD
2
- #include <libxml/tree.h>
3
- /**
4
- * xmlFirstElementChild:
5
- * @parent: the parent node
6
- *
7
- * Finds the first child node of that element which is a Element node
8
- * Note the handling of entities references is different than in
9
- * the W3C DOM element traversal spec since we don't have back reference
10
- * from entities content to entities references.
11
- *
12
- * Returns the first element child or NULL if not available
13
- */
14
- xmlNodePtr
15
- xmlFirstElementChild(xmlNodePtr parent) {
16
- xmlNodePtr cur = NULL;
17
-
18
- if (parent == NULL)
19
- return(NULL);
20
- switch (parent->type) {
21
- case XML_ELEMENT_NODE:
22
- case XML_ENTITY_NODE:
23
- case XML_DOCUMENT_NODE:
24
- case XML_HTML_DOCUMENT_NODE:
25
- cur = parent->children;
26
- break;
27
- default:
28
- return(NULL);
29
- }
30
- while (cur != NULL) {
31
- if (cur->type == XML_ELEMENT_NODE)
32
- return(cur);
33
- cur = cur->next;
34
- }
35
- return(NULL);
36
- }
37
-
38
- /**
39
- * xmlNextElementSibling:
40
- * @node: the current node
41
- *
42
- * Finds the first closest next sibling of the node which is an
43
- * element node.
44
- * Note the handling of entities references is different than in
45
- * the W3C DOM element traversal spec since we don't have back reference
46
- * from entities content to entities references.
47
- *
48
- * Returns the next element sibling or NULL if not available
49
- */
50
- xmlNodePtr
51
- xmlNextElementSibling(xmlNodePtr node) {
52
- if (node == NULL)
53
- return(NULL);
54
- switch (node->type) {
55
- case XML_ELEMENT_NODE:
56
- case XML_TEXT_NODE:
57
- case XML_CDATA_SECTION_NODE:
58
- case XML_ENTITY_REF_NODE:
59
- case XML_ENTITY_NODE:
60
- case XML_PI_NODE:
61
- case XML_COMMENT_NODE:
62
- case XML_DTD_NODE:
63
- case XML_XINCLUDE_START:
64
- case XML_XINCLUDE_END:
65
- node = node->next;
66
- break;
67
- default:
68
- return(NULL);
69
- }
70
- while (node != NULL) {
71
- if (node->type == XML_ELEMENT_NODE)
72
- return(node);
73
- node = node->next;
74
- }
75
- return(NULL);
76
- }
77
-
78
- /**
79
- * xmlLastElementChild:
80
- * @parent: the parent node
81
- *
82
- * Finds the last child node of that element which is a Element node
83
- * Note the handling of entities references is different than in
84
- * the W3C DOM element traversal spec since we don't have back reference
85
- * from entities content to entities references.
86
- *
87
- * Returns the last element child or NULL if not available
88
- */
89
- xmlNodePtr
90
- xmlLastElementChild(xmlNodePtr parent) {
91
- xmlNodePtr cur = NULL;
92
-
93
- if (parent == NULL)
94
- return(NULL);
95
- switch (parent->type) {
96
- case XML_ELEMENT_NODE:
97
- case XML_ENTITY_NODE:
98
- case XML_DOCUMENT_NODE:
99
- case XML_HTML_DOCUMENT_NODE:
100
- cur = parent->last;
101
- break;
102
- default:
103
- return(NULL);
104
- }
105
- while (cur != NULL) {
106
- if (cur->type == XML_ELEMENT_NODE)
107
- return(cur);
108
- cur = cur->prev;
109
- }
110
- return(NULL);
111
- }
112
- #endif