Sha256: 01ca3629d50a694e070f9a05da522296ad6c9f60dc110784ba648fa861da9129
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
module LibXMLJRuby module XML class Document class << self def file(filename) LibXMLJRuby::XML::Parser.file(filename).parse end def string(str) LibXMLJRuby::XML::Parser.string(str).parse end def from_java(java_obj) d = new d.java_obj = java_obj d end end attr_accessor :java_obj # org.w3c.dom.Document def initialize(xml_version = 1.0) @xml_version = xml_version @xpath_cache = {} end def validate(dtd) dtd.validate(self) end def find(expr, nslist = nil) @xpath_cache[[expr, nslist]] ||= LibXMLJRuby::XML::XPath::Object.new(expr, self, nslist) end def find_first(expr, nslist = nil) find(expr, nslist).first end def child? java_obj.hasChildNodes end def parent? !!java_obj.parent_node end def root @root ||= Node.from_java(java_obj.document_element) end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
libxml-fixed-jruby-1.0.0-jruby | lib/libxml-jruby/xml/document.rb |
libxml-jruby-fixed-1.0.0-jruby | lib/libxml-jruby/xml/document.rb |