libxml-fixed-jruby 1.0.0-jruby
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.
- data/History.txt +4 -0
- data/Manifest.txt +91 -0
- data/README.txt +50 -0
- data/Rakefile +40 -0
- data/lib/libxml-jruby.rb +84 -0
- data/lib/libxml-jruby/xml.rb +1 -0
- data/lib/libxml-jruby/xml/attr.rb +46 -0
- data/lib/libxml-jruby/xml/attributes.rb +68 -0
- data/lib/libxml-jruby/xml/document.rb +52 -0
- data/lib/libxml-jruby/xml/dtd.rb +25 -0
- data/lib/libxml-jruby/xml/node.rb +285 -0
- data/lib/libxml-jruby/xml/ns.rb +19 -0
- data/lib/libxml-jruby/xml/parser.rb +121 -0
- data/lib/libxml-jruby/xml/xpath.rb +98 -0
- data/lib/libxml.rb +1 -0
- data/lib/xml.rb +13 -0
- data/lib/xml/libxml.rb +8 -0
- data/script/benchmark/depixelate.rb +633 -0
- data/script/benchmark/hamlet.xml +9055 -0
- data/script/benchmark/sock_entries.xml +507 -0
- data/script/benchmark/throughput.rb +40 -0
- data/script/benchmark/xml_benchmarks.rb +228 -0
- data/script/test +6 -0
- data/tasks/ann.rake +81 -0
- data/tasks/bones.rake +21 -0
- data/tasks/gem.rake +126 -0
- data/tasks/git.rake +41 -0
- data/tasks/manifest.rake +49 -0
- data/tasks/notes.rake +28 -0
- data/tasks/post_load.rake +39 -0
- data/tasks/rdoc.rake +51 -0
- data/tasks/rubyforge.rake +57 -0
- data/tasks/setup.rb +268 -0
- data/tasks/spec.rake +55 -0
- data/tasks/svn.rake +48 -0
- data/tasks/test.rake +38 -0
- data/test/etc_doc_to_s.rb +19 -0
- data/test/ets_copy_bug.rb +21 -0
- data/test/ets_copy_bug3.rb +38 -0
- data/test/ets_doc_file.rb +15 -0
- data/test/ets_doc_to_s.rb +21 -0
- data/test/ets_gpx.rb +26 -0
- data/test/ets_node_gc.rb +21 -0
- data/test/ets_test.xml +2 -0
- data/test/ets_tsr.rb +9 -0
- data/test/model/books.xml +147 -0
- data/test/model/default_validation_bug.rb +0 -0
- data/test/model/merge_bug_data.xml +58 -0
- data/test/model/rubynet.xml +78 -0
- data/test/model/rubynet_project +1 -0
- data/test/model/saxtest.xml +5 -0
- data/test/model/shiporder.rnc +28 -0
- data/test/model/shiporder.rng +86 -0
- data/test/model/shiporder.xml +23 -0
- data/test/model/shiporder.xsd +31 -0
- data/test/model/simple.xml +7 -0
- data/test/model/soap.xml +27 -0
- data/test/model/xinclude.xml +5 -0
- data/test/tc_attributes.rb +110 -0
- data/test/tc_deprecated_require.rb +13 -0
- data/test/tc_document.rb +97 -0
- data/test/tc_document_write.rb +139 -0
- data/test/tc_dtd.rb +70 -0
- data/test/tc_html_parser.rb +63 -0
- data/test/tc_node.rb +108 -0
- data/test/tc_node_attr.rb +176 -0
- data/test/tc_node_cdata.rb +51 -0
- data/test/tc_node_comment.rb +32 -0
- data/test/tc_node_copy.rb +40 -0
- data/test/tc_node_edit.rb +98 -0
- data/test/tc_node_set.rb +24 -0
- data/test/tc_node_set2.rb +37 -0
- data/test/tc_node_text.rb +17 -0
- data/test/tc_node_xlink.rb +28 -0
- data/test/tc_ns.rb +18 -0
- data/test/tc_parser.rb +308 -0
- data/test/tc_parser_context.rb +126 -0
- data/test/tc_properties.rb +37 -0
- data/test/tc_reader.rb +112 -0
- data/test/tc_relaxng.rb +39 -0
- data/test/tc_sax_parser.rb +113 -0
- data/test/tc_schema.rb +39 -0
- data/test/tc_traversal.rb +220 -0
- data/test/tc_well_formed.rb +11 -0
- data/test/tc_xinclude.rb +26 -0
- data/test/tc_xpath.rb +130 -0
- data/test/tc_xpath_context.rb +72 -0
- data/test/tc_xpointer.rb +78 -0
- data/test/test_libxml-jruby.rb +0 -0
- data/test/test_suite.rb +31 -0
- data/test/ts_working.rb +31 -0
- metadata +146 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
README.txt
|
4
|
+
Rakefile
|
5
|
+
lib/libxml-jruby.rb
|
6
|
+
lib/libxml-jruby/xml.rb
|
7
|
+
lib/libxml-jruby/xml/attr.rb
|
8
|
+
lib/libxml-jruby/xml/attributes.rb
|
9
|
+
lib/libxml-jruby/xml/document.rb
|
10
|
+
lib/libxml-jruby/xml/dtd.rb
|
11
|
+
lib/libxml-jruby/xml/node.rb
|
12
|
+
lib/libxml-jruby/xml/ns.rb
|
13
|
+
lib/libxml-jruby/xml/parser.rb
|
14
|
+
lib/libxml-jruby/xml/xpath.rb
|
15
|
+
lib/libxml.rb
|
16
|
+
lib/xml.rb
|
17
|
+
lib/xml/libxml.rb
|
18
|
+
script/benchmark/depixelate.rb
|
19
|
+
script/benchmark/hamlet.xml
|
20
|
+
script/benchmark/sock_entries.xml
|
21
|
+
script/benchmark/throughput.rb
|
22
|
+
script/benchmark/xml_benchmarks.rb
|
23
|
+
script/test
|
24
|
+
tasks/ann.rake
|
25
|
+
tasks/bones.rake
|
26
|
+
tasks/gem.rake
|
27
|
+
tasks/git.rake
|
28
|
+
tasks/manifest.rake
|
29
|
+
tasks/notes.rake
|
30
|
+
tasks/post_load.rake
|
31
|
+
tasks/rdoc.rake
|
32
|
+
tasks/rubyforge.rake
|
33
|
+
tasks/setup.rb
|
34
|
+
tasks/spec.rake
|
35
|
+
tasks/svn.rake
|
36
|
+
tasks/test.rake
|
37
|
+
test/etc_doc_to_s.rb
|
38
|
+
test/ets_copy_bug.rb
|
39
|
+
test/ets_copy_bug3.rb
|
40
|
+
test/ets_doc_file.rb
|
41
|
+
test/ets_doc_to_s.rb
|
42
|
+
test/ets_gpx.rb
|
43
|
+
test/ets_node_gc.rb
|
44
|
+
test/ets_test.xml
|
45
|
+
test/ets_tsr.rb
|
46
|
+
test/model/books.xml
|
47
|
+
test/model/default_validation_bug.rb
|
48
|
+
test/model/merge_bug_data.xml
|
49
|
+
test/model/rubynet.xml
|
50
|
+
test/model/rubynet_project
|
51
|
+
test/model/saxtest.xml
|
52
|
+
test/model/shiporder.rnc
|
53
|
+
test/model/shiporder.rng
|
54
|
+
test/model/shiporder.xml
|
55
|
+
test/model/shiporder.xsd
|
56
|
+
test/model/simple.xml
|
57
|
+
test/model/soap.xml
|
58
|
+
test/model/xinclude.xml
|
59
|
+
test/tc_attributes.rb
|
60
|
+
test/tc_deprecated_require.rb
|
61
|
+
test/tc_document.rb
|
62
|
+
test/tc_document_write.rb
|
63
|
+
test/tc_dtd.rb
|
64
|
+
test/tc_html_parser.rb
|
65
|
+
test/tc_node.rb
|
66
|
+
test/tc_node_attr.rb
|
67
|
+
test/tc_node_cdata.rb
|
68
|
+
test/tc_node_comment.rb
|
69
|
+
test/tc_node_copy.rb
|
70
|
+
test/tc_node_edit.rb
|
71
|
+
test/tc_node_set.rb
|
72
|
+
test/tc_node_set2.rb
|
73
|
+
test/tc_node_text.rb
|
74
|
+
test/tc_node_xlink.rb
|
75
|
+
test/tc_ns.rb
|
76
|
+
test/tc_parser.rb
|
77
|
+
test/tc_parser_context.rb
|
78
|
+
test/tc_properties.rb
|
79
|
+
test/tc_reader.rb
|
80
|
+
test/tc_relaxng.rb
|
81
|
+
test/tc_sax_parser.rb
|
82
|
+
test/tc_schema.rb
|
83
|
+
test/tc_traversal.rb
|
84
|
+
test/tc_well_formed.rb
|
85
|
+
test/tc_xinclude.rb
|
86
|
+
test/tc_xpath.rb
|
87
|
+
test/tc_xpath_context.rb
|
88
|
+
test/tc_xpointer.rb
|
89
|
+
test/test_libxml-jruby.rb
|
90
|
+
test/test_suite.rb
|
91
|
+
test/ts_working.rb
|
data/README.txt
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
libxml-jruby
|
2
|
+
by Michael Guterl
|
3
|
+
http://diminishing.org
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
LibXMLJRuby is a LibXMLRuby compatibility layer that mimcs the LibXMLRuby
|
8
|
+
interface as closely as possible. LibXMLJRuby does not use libxml at all
|
9
|
+
it just delegates the methods to the appropriate underlying Java class.
|
10
|
+
|
11
|
+
== FEATURES/PROBLEMS:
|
12
|
+
|
13
|
+
* FIXME (list of features or problems)
|
14
|
+
|
15
|
+
== SYNOPSIS:
|
16
|
+
|
17
|
+
FIXME (code sample of usage)
|
18
|
+
|
19
|
+
== REQUIREMENTS:
|
20
|
+
|
21
|
+
* FIXME (list of requirements)
|
22
|
+
|
23
|
+
== INSTALL:
|
24
|
+
|
25
|
+
jruby -S gem install dylanvaughn-libxml-jruby --source=http://gems.github.com
|
26
|
+
|
27
|
+
== LICENSE:
|
28
|
+
|
29
|
+
(The MIT License)
|
30
|
+
|
31
|
+
Copyright (c) 2008 FIXME (different license?)
|
32
|
+
|
33
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
34
|
+
a copy of this software and associated documentation files (the
|
35
|
+
'Software'), to deal in the Software without restriction, including
|
36
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
37
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
38
|
+
permit persons to whom the Software is furnished to do so, subject to
|
39
|
+
the following conditions:
|
40
|
+
|
41
|
+
The above copyright notice and this permission notice shall be
|
42
|
+
included in all copies or substantial portions of the Software.
|
43
|
+
|
44
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
45
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
46
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
47
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
48
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
49
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
50
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Look in the tasks/setup.rb file for the various options that can be
|
2
|
+
# configured in this Rakefile. The .rake files in the tasks directory
|
3
|
+
# are where the options are used.
|
4
|
+
|
5
|
+
load 'tasks/setup.rb'
|
6
|
+
|
7
|
+
ensure_in_path 'lib'
|
8
|
+
require 'libxml-jruby'
|
9
|
+
|
10
|
+
task :default => 'spec:run'
|
11
|
+
|
12
|
+
PROJ.name = 'libxml-jruby'
|
13
|
+
PROJ.authors = 'Michael Guterl'
|
14
|
+
PROJ.email = 'mguterl@gmail.com'
|
15
|
+
PROJ.url = 'FIXME (project homepage)'
|
16
|
+
PROJ.rubyforge.name = 'libxml-jruby'
|
17
|
+
|
18
|
+
PROJ.spec.opts << '--color'
|
19
|
+
|
20
|
+
begin
|
21
|
+
require 'jeweler'
|
22
|
+
Jeweler::Tasks.new do |gemspec|
|
23
|
+
gemspec.name = "libxml-fixed-jruby"
|
24
|
+
gemspec.version = "1.0.0"
|
25
|
+
gemspec.date = "2008-09-20"
|
26
|
+
gemspec.summary = "LibXMLRuby compatibility layer for jruby"
|
27
|
+
gemspec.homepage = "http://rubyforge.org/projects/libxml-jruby"
|
28
|
+
gemspec.authors = "Michael Guterl"
|
29
|
+
gemspec.email = "mguterl @nospam@ gmail.com"
|
30
|
+
gemspec.rubyforge_project = "libxml-fixed-jruby"
|
31
|
+
gemspec.has_rdoc = false
|
32
|
+
gemspec.platform = "jruby"
|
33
|
+
gemspec.files = FileList['lib/**/*.rb', 'script/**/*', 'tasks/**/*', '[A-Z]*', 'test/**/*'].to_a
|
34
|
+
end
|
35
|
+
Jeweler::GemcutterTasks.new
|
36
|
+
rescue LoadError
|
37
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalsteaks-jeweler -s http://gems.github.com"
|
38
|
+
end
|
39
|
+
|
40
|
+
# EOF
|
data/lib/libxml-jruby.rb
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
# Equivalent to a header guard in C/C++
|
4
|
+
# Used to prevent the class/module from being loaded more than once
|
5
|
+
unless defined? LibXMLJRuby
|
6
|
+
|
7
|
+
module LibXMLJRuby
|
8
|
+
|
9
|
+
# :stopdoc:
|
10
|
+
VERSION = '1.0.0'
|
11
|
+
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
|
12
|
+
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
|
13
|
+
# :startdoc:
|
14
|
+
|
15
|
+
# Returns the version string for the library.
|
16
|
+
#
|
17
|
+
def self.version
|
18
|
+
VERSION
|
19
|
+
end
|
20
|
+
|
21
|
+
# Returns the library path for the module. If any arguments are given,
|
22
|
+
# they will be joined to the end of the libray path using
|
23
|
+
# <tt>File.join</tt>.
|
24
|
+
#
|
25
|
+
def self.libpath( *args )
|
26
|
+
args.empty? ? LIBPATH : ::File.join(LIBPATH, *args)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Returns the lpath for the module. If any arguments are given,
|
30
|
+
# they will be joined to the end of the path using
|
31
|
+
# <tt>File.join</tt>.
|
32
|
+
#
|
33
|
+
def self.path( *args )
|
34
|
+
args.empty? ? PATH : ::File.join(PATH, *args)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Utility method used to rquire all files ending in .rb that lie in the
|
38
|
+
# directory below this file that has the same name as the filename passed
|
39
|
+
# in. Optionally, a specific _directory_ name can be passed in such that
|
40
|
+
# the _filename_ does not have to be equivalent to the directory.
|
41
|
+
#
|
42
|
+
def self.require_all_libs_relative_to( fname, dir = nil )
|
43
|
+
dir ||= ::File.basename(fname, '.*')
|
44
|
+
search_me = ::File.expand_path(
|
45
|
+
::File.join(::File.dirname(fname), dir, '**', '*.rb'))
|
46
|
+
|
47
|
+
Dir.glob(search_me).sort.each {|rb| require rb}
|
48
|
+
end
|
49
|
+
|
50
|
+
end # module LibXMLJRuby
|
51
|
+
|
52
|
+
require 'java'
|
53
|
+
require 'stringio'
|
54
|
+
|
55
|
+
# these use include_class to avoid conflicts with Rake's top-level
|
56
|
+
# import method, the issue doesn't seem to occur when not using a
|
57
|
+
# string.
|
58
|
+
include_class 'com.sun.org.apache.xml.internal.utils.PrefixResolver'
|
59
|
+
include_class 'com.sun.org.apache.xml.internal.utils.PrefixResolverDefault'
|
60
|
+
include_class 'org.xml.sax.InputSource'
|
61
|
+
|
62
|
+
include_class 'java.io.ByteArrayInputStream'
|
63
|
+
include_class 'java.io.StringReader'
|
64
|
+
include_class 'java.io.StringWriter'
|
65
|
+
|
66
|
+
include_class 'javax.xml.parsers.DocumentBuilder'
|
67
|
+
include_class 'javax.xml.parsers.DocumentBuilderFactory'
|
68
|
+
include_class 'javax.xml.transform.stream.StreamSource'
|
69
|
+
include_class 'javax.xml.transform.stream.StreamResult'
|
70
|
+
include_class 'javax.xml.transform.TransformerFactory'
|
71
|
+
include_class 'javax.xml.transform.dom.DOMSource'
|
72
|
+
include_class 'javax.xml.validation.Schema'
|
73
|
+
include_class 'javax.xml.validation.SchemaFactory'
|
74
|
+
include_class 'javax.xml.xpath.XPath'
|
75
|
+
include_class 'javax.xml.xpath.XPathFactory'
|
76
|
+
include_class 'javax.xml.xpath.XPathConstants'
|
77
|
+
|
78
|
+
|
79
|
+
LibXMLJRuby.require_all_libs_relative_to __FILE__
|
80
|
+
::LibXML = ::LibXMLJRuby
|
81
|
+
|
82
|
+
end # unless defined?
|
83
|
+
|
84
|
+
# EOF
|
@@ -0,0 +1 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/xml/node'
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module LibXMLJRuby
|
2
|
+
module XML
|
3
|
+
class Attr < Node
|
4
|
+
class << self
|
5
|
+
def from_java(java_obj)
|
6
|
+
return nil unless java_obj
|
7
|
+
a = allocate
|
8
|
+
a.java_obj = java_obj
|
9
|
+
a
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
attr_accessor :java_obj
|
14
|
+
|
15
|
+
def initialize(node, name, value, ns = nil)
|
16
|
+
self.java_obj = node.java_obj
|
17
|
+
java_obj.set_attribute(name, value)
|
18
|
+
end
|
19
|
+
|
20
|
+
def remove!
|
21
|
+
java_obj.owner_element.remove_attribute(name)
|
22
|
+
end
|
23
|
+
|
24
|
+
def parent?
|
25
|
+
!!parent
|
26
|
+
end
|
27
|
+
|
28
|
+
def parent
|
29
|
+
LibXMLJRuby::XML::Node.from_java(java_obj.owner_element)
|
30
|
+
end
|
31
|
+
|
32
|
+
def name
|
33
|
+
java_obj.respond_to?(:name) ? java_obj.name : java_obj.node_name
|
34
|
+
end
|
35
|
+
|
36
|
+
def value
|
37
|
+
java_obj.value
|
38
|
+
end
|
39
|
+
|
40
|
+
def value=(value)
|
41
|
+
raise TypeError if value.nil?
|
42
|
+
java_obj.value = value
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module LibXMLJRuby
|
2
|
+
module XML
|
3
|
+
class Attributes
|
4
|
+
include Enumerable
|
5
|
+
|
6
|
+
class << self
|
7
|
+
def from_java(java_obj)
|
8
|
+
attrs = LibXMLJRuby::XML::Attributes.new
|
9
|
+
attrs.java_obj = java_obj
|
10
|
+
attrs
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
attr_accessor :java_obj
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@attribute_cache = {}
|
18
|
+
end
|
19
|
+
|
20
|
+
def each
|
21
|
+
i = 0
|
22
|
+
while(i < length)
|
23
|
+
yield get_attribute(java_obj.attributes.item(i).name)
|
24
|
+
i += 1
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def length
|
29
|
+
java_obj.attributes.length
|
30
|
+
end
|
31
|
+
|
32
|
+
def [](name)
|
33
|
+
attr = get_attribute(name)
|
34
|
+
attr ? attr.value : nil
|
35
|
+
end
|
36
|
+
|
37
|
+
def []=(name, value)
|
38
|
+
attr = get_attribute(name)
|
39
|
+
if attr
|
40
|
+
attr.value = value
|
41
|
+
else
|
42
|
+
java_obj.setAttribute(name.to_s, value.to_s)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def get_attribute_ns(name, ns)
|
47
|
+
attr = java_obj.get_attribute_node_ns(name, ns)
|
48
|
+
attr ? nil : LibXMLJRuby::XML::Attr.from_java(attr)
|
49
|
+
end
|
50
|
+
|
51
|
+
def get_attribute(name)
|
52
|
+
if @attribute_cache[name.to_s]
|
53
|
+
@attribute_cache[name.to_s]
|
54
|
+
elsif java_obj && java_obj.attributes
|
55
|
+
attr = java_obj.attributes.get_named_item(name.to_s)
|
56
|
+
if attr
|
57
|
+
@attribute_cache[name.to_s] = LibXMLJRuby::XML::Attr.from_java(attr)
|
58
|
+
@attribute_cache[name.to_s]
|
59
|
+
else
|
60
|
+
nil
|
61
|
+
end
|
62
|
+
else
|
63
|
+
nil
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module LibXMLJRuby
|
2
|
+
module XML
|
3
|
+
class Document
|
4
|
+
class << self
|
5
|
+
def file(filename)
|
6
|
+
LibXMLJRuby::XML::Parser.file(filename).parse
|
7
|
+
end
|
8
|
+
|
9
|
+
def string(str)
|
10
|
+
LibXMLJRuby::XML::Parser.string(str).parse
|
11
|
+
end
|
12
|
+
|
13
|
+
def from_java(java_obj)
|
14
|
+
d = new
|
15
|
+
d.java_obj = java_obj
|
16
|
+
d
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
attr_accessor :java_obj # org.w3c.dom.Document
|
21
|
+
|
22
|
+
def initialize(xml_version = 1.0)
|
23
|
+
@xml_version = xml_version
|
24
|
+
@xpath_cache = {}
|
25
|
+
end
|
26
|
+
|
27
|
+
def validate(dtd)
|
28
|
+
dtd.validate(self)
|
29
|
+
end
|
30
|
+
|
31
|
+
def find(expr, nslist = nil)
|
32
|
+
@xpath_cache[[expr, nslist]] ||= LibXMLJRuby::XML::XPath::Object.new(expr, self, nslist)
|
33
|
+
end
|
34
|
+
|
35
|
+
def find_first(expr, nslist = nil)
|
36
|
+
find(expr, nslist).first
|
37
|
+
end
|
38
|
+
|
39
|
+
def child?
|
40
|
+
java_obj.hasChildNodes
|
41
|
+
end
|
42
|
+
|
43
|
+
def parent?
|
44
|
+
!!java_obj.parent_node
|
45
|
+
end
|
46
|
+
|
47
|
+
def root
|
48
|
+
@root ||= Node.from_java(java_obj.document_element)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|