Nokogiri_precompiled_aarch64_dedshit 1.14.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +44 -0
- data/LICENSE-DEPENDENCIES.md +2224 -0
- data/LICENSE.md +9 -0
- data/README.md +287 -0
- data/bin/nokogiri +131 -0
- data/dependencies.yml +41 -0
- data/ext/java/nokogiri/Html4Document.java +157 -0
- data/ext/java/nokogiri/Html4ElementDescription.java +133 -0
- data/ext/java/nokogiri/Html4EntityLookup.java +63 -0
- data/ext/java/nokogiri/Html4SaxParserContext.java +289 -0
- data/ext/java/nokogiri/Html4SaxPushParser.java +213 -0
- data/ext/java/nokogiri/NokogiriService.java +613 -0
- data/ext/java/nokogiri/XmlAttr.java +154 -0
- data/ext/java/nokogiri/XmlAttributeDecl.java +119 -0
- data/ext/java/nokogiri/XmlCdata.java +60 -0
- data/ext/java/nokogiri/XmlComment.java +77 -0
- data/ext/java/nokogiri/XmlDocument.java +705 -0
- data/ext/java/nokogiri/XmlDocumentFragment.java +163 -0
- data/ext/java/nokogiri/XmlDtd.java +516 -0
- data/ext/java/nokogiri/XmlElement.java +44 -0
- data/ext/java/nokogiri/XmlElementContent.java +412 -0
- data/ext/java/nokogiri/XmlElementDecl.java +148 -0
- data/ext/java/nokogiri/XmlEntityDecl.java +151 -0
- data/ext/java/nokogiri/XmlEntityReference.java +79 -0
- data/ext/java/nokogiri/XmlNamespace.java +193 -0
- data/ext/java/nokogiri/XmlNode.java +1938 -0
- data/ext/java/nokogiri/XmlNodeSet.java +463 -0
- data/ext/java/nokogiri/XmlProcessingInstruction.java +79 -0
- data/ext/java/nokogiri/XmlReader.java +615 -0
- data/ext/java/nokogiri/XmlRelaxng.java +133 -0
- data/ext/java/nokogiri/XmlSaxParserContext.java +329 -0
- data/ext/java/nokogiri/XmlSaxPushParser.java +288 -0
- data/ext/java/nokogiri/XmlSchema.java +423 -0
- data/ext/java/nokogiri/XmlSyntaxError.java +137 -0
- data/ext/java/nokogiri/XmlText.java +90 -0
- data/ext/java/nokogiri/XmlXpathContext.java +305 -0
- data/ext/java/nokogiri/XsltStylesheet.java +368 -0
- data/ext/java/nokogiri/internals/ClosedStreamException.java +13 -0
- data/ext/java/nokogiri/internals/HtmlDomParserContext.java +252 -0
- data/ext/java/nokogiri/internals/IgnoreSchemaErrorsErrorHandler.java +27 -0
- data/ext/java/nokogiri/internals/NokogiriBlockingQueueInputStream.java +178 -0
- data/ext/java/nokogiri/internals/NokogiriDomParser.java +99 -0
- data/ext/java/nokogiri/internals/NokogiriEntityResolver.java +140 -0
- data/ext/java/nokogiri/internals/NokogiriErrorHandler.java +65 -0
- data/ext/java/nokogiri/internals/NokogiriHandler.java +339 -0
- data/ext/java/nokogiri/internals/NokogiriHelpers.java +817 -0
- data/ext/java/nokogiri/internals/NokogiriNamespaceCache.java +228 -0
- data/ext/java/nokogiri/internals/NokogiriNamespaceContext.java +110 -0
- data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler.java +86 -0
- data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler4NekoHtml.java +107 -0
- data/ext/java/nokogiri/internals/NokogiriStrictErrorHandler.java +62 -0
- data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +165 -0
- data/ext/java/nokogiri/internals/NokogiriXPathFunctionResolver.java +50 -0
- data/ext/java/nokogiri/internals/NokogiriXPathVariableResolver.java +37 -0
- data/ext/java/nokogiri/internals/NokogiriXsltErrorListener.java +70 -0
- data/ext/java/nokogiri/internals/ParserContext.java +262 -0
- data/ext/java/nokogiri/internals/ReaderNode.java +564 -0
- data/ext/java/nokogiri/internals/SaveContextVisitor.java +865 -0
- data/ext/java/nokogiri/internals/SchemaErrorHandler.java +50 -0
- data/ext/java/nokogiri/internals/XalanDTMManagerPatch.java +174 -0
- data/ext/java/nokogiri/internals/XmlDeclHandler.java +11 -0
- data/ext/java/nokogiri/internals/XmlDomParserContext.java +265 -0
- data/ext/java/nokogiri/internals/XmlSaxParser.java +40 -0
- data/ext/java/nokogiri/internals/c14n/AttrCompare.java +122 -0
- data/ext/java/nokogiri/internals/c14n/C14nHelper.java +178 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalFilter.java +43 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizationException.java +106 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer.java +278 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11.java +664 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11_OmitComments.java +45 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11_WithComments.java +45 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315.java +388 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315Excl.java +308 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclOmitComments.java +47 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclWithComments.java +51 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315OmitComments.java +51 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315WithComments.java +50 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizerBase.java +660 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizerPhysical.java +194 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizerSpi.java +77 -0
- data/ext/java/nokogiri/internals/c14n/Constants.java +45 -0
- data/ext/java/nokogiri/internals/c14n/ElementProxy.java +325 -0
- data/ext/java/nokogiri/internals/c14n/HelperNodeList.java +106 -0
- data/ext/java/nokogiri/internals/c14n/IgnoreAllErrorHandler.java +86 -0
- data/ext/java/nokogiri/internals/c14n/InclusiveNamespaces.java +181 -0
- data/ext/java/nokogiri/internals/c14n/InvalidCanonicalizerException.java +87 -0
- data/ext/java/nokogiri/internals/c14n/NameSpaceSymbTable.java +452 -0
- data/ext/java/nokogiri/internals/c14n/NodeFilter.java +52 -0
- data/ext/java/nokogiri/internals/c14n/UtfHelpper.java +190 -0
- data/ext/java/nokogiri/internals/c14n/XMLUtils.java +540 -0
- data/ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java +1712 -0
- data/ext/java/nokogiri/internals/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java +737 -0
- data/ext/nokogiri/depend +38 -0
- data/ext/nokogiri/extconf.rb +1086 -0
- data/ext/nokogiri/gumbo.c +594 -0
- data/ext/nokogiri/html4_document.c +167 -0
- data/ext/nokogiri/html4_element_description.c +294 -0
- data/ext/nokogiri/html4_entity_lookup.c +37 -0
- data/ext/nokogiri/html4_sax_parser_context.c +116 -0
- data/ext/nokogiri/html4_sax_push_parser.c +95 -0
- data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
- data/ext/nokogiri/nokogiri.c +265 -0
- data/ext/nokogiri/nokogiri.h +235 -0
- data/ext/nokogiri/test_global_handlers.c +42 -0
- data/ext/nokogiri/xml_attr.c +103 -0
- data/ext/nokogiri/xml_attribute_decl.c +70 -0
- data/ext/nokogiri/xml_cdata.c +57 -0
- data/ext/nokogiri/xml_comment.c +62 -0
- data/ext/nokogiri/xml_document.c +689 -0
- data/ext/nokogiri/xml_document_fragment.c +44 -0
- data/ext/nokogiri/xml_dtd.c +210 -0
- data/ext/nokogiri/xml_element_content.c +128 -0
- data/ext/nokogiri/xml_element_decl.c +69 -0
- data/ext/nokogiri/xml_encoding_handler.c +104 -0
- data/ext/nokogiri/xml_entity_decl.c +112 -0
- data/ext/nokogiri/xml_entity_reference.c +50 -0
- data/ext/nokogiri/xml_namespace.c +186 -0
- data/ext/nokogiri/xml_node.c +2426 -0
- data/ext/nokogiri/xml_node_set.c +496 -0
- data/ext/nokogiri/xml_processing_instruction.c +54 -0
- data/ext/nokogiri/xml_reader.c +794 -0
- data/ext/nokogiri/xml_relax_ng.c +164 -0
- data/ext/nokogiri/xml_sax_parser.c +316 -0
- data/ext/nokogiri/xml_sax_parser_context.c +283 -0
- data/ext/nokogiri/xml_sax_push_parser.c +166 -0
- data/ext/nokogiri/xml_schema.c +260 -0
- data/ext/nokogiri/xml_syntax_error.c +85 -0
- data/ext/nokogiri/xml_text.c +48 -0
- data/ext/nokogiri/xml_xpath_context.c +415 -0
- data/ext/nokogiri/xslt_stylesheet.c +363 -0
- data/gumbo-parser/CHANGES.md +63 -0
- data/gumbo-parser/Makefile +111 -0
- data/gumbo-parser/THANKS +27 -0
- data/gumbo-parser/src/Makefile +34 -0
- data/gumbo-parser/src/README.md +41 -0
- data/gumbo-parser/src/ascii.c +75 -0
- data/gumbo-parser/src/ascii.h +115 -0
- data/gumbo-parser/src/attribute.c +42 -0
- data/gumbo-parser/src/attribute.h +17 -0
- data/gumbo-parser/src/char_ref.c +22225 -0
- data/gumbo-parser/src/char_ref.h +29 -0
- data/gumbo-parser/src/char_ref.rl +2154 -0
- data/gumbo-parser/src/error.c +626 -0
- data/gumbo-parser/src/error.h +148 -0
- data/gumbo-parser/src/foreign_attrs.c +104 -0
- data/gumbo-parser/src/foreign_attrs.gperf +27 -0
- data/gumbo-parser/src/insertion_mode.h +33 -0
- data/gumbo-parser/src/macros.h +91 -0
- data/gumbo-parser/src/nokogiri_gumbo.h +944 -0
- data/gumbo-parser/src/parser.c +4878 -0
- data/gumbo-parser/src/parser.h +41 -0
- data/gumbo-parser/src/replacement.h +33 -0
- data/gumbo-parser/src/string_buffer.c +103 -0
- data/gumbo-parser/src/string_buffer.h +68 -0
- data/gumbo-parser/src/string_piece.c +48 -0
- data/gumbo-parser/src/svg_attrs.c +174 -0
- data/gumbo-parser/src/svg_attrs.gperf +77 -0
- data/gumbo-parser/src/svg_tags.c +137 -0
- data/gumbo-parser/src/svg_tags.gperf +55 -0
- data/gumbo-parser/src/tag.c +223 -0
- data/gumbo-parser/src/tag_lookup.c +382 -0
- data/gumbo-parser/src/tag_lookup.gperf +170 -0
- data/gumbo-parser/src/tag_lookup.h +13 -0
- data/gumbo-parser/src/token_buffer.c +79 -0
- data/gumbo-parser/src/token_buffer.h +71 -0
- data/gumbo-parser/src/token_type.h +17 -0
- data/gumbo-parser/src/tokenizer.c +3463 -0
- data/gumbo-parser/src/tokenizer.h +112 -0
- data/gumbo-parser/src/tokenizer_states.h +339 -0
- data/gumbo-parser/src/utf8.c +245 -0
- data/gumbo-parser/src/utf8.h +164 -0
- data/gumbo-parser/src/util.c +66 -0
- data/gumbo-parser/src/util.h +34 -0
- data/gumbo-parser/src/vector.c +111 -0
- data/gumbo-parser/src/vector.h +45 -0
- data/lib/nokogiri/class_resolver.rb +67 -0
- data/lib/nokogiri/css/node.rb +54 -0
- data/lib/nokogiri/css/parser.rb +770 -0
- data/lib/nokogiri/css/parser.y +277 -0
- data/lib/nokogiri/css/parser_extras.rb +96 -0
- data/lib/nokogiri/css/syntax_error.rb +9 -0
- data/lib/nokogiri/css/tokenizer.rb +155 -0
- data/lib/nokogiri/css/tokenizer.rex +56 -0
- data/lib/nokogiri/css/xpath_visitor.rb +359 -0
- data/lib/nokogiri/css.rb +66 -0
- data/lib/nokogiri/decorators/slop.rb +44 -0
- data/lib/nokogiri/encoding_handler.rb +57 -0
- data/lib/nokogiri/extension.rb +32 -0
- data/lib/nokogiri/gumbo.rb +15 -0
- data/lib/nokogiri/html.rb +48 -0
- data/lib/nokogiri/html4/builder.rb +37 -0
- data/lib/nokogiri/html4/document.rb +214 -0
- data/lib/nokogiri/html4/document_fragment.rb +54 -0
- data/lib/nokogiri/html4/element_description.rb +25 -0
- data/lib/nokogiri/html4/element_description_defaults.rb +572 -0
- data/lib/nokogiri/html4/encoding_reader.rb +121 -0
- data/lib/nokogiri/html4/entity_lookup.rb +15 -0
- data/lib/nokogiri/html4/sax/parser.rb +63 -0
- data/lib/nokogiri/html4/sax/parser_context.rb +20 -0
- data/lib/nokogiri/html4/sax/push_parser.rb +37 -0
- data/lib/nokogiri/html4.rb +47 -0
- data/lib/nokogiri/html5/document.rb +168 -0
- data/lib/nokogiri/html5/document_fragment.rb +90 -0
- data/lib/nokogiri/html5/node.rb +98 -0
- data/lib/nokogiri/html5.rb +389 -0
- data/lib/nokogiri/jruby/dependencies.rb +3 -0
- data/lib/nokogiri/jruby/isorelax/isorelax/20030108/isorelax-20030108.jar +0 -0
- data/lib/nokogiri/jruby/net/sf/saxon/Saxon-HE/9.6.0-4/Saxon-HE-9.6.0-4.jar +0 -0
- data/lib/nokogiri/jruby/net/sourceforge/htmlunit/neko-htmlunit/2.63.0/neko-htmlunit-2.63.0.jar +0 -0
- data/lib/nokogiri/jruby/nokogiri_jars.rb +43 -0
- data/lib/nokogiri/jruby/nu/validator/jing/20200702VNU/jing-20200702VNU.jar +0 -0
- data/lib/nokogiri/jruby/org/nokogiri/nekodtd/0.1.11.noko2/nekodtd-0.1.11.noko2.jar +0 -0
- data/lib/nokogiri/jruby/xalan/serializer/2.7.3/serializer-2.7.3.jar +0 -0
- data/lib/nokogiri/jruby/xalan/xalan/2.7.3/xalan-2.7.3.jar +0 -0
- data/lib/nokogiri/jruby/xerces/xercesImpl/2.12.2/xercesImpl-2.12.2.jar +0 -0
- data/lib/nokogiri/jruby/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar +0 -0
- data/lib/nokogiri/syntax_error.rb +6 -0
- data/lib/nokogiri/version/constant.rb +6 -0
- data/lib/nokogiri/version/info.rb +223 -0
- data/lib/nokogiri/version.rb +4 -0
- data/lib/nokogiri/xml/attr.rb +66 -0
- data/lib/nokogiri/xml/attribute_decl.rb +20 -0
- data/lib/nokogiri/xml/builder.rb +487 -0
- data/lib/nokogiri/xml/cdata.rb +13 -0
- data/lib/nokogiri/xml/character_data.rb +9 -0
- data/lib/nokogiri/xml/document.rb +471 -0
- data/lib/nokogiri/xml/document_fragment.rb +205 -0
- data/lib/nokogiri/xml/dtd.rb +34 -0
- data/lib/nokogiri/xml/element_content.rb +38 -0
- data/lib/nokogiri/xml/element_decl.rb +15 -0
- data/lib/nokogiri/xml/entity_decl.rb +21 -0
- data/lib/nokogiri/xml/entity_reference.rb +20 -0
- data/lib/nokogiri/xml/namespace.rb +58 -0
- data/lib/nokogiri/xml/node/save_options.rb +68 -0
- data/lib/nokogiri/xml/node.rb +1563 -0
- data/lib/nokogiri/xml/node_set.rb +447 -0
- data/lib/nokogiri/xml/notation.rb +19 -0
- data/lib/nokogiri/xml/parse_options.rb +213 -0
- data/lib/nokogiri/xml/pp/character_data.rb +21 -0
- data/lib/nokogiri/xml/pp/node.rb +57 -0
- data/lib/nokogiri/xml/pp.rb +4 -0
- data/lib/nokogiri/xml/processing_instruction.rb +11 -0
- data/lib/nokogiri/xml/reader.rb +105 -0
- data/lib/nokogiri/xml/relax_ng.rb +38 -0
- data/lib/nokogiri/xml/sax/document.rb +167 -0
- data/lib/nokogiri/xml/sax/parser.rb +125 -0
- data/lib/nokogiri/xml/sax/parser_context.rb +21 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +61 -0
- data/lib/nokogiri/xml/sax.rb +6 -0
- data/lib/nokogiri/xml/schema.rb +73 -0
- data/lib/nokogiri/xml/searchable.rb +270 -0
- data/lib/nokogiri/xml/syntax_error.rb +72 -0
- data/lib/nokogiri/xml/text.rb +11 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +13 -0
- data/lib/nokogiri/xml/xpath.rb +21 -0
- data/lib/nokogiri/xml/xpath_context.rb +16 -0
- data/lib/nokogiri/xml.rb +76 -0
- data/lib/nokogiri/xslt/stylesheet.rb +27 -0
- data/lib/nokogiri/xslt.rb +65 -0
- data/lib/nokogiri.rb +120 -0
- data/lib/xsd/xmlparser/nokogiri.rb +106 -0
- metadata +391 -0
@@ -0,0 +1,613 @@
|
|
1
|
+
package nokogiri;
|
2
|
+
|
3
|
+
import java.util.Collections;
|
4
|
+
import java.util.HashMap;
|
5
|
+
import java.util.Map;
|
6
|
+
|
7
|
+
import org.jruby.Ruby;
|
8
|
+
import org.jruby.RubyArray;
|
9
|
+
import org.jruby.RubyClass;
|
10
|
+
import org.jruby.RubyFixnum;
|
11
|
+
import org.jruby.RubyModule;
|
12
|
+
import org.jruby.runtime.ObjectAllocator;
|
13
|
+
import org.jruby.runtime.builtin.IRubyObject;
|
14
|
+
import org.jruby.runtime.load.BasicLibraryService;
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Class to provide Nokogiri. This class is used to make "require 'nokogiri'" work
|
18
|
+
* in JRuby. Also, this class holds a Ruby type cache and allocators of Ruby types.
|
19
|
+
*
|
20
|
+
* @author headius
|
21
|
+
* @author Yoko Harada <yokolet@gmail.com>
|
22
|
+
*/
|
23
|
+
public class NokogiriService implements BasicLibraryService
|
24
|
+
{
|
25
|
+
public boolean
|
26
|
+
basicLoad(Ruby ruby)
|
27
|
+
{
|
28
|
+
init(ruby);
|
29
|
+
return true;
|
30
|
+
}
|
31
|
+
|
32
|
+
@SuppressWarnings("unchecked")
|
33
|
+
public static Map<String, RubyClass>
|
34
|
+
getNokogiriClassCache(Ruby ruby)
|
35
|
+
{
|
36
|
+
return (Map<String, RubyClass>) ruby.getModule("Nokogiri").getInternalVariable("cache");
|
37
|
+
}
|
38
|
+
|
39
|
+
private static Map<String, RubyClass>
|
40
|
+
populateNokogiriClassCahce(Ruby ruby)
|
41
|
+
{
|
42
|
+
Map<String, RubyClass> nokogiriClassCache = new HashMap<String, RubyClass>();
|
43
|
+
nokogiriClassCache.put("Nokogiri::HTML4::Document", (RubyClass)ruby.getClassFromPath("Nokogiri::HTML4::Document"));
|
44
|
+
nokogiriClassCache.put("Nokogiri::HTML4::ElementDescription",
|
45
|
+
(RubyClass)ruby.getClassFromPath("Nokogiri::HTML4::ElementDescription"));
|
46
|
+
nokogiriClassCache.put("Nokogiri::XML::Attr", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::Attr"));
|
47
|
+
nokogiriClassCache.put("Nokogiri::XML::Document", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::Document"));
|
48
|
+
nokogiriClassCache.put("Nokogiri::XML::DocumentFragment",
|
49
|
+
(RubyClass)ruby.getClassFromPath("Nokogiri::XML::DocumentFragment"));
|
50
|
+
nokogiriClassCache.put("Nokogiri::XML::DTD", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::DTD"));
|
51
|
+
nokogiriClassCache.put("Nokogiri::XML::Text", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::Text"));
|
52
|
+
nokogiriClassCache.put("Nokogiri::XML::Comment", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::Comment"));
|
53
|
+
nokogiriClassCache.put("Nokogiri::XML::Element", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::Element"));
|
54
|
+
nokogiriClassCache.put("Nokogiri::XML::ElementContent",
|
55
|
+
(RubyClass)ruby.getClassFromPath("Nokogiri::XML::ElementContent"));
|
56
|
+
nokogiriClassCache.put("Nokogiri::XML::ElementDecl", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::ElementDecl"));
|
57
|
+
nokogiriClassCache.put("Nokogiri::XML::EntityDecl", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::EntityDecl"));
|
58
|
+
nokogiriClassCache.put("Nokogiri::XML::EntityReference",
|
59
|
+
(RubyClass)ruby.getClassFromPath("Nokogiri::XML::EntityReference"));
|
60
|
+
nokogiriClassCache.put("Nokogiri::XML::ProcessingInstruction",
|
61
|
+
(RubyClass)ruby.getClassFromPath("Nokogiri::XML::ProcessingInstruction"));
|
62
|
+
nokogiriClassCache.put("Nokogiri::XML::CDATA", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::CDATA"));
|
63
|
+
nokogiriClassCache.put("Nokogiri::XML::Node", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::Node"));
|
64
|
+
nokogiriClassCache.put("Nokogiri::XML::NodeSet", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::NodeSet"));
|
65
|
+
nokogiriClassCache.put("Nokogiri::XML::Namespace", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::Namespace"));
|
66
|
+
nokogiriClassCache.put("Nokogiri::XML::SyntaxError", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::SyntaxError"));
|
67
|
+
nokogiriClassCache.put("Nokogiri::XML::Reader", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::Reader"));
|
68
|
+
nokogiriClassCache.put("Nokogiri::XML::RelaxNG", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::RelaxNG"));
|
69
|
+
nokogiriClassCache.put("Nokogiri::XML::Schema", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::Schema"));
|
70
|
+
nokogiriClassCache.put("Nokogiri::XML::XPathContext", (RubyClass)ruby.getClassFromPath("Nokogiri::XML::XPathContext"));
|
71
|
+
nokogiriClassCache.put("Nokogiri::XML::AttributeDecl",
|
72
|
+
(RubyClass)ruby.getClassFromPath("Nokogiri::XML::AttributeDecl"));
|
73
|
+
nokogiriClassCache.put("Nokogiri::XML::SAX::ParserContext",
|
74
|
+
(RubyClass)ruby.getClassFromPath("Nokogiri::XML::SAX::ParserContext"));
|
75
|
+
return Collections.unmodifiableMap(nokogiriClassCache);
|
76
|
+
}
|
77
|
+
|
78
|
+
private void
|
79
|
+
init(Ruby ruby)
|
80
|
+
{
|
81
|
+
RubyModule nokogiri = ruby.defineModule("Nokogiri");
|
82
|
+
RubyModule xmlModule = nokogiri.defineModuleUnder("XML");
|
83
|
+
RubyModule xmlSaxModule = xmlModule.defineModuleUnder("SAX");
|
84
|
+
RubyModule htmlModule = nokogiri.defineModuleUnder("HTML4");
|
85
|
+
RubyModule htmlSaxModule = htmlModule.defineModuleUnder("SAX");
|
86
|
+
RubyModule xsltModule = nokogiri.defineModuleUnder("XSLT");
|
87
|
+
|
88
|
+
createSyntaxErrors(ruby, nokogiri, xmlModule);
|
89
|
+
RubyClass xmlNode = createXmlModule(ruby, xmlModule);
|
90
|
+
createHtmlModule(ruby, htmlModule);
|
91
|
+
createDocuments(ruby, xmlModule, htmlModule, xmlNode);
|
92
|
+
createSaxModule(ruby, xmlSaxModule, htmlSaxModule);
|
93
|
+
createXsltModule(ruby, xsltModule);
|
94
|
+
nokogiri.setInternalVariable("cache", populateNokogiriClassCahce(ruby));
|
95
|
+
}
|
96
|
+
|
97
|
+
private void
|
98
|
+
createSyntaxErrors(Ruby ruby, RubyModule nokogiri, RubyModule xmlModule)
|
99
|
+
{
|
100
|
+
RubyClass syntaxError = nokogiri.defineClassUnder("SyntaxError", ruby.getStandardError(),
|
101
|
+
ruby.getStandardError().getAllocator());
|
102
|
+
RubyClass xmlSyntaxError = xmlModule.defineClassUnder("SyntaxError", syntaxError, XML_SYNTAXERROR_ALLOCATOR);
|
103
|
+
xmlSyntaxError.defineAnnotatedMethods(XmlSyntaxError.class);
|
104
|
+
}
|
105
|
+
|
106
|
+
private RubyClass
|
107
|
+
createXmlModule(Ruby ruby, RubyModule xmlModule)
|
108
|
+
{
|
109
|
+
RubyClass node = xmlModule.defineClassUnder("Node", ruby.getObject(), XML_NODE_ALLOCATOR);
|
110
|
+
node.defineAnnotatedMethods(XmlNode.class);
|
111
|
+
|
112
|
+
RubyClass attr = xmlModule.defineClassUnder("Attr", node, XML_ATTR_ALLOCATOR);
|
113
|
+
attr.defineAnnotatedMethods(XmlAttr.class);
|
114
|
+
|
115
|
+
RubyClass attrDecl = xmlModule.defineClassUnder("AttributeDecl", node, XML_ATTRIBUTE_DECL_ALLOCATOR);
|
116
|
+
attrDecl.defineAnnotatedMethods(XmlAttributeDecl.class);
|
117
|
+
|
118
|
+
RubyClass characterData = xmlModule.defineClassUnder("CharacterData", node, null);
|
119
|
+
|
120
|
+
RubyClass comment = xmlModule.defineClassUnder("Comment", characterData, XML_COMMENT_ALLOCATOR);
|
121
|
+
comment.defineAnnotatedMethods(XmlComment.class);
|
122
|
+
|
123
|
+
RubyClass text = xmlModule.defineClassUnder("Text", characterData, XML_TEXT_ALLOCATOR);
|
124
|
+
text.defineAnnotatedMethods(XmlText.class);
|
125
|
+
|
126
|
+
RubyModule cdata = xmlModule.defineClassUnder("CDATA", text, XML_CDATA_ALLOCATOR);
|
127
|
+
cdata.defineAnnotatedMethods(XmlCdata.class);
|
128
|
+
|
129
|
+
RubyClass dtd = xmlModule.defineClassUnder("DTD", node, XML_DTD_ALLOCATOR);
|
130
|
+
dtd.defineAnnotatedMethods(XmlDtd.class);
|
131
|
+
|
132
|
+
RubyClass documentFragment = xmlModule.defineClassUnder("DocumentFragment", node, XML_DOCUMENT_FRAGMENT_ALLOCATOR);
|
133
|
+
documentFragment.defineAnnotatedMethods(XmlDocumentFragment.class);
|
134
|
+
|
135
|
+
RubyClass element = xmlModule.defineClassUnder("Element", node, XML_ELEMENT_ALLOCATOR);
|
136
|
+
element.defineAnnotatedMethods(XmlElement.class);
|
137
|
+
|
138
|
+
RubyClass elementContent = xmlModule.defineClassUnder("ElementContent", ruby.getObject(),
|
139
|
+
XML_ELEMENT_CONTENT_ALLOCATOR);
|
140
|
+
elementContent.defineAnnotatedMethods(XmlElementContent.class);
|
141
|
+
|
142
|
+
RubyClass elementDecl = xmlModule.defineClassUnder("ElementDecl", node, XML_ELEMENT_DECL_ALLOCATOR);
|
143
|
+
elementDecl.defineAnnotatedMethods(XmlElementDecl.class);
|
144
|
+
|
145
|
+
RubyClass entityDecl = xmlModule.defineClassUnder("EntityDecl", node, XML_ENTITY_DECL_ALLOCATOR);
|
146
|
+
entityDecl.defineAnnotatedMethods(XmlEntityDecl.class);
|
147
|
+
|
148
|
+
entityDecl.defineConstant("INTERNAL_GENERAL", RubyFixnum.newFixnum(ruby, XmlEntityDecl.INTERNAL_GENERAL));
|
149
|
+
entityDecl.defineConstant("EXTERNAL_GENERAL_PARSED", RubyFixnum.newFixnum(ruby, XmlEntityDecl.EXTERNAL_GENERAL_PARSED));
|
150
|
+
entityDecl.defineConstant("EXTERNAL_GENERAL_UNPARSED", RubyFixnum.newFixnum(ruby,
|
151
|
+
XmlEntityDecl.EXTERNAL_GENERAL_UNPARSED));
|
152
|
+
entityDecl.defineConstant("INTERNAL_PARAMETER", RubyFixnum.newFixnum(ruby, XmlEntityDecl.INTERNAL_PARAMETER));
|
153
|
+
entityDecl.defineConstant("EXTERNAL_PARAMETER", RubyFixnum.newFixnum(ruby, XmlEntityDecl.EXTERNAL_PARAMETER));
|
154
|
+
entityDecl.defineConstant("INTERNAL_PREDEFINED", RubyFixnum.newFixnum(ruby, XmlEntityDecl.INTERNAL_PREDEFINED));
|
155
|
+
|
156
|
+
RubyClass entref = xmlModule.defineClassUnder("EntityReference", node, XML_ENTITY_REFERENCE_ALLOCATOR);
|
157
|
+
entref.defineAnnotatedMethods(XmlEntityReference.class);
|
158
|
+
|
159
|
+
RubyClass namespace = xmlModule.defineClassUnder("Namespace", ruby.getObject(), XML_NAMESPACE_ALLOCATOR);
|
160
|
+
namespace.defineAnnotatedMethods(XmlNamespace.class);
|
161
|
+
|
162
|
+
RubyClass nodeSet = xmlModule.defineClassUnder("NodeSet", ruby.getObject(), XML_NODESET_ALLOCATOR);
|
163
|
+
nodeSet.defineAnnotatedMethods(XmlNodeSet.class);
|
164
|
+
|
165
|
+
RubyClass pi = xmlModule.defineClassUnder("ProcessingInstruction", node, XML_PROCESSING_INSTRUCTION_ALLOCATOR);
|
166
|
+
pi.defineAnnotatedMethods(XmlProcessingInstruction.class);
|
167
|
+
|
168
|
+
RubyClass reader = xmlModule.defineClassUnder("Reader", ruby.getObject(), XML_READER_ALLOCATOR);
|
169
|
+
reader.defineAnnotatedMethods(XmlReader.class);
|
170
|
+
|
171
|
+
RubyClass schema = xmlModule.defineClassUnder("Schema", ruby.getObject(), XML_SCHEMA_ALLOCATOR);
|
172
|
+
schema.defineAnnotatedMethods(XmlSchema.class);
|
173
|
+
|
174
|
+
RubyClass relaxng = xmlModule.defineClassUnder("RelaxNG", schema, XML_RELAXNG_ALLOCATOR);
|
175
|
+
relaxng.defineAnnotatedMethods(XmlRelaxng.class);
|
176
|
+
|
177
|
+
RubyClass xpathContext = xmlModule.defineClassUnder("XPathContext", ruby.getObject(), XML_XPATHCONTEXT_ALLOCATOR);
|
178
|
+
xpathContext.defineAnnotatedMethods(XmlXpathContext.class);
|
179
|
+
|
180
|
+
return node;
|
181
|
+
}
|
182
|
+
|
183
|
+
private void
|
184
|
+
createHtmlModule(Ruby ruby, RubyModule htmlModule)
|
185
|
+
{
|
186
|
+
RubyClass htmlElemDesc = htmlModule.defineClassUnder("ElementDescription", ruby.getObject(),
|
187
|
+
HTML_ELEMENT_DESCRIPTION_ALLOCATOR);
|
188
|
+
htmlElemDesc.defineAnnotatedMethods(Html4ElementDescription.class);
|
189
|
+
|
190
|
+
RubyClass htmlEntityLookup = htmlModule.defineClassUnder("EntityLookup", ruby.getObject(),
|
191
|
+
HTML_ENTITY_LOOKUP_ALLOCATOR);
|
192
|
+
htmlEntityLookup.defineAnnotatedMethods(Html4EntityLookup.class);
|
193
|
+
}
|
194
|
+
|
195
|
+
private void
|
196
|
+
createDocuments(Ruby ruby, RubyModule xmlModule, RubyModule htmlModule, RubyClass node)
|
197
|
+
{
|
198
|
+
RubyClass xmlDocument = xmlModule.defineClassUnder("Document", node, XML_DOCUMENT_ALLOCATOR);
|
199
|
+
xmlDocument.defineAnnotatedMethods(XmlDocument.class);
|
200
|
+
|
201
|
+
//RubyModule htmlDoc = html.defineOrGetClassUnder("Document", document);
|
202
|
+
RubyModule htmlDocument = htmlModule.defineClassUnder("Document", xmlDocument, HTML_DOCUMENT_ALLOCATOR);
|
203
|
+
htmlDocument.defineAnnotatedMethods(Html4Document.class);
|
204
|
+
}
|
205
|
+
|
206
|
+
private void
|
207
|
+
createSaxModule(Ruby ruby, RubyModule xmlSaxModule, RubyModule htmlSaxModule)
|
208
|
+
{
|
209
|
+
RubyClass xmlSaxParserContext = xmlSaxModule.defineClassUnder("ParserContext", ruby.getObject(),
|
210
|
+
XML_SAXPARSER_CONTEXT_ALLOCATOR);
|
211
|
+
xmlSaxParserContext.defineAnnotatedMethods(XmlSaxParserContext.class);
|
212
|
+
|
213
|
+
RubyClass xmlSaxPushParser = xmlSaxModule.defineClassUnder("PushParser", ruby.getObject(), XML_SAXPUSHPARSER_ALLOCATOR);
|
214
|
+
xmlSaxPushParser.defineAnnotatedMethods(XmlSaxPushParser.class);
|
215
|
+
|
216
|
+
RubyClass htmlSaxPushParser = htmlSaxModule.defineClassUnder("PushParser", ruby.getObject(),
|
217
|
+
HTML_SAXPUSHPARSER_ALLOCATOR);
|
218
|
+
htmlSaxPushParser.defineAnnotatedMethods(Html4SaxPushParser.class);
|
219
|
+
|
220
|
+
RubyClass htmlSaxParserContext = htmlSaxModule.defineClassUnder("ParserContext", xmlSaxParserContext,
|
221
|
+
HTML_SAXPARSER_CONTEXT_ALLOCATOR);
|
222
|
+
htmlSaxParserContext.defineAnnotatedMethods(Html4SaxParserContext.class);
|
223
|
+
}
|
224
|
+
|
225
|
+
private void
|
226
|
+
createXsltModule(Ruby ruby, RubyModule xsltModule)
|
227
|
+
{
|
228
|
+
RubyClass stylesheet = xsltModule.defineClassUnder("Stylesheet", ruby.getObject(), XSLT_STYLESHEET_ALLOCATOR);
|
229
|
+
stylesheet.defineAnnotatedMethods(XsltStylesheet.class);
|
230
|
+
xsltModule.defineAnnotatedMethod(XsltStylesheet.class, "register");
|
231
|
+
}
|
232
|
+
|
233
|
+
public static final ObjectAllocator HTML_DOCUMENT_ALLOCATOR = new ObjectAllocator()
|
234
|
+
{
|
235
|
+
private Html4Document htmlDocument = null;
|
236
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
237
|
+
if (htmlDocument == null) { htmlDocument = new Html4Document(runtime, klazz); }
|
238
|
+
try {
|
239
|
+
Html4Document clone = (Html4Document) htmlDocument.clone();
|
240
|
+
clone.setMetaClass(klazz);
|
241
|
+
return clone;
|
242
|
+
} catch (CloneNotSupportedException e) {
|
243
|
+
return new Html4Document(runtime, klazz);
|
244
|
+
}
|
245
|
+
}
|
246
|
+
};
|
247
|
+
|
248
|
+
private static final ObjectAllocator HTML_SAXPARSER_CONTEXT_ALLOCATOR = new ObjectAllocator()
|
249
|
+
{
|
250
|
+
private Html4SaxParserContext htmlSaxParserContext = null;
|
251
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
252
|
+
if (htmlSaxParserContext == null) { htmlSaxParserContext = new Html4SaxParserContext(runtime, klazz); }
|
253
|
+
try {
|
254
|
+
Html4SaxParserContext clone = (Html4SaxParserContext) htmlSaxParserContext.clone();
|
255
|
+
clone.setMetaClass(klazz);
|
256
|
+
return clone;
|
257
|
+
} catch (CloneNotSupportedException e) {
|
258
|
+
return new Html4SaxParserContext(runtime, klazz);
|
259
|
+
}
|
260
|
+
}
|
261
|
+
};
|
262
|
+
|
263
|
+
private static ObjectAllocator HTML_ELEMENT_DESCRIPTION_ALLOCATOR =
|
264
|
+
new ObjectAllocator()
|
265
|
+
{
|
266
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
267
|
+
return new Html4ElementDescription(runtime, klazz);
|
268
|
+
}
|
269
|
+
};
|
270
|
+
|
271
|
+
private static ObjectAllocator HTML_ENTITY_LOOKUP_ALLOCATOR =
|
272
|
+
new ObjectAllocator()
|
273
|
+
{
|
274
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
275
|
+
return new Html4EntityLookup(runtime, klazz);
|
276
|
+
}
|
277
|
+
};
|
278
|
+
|
279
|
+
public static final ObjectAllocator XML_ATTR_ALLOCATOR = new ObjectAllocator()
|
280
|
+
{
|
281
|
+
private XmlAttr xmlAttr = null;
|
282
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
283
|
+
if (xmlAttr == null) { xmlAttr = new XmlAttr(runtime, klazz); }
|
284
|
+
try {
|
285
|
+
XmlAttr clone = (XmlAttr) xmlAttr.clone();
|
286
|
+
clone.setMetaClass(klazz);
|
287
|
+
return clone;
|
288
|
+
} catch (CloneNotSupportedException e) {
|
289
|
+
return new XmlAttr(runtime, klazz);
|
290
|
+
}
|
291
|
+
}
|
292
|
+
};
|
293
|
+
|
294
|
+
public static final ObjectAllocator XML_CDATA_ALLOCATOR = new ObjectAllocator()
|
295
|
+
{
|
296
|
+
private XmlCdata xmlCdata = null;
|
297
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
298
|
+
if (xmlCdata == null) { xmlCdata = new XmlCdata(runtime, klazz); }
|
299
|
+
try {
|
300
|
+
XmlCdata clone = (XmlCdata) xmlCdata.clone();
|
301
|
+
clone.setMetaClass(klazz);
|
302
|
+
return clone;
|
303
|
+
} catch (CloneNotSupportedException e) {
|
304
|
+
return new XmlCdata(runtime, klazz);
|
305
|
+
}
|
306
|
+
}
|
307
|
+
};
|
308
|
+
|
309
|
+
public static final ObjectAllocator XML_COMMENT_ALLOCATOR = new ObjectAllocator()
|
310
|
+
{
|
311
|
+
private XmlComment xmlComment = null;
|
312
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
313
|
+
if (xmlComment == null) { xmlComment = new XmlComment(runtime, klazz); }
|
314
|
+
try {
|
315
|
+
XmlComment clone = (XmlComment) xmlComment.clone();
|
316
|
+
clone.setMetaClass(klazz);
|
317
|
+
return clone;
|
318
|
+
} catch (CloneNotSupportedException e) {
|
319
|
+
return new XmlComment(runtime, klazz);
|
320
|
+
}
|
321
|
+
}
|
322
|
+
};
|
323
|
+
|
324
|
+
public static final ObjectAllocator XML_DOCUMENT_ALLOCATOR = new ObjectAllocator()
|
325
|
+
{
|
326
|
+
private XmlDocument xmlDocument = null;
|
327
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
328
|
+
if (xmlDocument == null) { xmlDocument = new XmlDocument(runtime, klazz); }
|
329
|
+
try {
|
330
|
+
XmlDocument clone = (XmlDocument) xmlDocument.clone();
|
331
|
+
clone.setMetaClass(klazz);
|
332
|
+
return clone;
|
333
|
+
} catch (CloneNotSupportedException e) {
|
334
|
+
return new XmlDocument(runtime, klazz);
|
335
|
+
}
|
336
|
+
}
|
337
|
+
};
|
338
|
+
|
339
|
+
public static final ObjectAllocator XML_DOCUMENT_FRAGMENT_ALLOCATOR = new ObjectAllocator()
|
340
|
+
{
|
341
|
+
private XmlDocumentFragment xmlDocumentFragment = null;
|
342
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
343
|
+
if (xmlDocumentFragment == null) { xmlDocumentFragment = new XmlDocumentFragment(runtime, klazz); }
|
344
|
+
try {
|
345
|
+
XmlDocumentFragment clone = (XmlDocumentFragment)xmlDocumentFragment.clone();
|
346
|
+
clone.setMetaClass(klazz);
|
347
|
+
return clone;
|
348
|
+
} catch (CloneNotSupportedException e) {
|
349
|
+
return new XmlDocumentFragment(runtime, klazz);
|
350
|
+
}
|
351
|
+
}
|
352
|
+
};
|
353
|
+
|
354
|
+
public static final ObjectAllocator XML_DTD_ALLOCATOR = new ObjectAllocator()
|
355
|
+
{
|
356
|
+
private XmlDtd xmlDtd = null;
|
357
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
358
|
+
if (xmlDtd == null) { xmlDtd = new XmlDtd(runtime, klazz); }
|
359
|
+
try {
|
360
|
+
XmlDtd clone = (XmlDtd)xmlDtd.clone();
|
361
|
+
clone.setMetaClass(klazz);
|
362
|
+
return clone;
|
363
|
+
} catch (CloneNotSupportedException e) {
|
364
|
+
return new XmlDtd(runtime, klazz);
|
365
|
+
}
|
366
|
+
}
|
367
|
+
};
|
368
|
+
|
369
|
+
public static final ObjectAllocator XML_ELEMENT_ALLOCATOR = new ObjectAllocator()
|
370
|
+
{
|
371
|
+
private XmlElement xmlElement = null;
|
372
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
373
|
+
if (xmlElement == null) { xmlElement = new XmlElement(runtime, klazz); }
|
374
|
+
try {
|
375
|
+
XmlElement clone = (XmlElement)xmlElement.clone();
|
376
|
+
clone.setMetaClass(klazz);
|
377
|
+
return clone;
|
378
|
+
} catch (CloneNotSupportedException e) {
|
379
|
+
return new XmlElement(runtime, klazz);
|
380
|
+
}
|
381
|
+
}
|
382
|
+
};
|
383
|
+
|
384
|
+
public static ObjectAllocator XML_ELEMENT_DECL_ALLOCATOR = new ObjectAllocator()
|
385
|
+
{
|
386
|
+
private XmlElementDecl xmlElementDecl = null;
|
387
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
388
|
+
if (xmlElementDecl == null) { xmlElementDecl = new XmlElementDecl(runtime, klazz); }
|
389
|
+
try {
|
390
|
+
XmlElementDecl clone = (XmlElementDecl)xmlElementDecl.clone();
|
391
|
+
clone.setMetaClass(klazz);
|
392
|
+
return clone;
|
393
|
+
} catch (CloneNotSupportedException e) {
|
394
|
+
return new XmlElementDecl(runtime, klazz);
|
395
|
+
}
|
396
|
+
}
|
397
|
+
};
|
398
|
+
|
399
|
+
public static ObjectAllocator XML_ENTITY_REFERENCE_ALLOCATOR = new ObjectAllocator()
|
400
|
+
{
|
401
|
+
private XmlEntityReference xmlEntityRef = null;
|
402
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
403
|
+
if (xmlEntityRef == null) { xmlEntityRef = new XmlEntityReference(runtime, klazz); }
|
404
|
+
try {
|
405
|
+
XmlEntityReference clone = (XmlEntityReference)xmlEntityRef.clone();
|
406
|
+
clone.setMetaClass(klazz);
|
407
|
+
return clone;
|
408
|
+
} catch (CloneNotSupportedException e) {
|
409
|
+
return new XmlEntityReference(runtime, klazz);
|
410
|
+
}
|
411
|
+
}
|
412
|
+
};
|
413
|
+
|
414
|
+
public static final ObjectAllocator XML_NAMESPACE_ALLOCATOR = new ObjectAllocator()
|
415
|
+
{
|
416
|
+
private XmlNamespace xmlNamespace = null;
|
417
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
418
|
+
if (xmlNamespace == null) { xmlNamespace = new XmlNamespace(runtime, klazz); }
|
419
|
+
try {
|
420
|
+
XmlNamespace clone = (XmlNamespace) xmlNamespace.clone();
|
421
|
+
clone.setMetaClass(klazz);
|
422
|
+
return clone;
|
423
|
+
} catch (CloneNotSupportedException e) {
|
424
|
+
return new XmlNamespace(runtime, klazz);
|
425
|
+
}
|
426
|
+
}
|
427
|
+
};
|
428
|
+
|
429
|
+
public static final ObjectAllocator XML_NODE_ALLOCATOR = new ObjectAllocator()
|
430
|
+
{
|
431
|
+
private XmlNode xmlNode = null;
|
432
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
433
|
+
if (xmlNode == null) { xmlNode = new XmlNode(runtime, klazz); }
|
434
|
+
try {
|
435
|
+
XmlNode clone = (XmlNode) xmlNode.clone();
|
436
|
+
clone.setMetaClass(klazz);
|
437
|
+
return clone;
|
438
|
+
} catch (CloneNotSupportedException e) {
|
439
|
+
return new XmlNode(runtime, klazz);
|
440
|
+
}
|
441
|
+
}
|
442
|
+
};
|
443
|
+
|
444
|
+
public static final ObjectAllocator XML_NODESET_ALLOCATOR = new ObjectAllocator()
|
445
|
+
{
|
446
|
+
private XmlNodeSet xmlNodeSet = null;
|
447
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
448
|
+
if (xmlNodeSet == null) { xmlNodeSet = new XmlNodeSet(runtime, klazz); }
|
449
|
+
try {
|
450
|
+
XmlNodeSet clone = (XmlNodeSet) xmlNodeSet.clone();
|
451
|
+
clone.setMetaClass(klazz);
|
452
|
+
return clone;
|
453
|
+
} catch (CloneNotSupportedException e) {
|
454
|
+
return new XmlNodeSet(runtime, klazz);
|
455
|
+
}
|
456
|
+
}
|
457
|
+
};
|
458
|
+
|
459
|
+
public static ObjectAllocator XML_PROCESSING_INSTRUCTION_ALLOCATOR = new ObjectAllocator()
|
460
|
+
{
|
461
|
+
private XmlProcessingInstruction xmlProcessingInstruction = null;
|
462
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
463
|
+
if (xmlProcessingInstruction == null) { xmlProcessingInstruction = new XmlProcessingInstruction(runtime, klazz); }
|
464
|
+
try {
|
465
|
+
XmlProcessingInstruction clone = (XmlProcessingInstruction)xmlProcessingInstruction.clone();
|
466
|
+
clone.setMetaClass(klazz);
|
467
|
+
return clone;
|
468
|
+
} catch (CloneNotSupportedException e) {
|
469
|
+
return new XmlProcessingInstruction(runtime, klazz);
|
470
|
+
}
|
471
|
+
}
|
472
|
+
};
|
473
|
+
|
474
|
+
public static ObjectAllocator XML_READER_ALLOCATOR = new ObjectAllocator()
|
475
|
+
{
|
476
|
+
private XmlReader xmlReader = null;
|
477
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
478
|
+
if (xmlReader == null) { xmlReader = new XmlReader(runtime, klazz); }
|
479
|
+
try {
|
480
|
+
XmlReader clone = (XmlReader) xmlReader.clone();
|
481
|
+
clone.setMetaClass(klazz);
|
482
|
+
return clone;
|
483
|
+
} catch (CloneNotSupportedException e) {
|
484
|
+
xmlReader = new XmlReader(runtime, klazz);
|
485
|
+
return xmlReader;
|
486
|
+
}
|
487
|
+
}
|
488
|
+
};
|
489
|
+
|
490
|
+
private static ObjectAllocator XML_ATTRIBUTE_DECL_ALLOCATOR = new ObjectAllocator()
|
491
|
+
{
|
492
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
493
|
+
return new XmlAttributeDecl(runtime, klazz);
|
494
|
+
}
|
495
|
+
};
|
496
|
+
|
497
|
+
private static ObjectAllocator XML_ENTITY_DECL_ALLOCATOR = new ObjectAllocator()
|
498
|
+
{
|
499
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
500
|
+
return new XmlEntityDecl(runtime, klazz);
|
501
|
+
}
|
502
|
+
};
|
503
|
+
|
504
|
+
private static ObjectAllocator XML_ELEMENT_CONTENT_ALLOCATOR = new ObjectAllocator()
|
505
|
+
{
|
506
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
507
|
+
throw runtime.newNotImplementedError("not implemented");
|
508
|
+
}
|
509
|
+
};
|
510
|
+
|
511
|
+
public static final ObjectAllocator XML_RELAXNG_ALLOCATOR = new ObjectAllocator()
|
512
|
+
{
|
513
|
+
private XmlRelaxng xmlRelaxng = null;
|
514
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
515
|
+
if (xmlRelaxng == null) { xmlRelaxng = new XmlRelaxng(runtime, klazz); }
|
516
|
+
try {
|
517
|
+
XmlRelaxng clone = (XmlRelaxng) xmlRelaxng.clone();
|
518
|
+
clone.setMetaClass(klazz);
|
519
|
+
return clone;
|
520
|
+
} catch (CloneNotSupportedException e) {
|
521
|
+
return new XmlRelaxng(runtime, klazz);
|
522
|
+
}
|
523
|
+
}
|
524
|
+
};
|
525
|
+
|
526
|
+
public static final ObjectAllocator XML_SAXPARSER_CONTEXT_ALLOCATOR = new ObjectAllocator()
|
527
|
+
{
|
528
|
+
private XmlSaxParserContext xmlSaxParserContext = null;
|
529
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
530
|
+
if (xmlSaxParserContext == null) { xmlSaxParserContext = new XmlSaxParserContext(runtime, klazz); }
|
531
|
+
try {
|
532
|
+
XmlSaxParserContext clone = (XmlSaxParserContext) xmlSaxParserContext.clone();
|
533
|
+
clone.setMetaClass(klazz);
|
534
|
+
return clone;
|
535
|
+
} catch (CloneNotSupportedException e) {
|
536
|
+
return new XmlSaxParserContext(runtime, klazz);
|
537
|
+
}
|
538
|
+
}
|
539
|
+
};
|
540
|
+
|
541
|
+
private static final ObjectAllocator XML_SAXPUSHPARSER_ALLOCATOR = new ObjectAllocator()
|
542
|
+
{
|
543
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
544
|
+
return new XmlSaxPushParser(runtime, klazz);
|
545
|
+
}
|
546
|
+
};
|
547
|
+
|
548
|
+
private static final ObjectAllocator HTML_SAXPUSHPARSER_ALLOCATOR = new ObjectAllocator()
|
549
|
+
{
|
550
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
551
|
+
return new Html4SaxPushParser(runtime, klazz);
|
552
|
+
}
|
553
|
+
};
|
554
|
+
|
555
|
+
public static final ObjectAllocator XML_SCHEMA_ALLOCATOR = new ObjectAllocator()
|
556
|
+
{
|
557
|
+
private XmlSchema xmlSchema = null;
|
558
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
559
|
+
if (xmlSchema == null) { xmlSchema = new XmlSchema(runtime, klazz); }
|
560
|
+
try {
|
561
|
+
XmlSchema clone = (XmlSchema) xmlSchema.clone();
|
562
|
+
clone.setMetaClass(klazz);
|
563
|
+
return clone;
|
564
|
+
} catch (CloneNotSupportedException e) {
|
565
|
+
return new XmlSchema(runtime, klazz);
|
566
|
+
}
|
567
|
+
}
|
568
|
+
};
|
569
|
+
|
570
|
+
public static final ObjectAllocator XML_SYNTAXERROR_ALLOCATOR = new ObjectAllocator()
|
571
|
+
{
|
572
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
573
|
+
return new XmlSyntaxError(runtime, klazz);
|
574
|
+
}
|
575
|
+
};
|
576
|
+
|
577
|
+
public static final ObjectAllocator XML_TEXT_ALLOCATOR = new ObjectAllocator()
|
578
|
+
{
|
579
|
+
private XmlText xmlText = null;
|
580
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
581
|
+
if (xmlText == null) { xmlText = new XmlText(runtime, klazz); }
|
582
|
+
try {
|
583
|
+
XmlText clone = (XmlText) xmlText.clone();
|
584
|
+
clone.setMetaClass(klazz);
|
585
|
+
return clone;
|
586
|
+
} catch (CloneNotSupportedException e) {
|
587
|
+
return new XmlText(runtime, klazz);
|
588
|
+
}
|
589
|
+
}
|
590
|
+
};
|
591
|
+
|
592
|
+
public static final ObjectAllocator XML_XPATHCONTEXT_ALLOCATOR = new ObjectAllocator()
|
593
|
+
{
|
594
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
595
|
+
return new XmlXpathContext(runtime, klazz);
|
596
|
+
}
|
597
|
+
};
|
598
|
+
|
599
|
+
public static ObjectAllocator XSLT_STYLESHEET_ALLOCATOR = new ObjectAllocator()
|
600
|
+
{
|
601
|
+
private XsltStylesheet xsltStylesheet = null;
|
602
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
|
603
|
+
if (xsltStylesheet == null) { xsltStylesheet = new XsltStylesheet(runtime, klazz); }
|
604
|
+
try {
|
605
|
+
XsltStylesheet clone = (XsltStylesheet) xsltStylesheet.clone();
|
606
|
+
clone.setMetaClass(klazz);
|
607
|
+
return clone;
|
608
|
+
} catch (CloneNotSupportedException e) {
|
609
|
+
return new XmlText(runtime, klazz);
|
610
|
+
}
|
611
|
+
}
|
612
|
+
};
|
613
|
+
}
|