smile-xml 1.0.0-jruby → 1.0.2-jruby
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/smile-xml.jar +0 -0
- data/src/main/java/smile/xml/AttrJ.java +160 -0
- data/src/main/java/smile/xml/AttributesJ.java +212 -0
- data/src/main/java/smile/xml/BaseJ.java +60 -0
- data/src/main/java/smile/xml/DocumentJ.java +435 -0
- data/src/main/java/smile/xml/EncodingJ.java +94 -0
- data/src/main/java/smile/xml/ErrorJ.java +162 -0
- data/src/main/java/smile/xml/NamespaceJ.java +67 -0
- data/src/main/java/smile/xml/NamespacesJ.java +62 -0
- data/src/main/java/smile/xml/NodeJ.java +1029 -0
- data/src/main/java/smile/xml/NodeSetJ.java +90 -0
- data/src/main/java/smile/xml/ParserContextJ.java +44 -0
- data/src/main/java/smile/xml/ParserJ.java +196 -0
- data/src/main/java/smile/xml/ParserOptionsJ.java +58 -0
- data/src/main/java/smile/xml/ReaderJ.java +34 -0
- data/src/main/java/smile/xml/SchemaJ.java +66 -0
- data/src/main/java/smile/xml/SmileXML.java +65 -0
- data/src/main/java/smile/xml/XmlJ.java +58 -0
- data/src/main/java/smile/xml/sax/CallbackHandler.java +113 -0
- data/src/main/java/smile/xml/sax/SaxParserCallbacksJ.java +71 -0
- data/src/main/java/smile/xml/sax/SaxParserJ.java +153 -0
- data/src/main/java/smile/xml/util/UtilJ.java +424 -0
- data/src/main/java/smile/xml/xpath/CustomNamespaceContext.java +59 -0
- data/src/main/java/smile/xml/xpath/XPathContextJ.java +154 -0
- data/src/main/java/smile/xml/xpath/XPathExpressionJ.java +62 -0
- data/src/main/java/smile/xml/xpath/XPathJ.java +36 -0
- data/src/main/java/smile/xml/xpath/XPathObjectJ.java +196 -0
- data/src/main/java/smile/xml/xpath/XPointerJ.java +32 -0
- data/src/main/ruby/xml/libxml.rb +1 -0
- data/src/main/ruby/xml.rb +5 -0
- data/src/test/ruby/etc_doc_to_s.rb +21 -0
- data/src/test/ruby/ets_doc_file.rb +17 -0
- data/src/test/ruby/ets_doc_to_s.rb +23 -0
- data/src/test/ruby/ets_gpx.rb +28 -0
- data/src/test/ruby/ets_node_gc.rb +23 -0
- data/src/test/ruby/ets_test.xml +2 -0
- data/src/test/ruby/ets_tsr.rb +11 -0
- data/src/test/ruby/model/atom.xml +13 -0
- data/src/test/ruby/model/bands.iso-8859-1.xml +5 -0
- data/src/test/ruby/model/bands.utf-8.xml +5 -0
- data/src/test/ruby/model/bands.xml +5 -0
- data/src/test/ruby/model/books.xml +146 -0
- data/src/test/ruby/model/merge_bug_data.xml +58 -0
- data/src/test/ruby/model/ruby-lang.html +238 -0
- data/src/test/ruby/model/rubynet.xml +79 -0
- data/src/test/ruby/model/shiporder.rnc +28 -0
- data/src/test/ruby/model/shiporder.rng +86 -0
- data/src/test/ruby/model/shiporder.xml +23 -0
- data/src/test/ruby/model/shiporder.xsd +31 -0
- data/src/test/ruby/model/soap.xml +27 -0
- data/src/test/ruby/model/xinclude.xml +5 -0
- data/src/test/ruby/smile_xml_test.rb +64 -0
- data/src/test/ruby/tc_attr.rb +191 -0
- data/src/test/ruby/tc_attr_decl.rb +133 -0
- data/src/test/ruby/tc_attributes.rb +135 -0
- data/src/test/ruby/tc_deprecated_require.rb +13 -0
- data/src/test/ruby/tc_document.rb +162 -0
- data/src/test/ruby/tc_document_write.rb +212 -0
- data/src/test/ruby/tc_dtd.rb +125 -0
- data/src/test/ruby/tc_error.rb +150 -0
- data/src/test/ruby/tc_html_parser.rb +140 -0
- data/src/test/ruby/tc_namespace.rb +62 -0
- data/src/test/ruby/tc_namespaces.rb +210 -0
- data/src/test/ruby/tc_node.rb +273 -0
- data/src/test/ruby/tc_node_cdata.rb +51 -0
- data/src/test/ruby/tc_node_comment.rb +33 -0
- data/src/test/ruby/tc_node_copy.rb +42 -0
- data/src/test/ruby/tc_node_edit.rb +178 -0
- data/src/test/ruby/tc_node_text.rb +73 -0
- data/src/test/ruby/tc_node_write.rb +108 -0
- data/src/test/ruby/tc_node_xlink.rb +29 -0
- data/src/test/ruby/tc_parser.rb +371 -0
- data/src/test/ruby/tc_parser_context.rb +189 -0
- data/src/test/ruby/tc_properties.rb +40 -0
- data/src/test/ruby/tc_reader.rb +306 -0
- data/src/test/ruby/tc_relaxng.rb +54 -0
- data/src/test/ruby/tc_sax_parser.rb +340 -0
- data/src/test/ruby/tc_schema.rb +59 -0
- data/src/test/ruby/tc_traversal.rb +222 -0
- data/src/test/ruby/tc_xinclude.rb +21 -0
- data/src/test/ruby/tc_xml.rb +226 -0
- data/src/test/ruby/tc_xpath.rb +210 -0
- data/src/test/ruby/tc_xpath_context.rb +80 -0
- data/src/test/ruby/tc_xpath_expression.rb +38 -0
- data/src/test/ruby/tc_xpointer.rb +74 -0
- data/src/test/ruby/test_helper.rb +23 -0
- data/src/test/ruby/test_suite.rb +41 -0
- metadata +91 -5
@@ -0,0 +1,67 @@
|
|
1
|
+
package smile.xml;
|
2
|
+
|
3
|
+
import org.jruby.Ruby;
|
4
|
+
import org.jruby.RubyClass;
|
5
|
+
import org.jruby.RubyModule;
|
6
|
+
import org.jruby.RubyObject;
|
7
|
+
import org.jruby.RubyString;
|
8
|
+
import org.jruby.anno.JRubyMethod;
|
9
|
+
import org.jruby.runtime.ObjectAllocator;
|
10
|
+
import org.jruby.runtime.ThreadContext;
|
11
|
+
import org.jruby.runtime.builtin.IRubyObject;
|
12
|
+
import smile.xml.util.UtilJ;
|
13
|
+
|
14
|
+
public class NamespaceJ extends RubyObject
|
15
|
+
{
|
16
|
+
private static final long serialVersionUID = 4128551928821799987L;
|
17
|
+
private static final ObjectAllocator ALLOCATOR = new ObjectAllocator()
|
18
|
+
{
|
19
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klass)
|
20
|
+
{
|
21
|
+
return new NamespaceJ(runtime, klass); } } ;
|
22
|
+
private NodeJ node;
|
23
|
+
private RubyString prefix;
|
24
|
+
private RubyString href;
|
25
|
+
|
26
|
+
public static RubyClass define(Ruby runtime) { RubyModule module = UtilJ.getModule(runtime, new String[] { "LibXML", "XML" });
|
27
|
+
RubyClass result = module.defineClassUnder("Namespace", runtime.getObject(), ALLOCATOR);
|
28
|
+
result.defineAnnotatedMethods(NamespaceJ.class);
|
29
|
+
return result; }
|
30
|
+
|
31
|
+
private static RubyClass getRubyClass(Ruby runtime)
|
32
|
+
{
|
33
|
+
return UtilJ.getClass(runtime, new String[] { "LibXML", "XML", "Namespace" });
|
34
|
+
}
|
35
|
+
|
36
|
+
public static NamespaceJ newInstance(ThreadContext context, IRubyObject node, IRubyObject prefix, IRubyObject uri)
|
37
|
+
{
|
38
|
+
IRubyObject[] args = { node, uri, prefix };
|
39
|
+
return (NamespaceJ)getRubyClass(context.getRuntime()).newInstance(context, args, null);
|
40
|
+
}
|
41
|
+
|
42
|
+
public NamespaceJ(Ruby runtime, RubyClass metaClass)
|
43
|
+
{
|
44
|
+
super(runtime, metaClass);
|
45
|
+
}
|
46
|
+
@JRubyMethod(name={"initialize"})
|
47
|
+
public void initialize(ThreadContext context, IRubyObject pNode, IRubyObject pHref, IRubyObject pPrefix) {
|
48
|
+
this.node = ((NodeJ)pNode);
|
49
|
+
if (!pHref.isNil())
|
50
|
+
this.href = ((RubyString)pHref);
|
51
|
+
if (!pPrefix.isNil())
|
52
|
+
this.prefix = ((RubyString)pPrefix);
|
53
|
+
}
|
54
|
+
|
55
|
+
@JRubyMethod(name={"prefix"})
|
56
|
+
public IRubyObject getPrefix(ThreadContext context) {
|
57
|
+
return this.prefix == null ? context.getRuntime().getNil() : this.prefix;
|
58
|
+
}
|
59
|
+
@JRubyMethod(name={"href"})
|
60
|
+
public IRubyObject getHref(ThreadContext context) {
|
61
|
+
return this.href == null ? context.getRuntime().getNil() : this.href;
|
62
|
+
}
|
63
|
+
@JRubyMethod(name={"node"})
|
64
|
+
public IRubyObject getNode(ThreadContext context) {
|
65
|
+
return this.node;
|
66
|
+
}
|
67
|
+
}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
package smile.xml;
|
2
|
+
|
3
|
+
import org.jruby.Ruby;
|
4
|
+
import org.jruby.RubyClass;
|
5
|
+
import org.jruby.RubyModule;
|
6
|
+
import org.jruby.RubyObject;
|
7
|
+
import org.jruby.anno.JRubyMethod;
|
8
|
+
import org.jruby.runtime.ObjectAllocator;
|
9
|
+
import org.jruby.runtime.ThreadContext;
|
10
|
+
import org.jruby.runtime.builtin.IRubyObject;
|
11
|
+
import org.w3c.dom.Node;
|
12
|
+
import smile.xml.util.UtilJ;
|
13
|
+
|
14
|
+
public class NamespacesJ extends RubyObject
|
15
|
+
{
|
16
|
+
private static final long serialVersionUID = 4673137342270845475L;
|
17
|
+
private static final ObjectAllocator ALLOCATOR = new ObjectAllocator()
|
18
|
+
{
|
19
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klass)
|
20
|
+
{
|
21
|
+
return new NamespacesJ(runtime, klass);
|
22
|
+
} } ;
|
23
|
+
private NodeJ node;
|
24
|
+
|
25
|
+
public static RubyClass define(Ruby runtime) { RubyModule module = UtilJ.getModule(runtime, new String[] { "LibXML", "XML" });
|
26
|
+
RubyClass result = module.defineClassUnder("Namespaces", runtime.getObject(), ALLOCATOR);
|
27
|
+
result.defineAnnotatedMethods(NamespacesJ.class);
|
28
|
+
return result; }
|
29
|
+
|
30
|
+
private static RubyClass getRubyClass(Ruby runtime)
|
31
|
+
{
|
32
|
+
return UtilJ.getClass(runtime, new String[] { "LibXML", "XML", "Namespaces" });
|
33
|
+
}
|
34
|
+
|
35
|
+
public static NamespacesJ newInstance(ThreadContext context, NodeJ node)
|
36
|
+
{
|
37
|
+
IRubyObject[] args = { node };
|
38
|
+
return (NamespacesJ)getRubyClass(context.getRuntime()).newInstance(context, args, null);
|
39
|
+
}
|
40
|
+
|
41
|
+
public NamespacesJ(Ruby runtime, RubyClass metaClass)
|
42
|
+
{
|
43
|
+
super(runtime, metaClass);
|
44
|
+
}
|
45
|
+
@JRubyMethod(name={"initialize"})
|
46
|
+
public void initialize(ThreadContext context, IRubyObject pNode) {
|
47
|
+
this.node = ((NodeJ)pNode);
|
48
|
+
}
|
49
|
+
|
50
|
+
@JRubyMethod(name={"namespace"})
|
51
|
+
public IRubyObject getNamespace(ThreadContext context) {
|
52
|
+
Ruby run = context.getRuntime();
|
53
|
+
|
54
|
+
String tmp = ((Node)this.node.getJavaObject()).getPrefix();
|
55
|
+
IRubyObject prefix = tmp == null ? run.getNil() : run.newString(tmp);
|
56
|
+
|
57
|
+
tmp = ((Node)this.node.getJavaObject()).getNamespaceURI();
|
58
|
+
IRubyObject uri = tmp == null ? run.getNil() : run.newString(tmp);
|
59
|
+
|
60
|
+
return NamespaceJ.newInstance(context, this.node, prefix, uri);
|
61
|
+
}
|
62
|
+
}
|