code
stringlengths 26
124k
| docstring
stringlengths 23
125k
| func_name
stringlengths 1
98
| language
stringclasses 1
value | repo
stringlengths 5
53
| path
stringlengths 7
151
| url
stringlengths 50
211
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
def initialize(source)
super()
if (source.kind_of? Array)
@element_name, @pairs, @contents = *source
end
end
|
Create an AttlistDecl, pulling the information from a Source. Notice
that this isn't very convenient; to create an AttlistDecl, you basically
have to format it yourself, and then have the initializer parse it.
Sorry, but for the foreseeable future, DTD support in REXML is pretty
weak on convenience. Have I mentioned how much I hate DTDs?
|
initialize
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attlistdecl.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attlistdecl.rb
|
Apache-2.0
|
def include?(key)
@pairs.keys.include? key
end
|
Whether an attlist declaration includes the given attribute definition
if attlist_decl.include? "xmlns:foobar"
|
include?
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attlistdecl.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attlistdecl.rb
|
Apache-2.0
|
def write out, indent=-1
out << @contents
end
|
Write out exactly what we got in.
|
write
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attlistdecl.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attlistdecl.rb
|
Apache-2.0
|
def initialize( first, second=nil, parent=nil )
@normalized = @unnormalized = @element = nil
if first.kind_of? Attribute
self.name = first.expanded_name
@unnormalized = first.value
if second.kind_of? Element
@element = second
else
@element = first.element
end
elsif first.kind_of? String
@element = parent
self.name = first
@normalized = second.to_s
else
raise "illegal argument #{first.class.name} to Attribute constructor"
end
end
|
Constructor.
FIXME: The parser doesn't catch illegal characters in attributes
first::
Either: an Attribute, which this new attribute will become a
clone of; or a String, which is the name of this attribute
second::
If +first+ is an Attribute, then this may be an Element, or nil.
If nil, then the Element parent of this attribute is the parent
of the +first+ Attribute. If the first argument is a String,
then this must also be a String, and is the content of the attribute.
If this is the content, it must be fully normalized (contain no
illegal characters).
parent::
Ignored unless +first+ is a String; otherwise, may be the Element
parent of this attribute, or nil.
Attribute.new( attribute_to_clone )
Attribute.new( attribute_to_clone, parent_element )
Attribute.new( "attr", "attr_value" )
Attribute.new( "attr", "attr_value", parent_element )
|
initialize
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attribute.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attribute.rb
|
Apache-2.0
|
def namespace arg=nil
arg = prefix if arg.nil?
if arg == ""
""
else
@element.namespace(arg)
end
end
|
Returns the namespace URL, if defined, or nil otherwise
e = Element.new("el")
e.add_namespace("ns", "http://url")
e.add_attribute("ns:a", "b")
e.add_attribute("nsx:a", "c")
e.attribute("ns:a").namespace # => "http://url"
e.attribute("nsx:a").namespace # => nil
This method always returns "" for no namespace attribute. Because
the default namespace doesn't apply to attribute names.
From https://www.w3.org/TR/xml-names/#uniqAttrs
> the default namespace does not apply to attribute names
e = REXML::Element.new("el")
e.add_namespace("", "http://example.com/")
e.namespace # => "http://example.com/"
e.add_attribute("a", "b")
e.attribute("a").namespace # => ""
|
namespace
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attribute.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attribute.rb
|
Apache-2.0
|
def hash
name.hash + value.hash
end
|
Creates (and returns) a hash from both the name and value
|
hash
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attribute.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attribute.rb
|
Apache-2.0
|
def to_string
if @element and @element.context and @element.context[:attribute_quote] == :quote
%Q^#@expanded_name="#{to_s().gsub(/"/, '"')}"^
else
"#@expanded_name='#{to_s().gsub(/'/, ''')}'"
end
end
|
Returns this attribute out as XML source, expanding the name
a = Attribute.new( "x", "y" )
a.to_string # -> "x='y'"
b = Attribute.new( "ns:x", "y" )
b.to_string # -> "ns:x='y'"
|
to_string
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attribute.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attribute.rb
|
Apache-2.0
|
def to_s
return @normalized if @normalized
@normalized = Text::normalize( @unnormalized, doctype )
@unnormalized = nil
@normalized
end
|
Returns the attribute value, with entities replaced
|
to_s
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attribute.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attribute.rb
|
Apache-2.0
|
def value
return @unnormalized if @unnormalized
@unnormalized = Text::unnormalize( @normalized, doctype )
@normalized = nil
@unnormalized
end
|
Returns the UNNORMALIZED value of this attribute. That is, entities
have been expanded to their values
|
value
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attribute.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attribute.rb
|
Apache-2.0
|
def remove
@element.attributes.delete self.name unless @element.nil?
end
|
Removes this Attribute from the tree, and returns true if successful
This method is usually not called directly.
|
remove
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attribute.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attribute.rb
|
Apache-2.0
|
def write( output, indent=-1 )
output << to_string
end
|
Writes this attribute (EG, puts 'key="value"' to the output)
|
write
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attribute.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/attribute.rb
|
Apache-2.0
|
def initialize( first, whitespace=true, parent=nil )
super( first, whitespace, parent, false, true, ILLEGAL )
end
|
Constructor. CData is data between <![CDATA[ ... ]]>
_Examples_
CData.new( source )
CData.new( "Here is some CDATA" )
CData.new( "Some unprocessed data", respect_whitespace_TF, parent_element )
|
initialize
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/cdata.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/cdata.rb
|
Apache-2.0
|
def clone
CData.new self
end
|
Make a copy of this object
_Examples_
c = CData.new( "Some text" )
d = c.clone
d.to_s # -> "Some text"
|
clone
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/cdata.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/cdata.rb
|
Apache-2.0
|
def write( output=$stdout, indent=-1, transitive=false, ie_hack=false )
Kernel.warn( "#{self.class.name}.write is deprecated", uplevel: 1)
indent( output, indent )
output << START
output << @string
output << STOP
end
|
== DEPRECATED
See the rexml/formatters package
Generates XML output of this object
output::
Where to write the string. Defaults to $stdout
indent::
The amount to indent this node by
transitive::
Ignored
ie_hack::
Ignored
_Examples_
c = CData.new( " Some text " )
c.write( $stdout ) #-> <![CDATA[ Some text ]]>
|
write
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/cdata.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/cdata.rb
|
Apache-2.0
|
def initialize( parent = nil )
@parent = nil
# Declare @parent, but don't define it. The next line sets the
# parent.
parent.add( self ) if parent
end
|
Constructor. Any inheritors of this class should call super to make
sure this method is called.
parent::
if supplied, the parent of this child will be set to the
supplied value, and self will be added to the parent
|
initialize
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/child.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/child.rb
|
Apache-2.0
|
def replace_with( child )
@parent.replace_child( self, child )
self
end
|
Replaces this object with another object. Basically, calls
Parent.replace_child
Returns:: self
|
replace_with
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/child.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/child.rb
|
Apache-2.0
|
def remove
unless @parent.nil?
@parent.delete self
end
self
end
|
Removes this child from the parent.
Returns:: self
|
remove
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/child.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/child.rb
|
Apache-2.0
|
def document
return parent.document unless parent.nil?
nil
end
|
Returns:: the document this child belongs to, or nil if this child
belongs to no document
|
document
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/child.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/child.rb
|
Apache-2.0
|
def initialize( first, second = nil )
super(second)
if first.kind_of? String
@string = first
elsif first.kind_of? Comment
@string = first.string
end
end
|
#
Constructor. The first argument can be one of three types:
@param first If String, the contents of this comment are set to the
argument. If Comment, the argument is duplicated. If
Source, the argument is scanned for a comment.
@param second If the first argument is a Source, this argument
should be nil, not supplied, or a Parent to be set as the parent
of this object
|
initialize
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/comment.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/comment.rb
|
Apache-2.0
|
def initialize( first, parent=nil )
@entities = DEFAULT_ENTITIES
@long_name = @uri = nil
if first.kind_of? String
super()
@name = first
@external_id = parent
elsif first.kind_of? DocType
super( parent )
@name = first.name
@external_id = first.external_id
@long_name = first.instance_variable_get(:@long_name)
@uri = first.instance_variable_get(:@uri)
elsif first.kind_of? Array
super( parent )
@name = first[0]
@external_id = first[1]
@long_name = first[2]
@uri = first[3]
elsif first.kind_of? Source
super( parent )
parser = Parsers::BaseParser.new( first )
event = parser.pull
if event[0] == :start_doctype
@name, @external_id, @long_name, @uri, = event[1..-1]
end
else
super()
end
end
|
Constructor
dt = DocType.new( 'foo', '-//I/Hate/External/IDs' )
# <!DOCTYPE foo '-//I/Hate/External/IDs'>
dt = DocType.new( doctype_to_clone )
# Incomplete. Shallow clone of doctype
+Note+ that the constructor:
Doctype.new( Source.new( "<!DOCTYPE foo 'bar'>" ) )
is _deprecated_. Do not use it. It will probably disappear.
|
initialize
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/doctype.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/doctype.rb
|
Apache-2.0
|
def write( output, indent=0, transitive=false, ie_hack=false )
f = REXML::Formatters::Default.new
indent( output, indent )
output << START
output << ' '
output << @name
if @external_id
reference_writer = ReferenceWriter.new(@external_id,
@long_name,
@uri,
context)
reference_writer.write(output)
end
unless @children.empty?
output << ' ['
@children.each { |child|
output << "\n"
f.write( child, output )
}
output << "\n]"
end
output << STOP
end
|
output::
Where to write the string
indent::
An integer. If -1, no indentation will be used; otherwise, the
indentation will be this number of spaces, and children will be
indented an additional amount.
transitive::
Ignored
ie_hack::
Ignored
|
write
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/doctype.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/doctype.rb
|
Apache-2.0
|
def public
case @external_id
when "SYSTEM"
nil
when "PUBLIC"
@long_name
end
end
|
This method retrieves the public identifier identifying the document's
DTD.
Method contributed by Henrik Martensson
|
public
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/doctype.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/doctype.rb
|
Apache-2.0
|
def system
case @external_id
when "SYSTEM"
@long_name
when "PUBLIC"
@uri.kind_of?(String) ? @uri : nil
end
end
|
This method retrieves the system identifier identifying the document's DTD
Method contributed by Henrik Martensson
|
system
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/doctype.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/doctype.rb
|
Apache-2.0
|
def notations
children().select {|node| node.kind_of?(REXML::NotationDecl)}
end
|
This method returns a list of notations that have been declared in the
_internal_ DTD subset. Notations in the external DTD subset are not
listed.
Method contributed by Henrik Martensson
|
notations
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/doctype.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/doctype.rb
|
Apache-2.0
|
def notation(name)
notations.find { |notation_decl|
notation_decl.name == name
}
end
|
Retrieves a named notation. Only notations declared in the internal
DTD subset can be retrieved.
Method contributed by Henrik Martensson
|
notation
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/doctype.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/doctype.rb
|
Apache-2.0
|
def initialize( source = nil, context = {} )
@entity_expansion_count = 0
super()
@context = context
return if source.nil?
if source.kind_of? Document
@context = source.context
super source
else
build( source )
end
end
|
:call-seq:
new(string = nil, context = {}) -> new_document
new(io_stream = nil, context = {}) -> new_document
new(document = nil, context = {}) -> new_document
Returns a new \REXML::Document object.
When no arguments are given,
returns an empty document:
d = REXML::Document.new
d.to_s # => ""
When argument +string+ is given, it must be a string
containing a valid XML document:
xml_string = '<root><foo>Foo</foo><bar>Bar</bar></root>'
d = REXML::Document.new(xml_string)
d.to_s # => "<root><foo>Foo</foo><bar>Bar</bar></root>"
When argument +io_stream+ is given, it must be an \IO object
that is opened for reading, and when read must return a valid XML document:
File.write('t.xml', xml_string)
d = File.open('t.xml', 'r') do |io|
REXML::Document.new(io)
end
d.to_s # => "<root><foo>Foo</foo><bar>Bar</bar></root>"
When argument +document+ is given, it must be an existing
document object, whose context and attributes (but not chidren)
are cloned into the new document:
d = REXML::Document.new(xml_string)
d.children # => [<root> ... </>]
d.context = {raw: :all, compress_whitespace: :all}
d.add_attributes({'bar' => 0, 'baz' => 1})
d1 = REXML::Document.new(d)
d1.children # => []
d1.context # => {:raw=>:all, :compress_whitespace=>:all}
d1.attributes # => {"bar"=>bar='0', "baz"=>baz='1'}
When argument +context+ is given, it must be a hash
containing context entries for the document;
see {Element Context}[../doc/rexml/context_rdoc.html]:
context = {raw: :all, compress_whitespace: :all}
d = REXML::Document.new(xml_string, context)
d.context # => {:raw=>:all, :compress_whitespace=>:all}
|
initialize
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/document.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/document.rb
|
Apache-2.0
|
def clone
Document.new self
end
|
:call-seq:
clone -> new_document
Returns the new document resulting from executing
<tt>Document.new(self)</tt>. See Document.new.
|
clone
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/document.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/document.rb
|
Apache-2.0
|
def expanded_name
''
#d = doc_type
#d ? d.name : "UNDEFINED"
end
|
:call-seq:
expanded_name -> empty_string
Returns an empty string.
|
expanded_name
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/document.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/document.rb
|
Apache-2.0
|
def add( child )
if child.kind_of? XMLDecl
if @children[0].kind_of? XMLDecl
@children[0] = child
else
@children.unshift child
end
child.parent = self
elsif child.kind_of? DocType
# Find first Element or DocType node and insert the decl right
# before it. If there is no such node, just insert the child at the
# end. If there is a child and it is an DocType, then replace it.
insert_before_index = @children.find_index { |x|
x.kind_of?(Element) || x.kind_of?(DocType)
}
if insert_before_index # Not null = not end of list
if @children[ insert_before_index ].kind_of? DocType
@children[ insert_before_index ] = child
else
@children[ insert_before_index-1, 0 ] = child
end
else # Insert at end of list
@children << child
end
child.parent = self
else
rv = super
raise "attempted adding second root element to document" if @elements.size > 1
rv
end
end
|
:call-seq:
add(xml_decl) -> self
add(doc_type) -> self
add(object) -> self
Adds an object to the document; returns +self+.
When argument +xml_decl+ is given,
it must be an REXML::XMLDecl object,
which becomes the XML declaration for the document,
replacing the previous XML declaration if any:
d = REXML::Document.new
d.xml_decl.to_s # => ""
d.add(REXML::XMLDecl.new('2.0'))
d.xml_decl.to_s # => "<?xml version='2.0'?>"
When argument +doc_type+ is given,
it must be an REXML::DocType object,
which becomes the document type for the document,
replacing the previous document type, if any:
d = REXML::Document.new
d.doctype.to_s # => ""
d.add(REXML::DocType.new('foo'))
d.doctype.to_s # => "<!DOCTYPE foo>"
When argument +object+ (not an REXML::XMLDecl or REXML::DocType object)
is given it is added as the last child:
d = REXML::Document.new
d.add(REXML::Element.new('foo'))
d.to_s # => "<foo/>"
|
add
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/document.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/document.rb
|
Apache-2.0
|
def add_element(arg=nil, arg2=nil)
rv = super
raise "attempted adding second root element to document" if @elements.size > 1
rv
end
|
:call-seq:
add_element(name_or_element = nil, attributes = nil) -> new_element
Adds an element to the document by calling REXML::Element.add_element:
REXML::Element.add_element(name_or_element, attributes)
|
add_element
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/document.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/document.rb
|
Apache-2.0
|
def root
elements[1]
#self
#@children.find { |item| item.kind_of? Element }
end
|
:call-seq:
root -> root_element or nil
Returns the root element of the document, if it exists, otherwise +nil+:
d = REXML::Document.new('<root></root>')
d.root # => <root/>
d = REXML::Document.new('')
d.root # => nil
|
root
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/document.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/document.rb
|
Apache-2.0
|
def doctype
@children.find { |item| item.kind_of? DocType }
end
|
:call-seq:
doctype -> doc_type or nil
Returns the DocType object for the document, if it exists, otherwise +nil+:
d = REXML::Document.new('<!DOCTYPE document SYSTEM "subjects.dtd">')
d.doctype.class # => REXML::DocType
d = REXML::Document.new('')
d.doctype.class # => nil
|
doctype
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/document.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/document.rb
|
Apache-2.0
|
def xml_decl
rv = @children[0]
return rv if rv.kind_of? XMLDecl
@children.unshift(XMLDecl.default)[0]
end
|
:call-seq:
xml_decl -> xml_decl
Returns the XMLDecl object for the document, if it exists,
otherwise the default XMLDecl object:
d = REXML::Document.new('<?xml version="1.0" encoding="UTF-8"?>')
d.xml_decl.class # => REXML::XMLDecl
d.xml_decl.to_s # => "<?xml version='1.0' encoding='UTF-8'?>"
d = REXML::Document.new('')
d.xml_decl.class # => REXML::XMLDecl
d.xml_decl.to_s # => ""
|
xml_decl
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/document.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/document.rb
|
Apache-2.0
|
def initialize( arg = UNDEFINED, parent=nil, context=nil )
super(parent)
@elements = Elements.new(self)
@attributes = Attributes.new(self)
@context = context
if arg.kind_of? String
self.name = arg
elsif arg.kind_of? Element
self.name = arg.expanded_name
arg.attributes.each_attribute{ |attribute|
@attributes << Attribute.new( attribute )
}
@context = arg.context
end
end
|
:call-seq:
Element.new(name = 'UNDEFINED', parent = nil, context = nil) -> new_element
Element.new(element, parent = nil, context = nil) -> new_element
Returns a new \REXML::Element object.
When no arguments are given,
returns an element with name <tt>'UNDEFINED'</tt>:
e = REXML::Element.new # => <UNDEFINED/>
e.class # => REXML::Element
e.name # => "UNDEFINED"
When only argument +name+ is given,
returns an element of the given name:
REXML::Element.new('foo') # => <foo/>
When only argument +element+ is given, it must be an \REXML::Element object;
returns a shallow copy of the given element:
e0 = REXML::Element.new('foo')
e1 = REXML::Element.new(e0) # => <foo/>
When argument +parent+ is also given, it must be an REXML::Parent object:
e = REXML::Element.new('foo', REXML::Parent.new)
e.parent # => #<REXML::Parent @parent=nil, @children=[<foo/>]>
When argument +context+ is also given, it must be a hash
representing the context for the element;
see {Element Context}[../doc/rexml/context_rdoc.html]:
e = REXML::Element.new('foo', nil, {raw: :all})
e.context # => {:raw=>:all}
|
initialize
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def inspect
rv = "<#@expanded_name"
@attributes.each_attribute do |attr|
rv << " "
attr.write( rv, 0 )
end
if children.size > 0
rv << "> ... </>"
else
rv << "/>"
end
end
|
:call-seq:
inspect -> string
Returns a string representation of the element.
For an element with no attributes and no children, shows the element name:
REXML::Element.new.inspect # => "<UNDEFINED/>"
Shows attributes, if any:
e = REXML::Element.new('foo')
e.add_attributes({'bar' => 0, 'baz' => 1})
e.inspect # => "<foo bar='0' baz='1'/>"
Shows an ellipsis (<tt>...</tt>), if there are child elements:
e.add_element(REXML::Element.new('bar'))
e.add_element(REXML::Element.new('baz'))
e.inspect # => "<foo bar='0' baz='1'> ... </>"
|
inspect
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def clone
self.class.new self
end
|
:call-seq:
clone -> new_element
Returns a shallow copy of the element, containing the name and attributes,
but not the parent or children:
e = REXML::Element.new('foo')
e.add_attributes({'bar' => 0, 'baz' => 1})
e.clone # => <foo bar='0' baz='1'/>
|
clone
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def root_node
parent.nil? ? self : parent.root_node
end
|
:call-seq:
root_node -> document or element
Returns the most distant ancestor of +self+.
When the element is part of a document,
returns the root node of the document.
Note that the root node is different from the document element;
in this example +a+ is document element and the root node is its parent:
d = REXML::Document.new('<a><b><c/></b></a>')
top_element = d.first # => <a> ... </>
child = top_element.first # => <b> ... </>
d.root_node == d # => true
top_element.root_node == d # => true
child.root_node == d # => true
When the element is not part of a document, but does have ancestor elements,
returns the most distant ancestor element:
e0 = REXML::Element.new('foo')
e1 = REXML::Element.new('bar')
e1.parent = e0
e2 = REXML::Element.new('baz')
e2.parent = e1
e2.root_node == e0 # => true
When the element has no ancestor elements,
returns +self+:
e = REXML::Element.new('foo')
e.root_node == e # => true
Related: #root, #document.
|
root_node
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def root
return elements[1] if self.kind_of? Document
return self if parent.kind_of? Document or parent.nil?
return parent.root
end
|
:call-seq:
root -> element
Returns the most distant _element_ (not document) ancestor of the element:
d = REXML::Document.new('<a><b><c/></b></a>')
top_element = d.first
child = top_element.first
top_element.root == top_element # => true
child.root == top_element # => true
For a document, returns the topmost element:
d.root == top_element # => true
Related: #root_node, #document.
|
root
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def document
rt = root
rt.parent if rt
end
|
:call-seq:
document -> document or nil
If the element is part of a document, returns that document:
d = REXML::Document.new('<a><b><c/></b></a>')
top_element = d.first
child = top_element.first
top_element.document == d # => true
child.document == d # => true
If the element is not part of a document, returns +nil+:
REXML::Element.new.document # => nil
For a document, returns +self+:
d.document == d # => true
Related: #root, #root_node.
|
document
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def whitespace
@whitespace = nil
if @context
if @context[:respect_whitespace]
@whitespace = (@context[:respect_whitespace] == :all or
@context[:respect_whitespace].include? expanded_name)
end
@whitespace = false if (@context[:compress_whitespace] and
(@context[:compress_whitespace] == :all or
@context[:compress_whitespace].include? expanded_name)
)
end
@whitespace = true unless @whitespace == false
@whitespace
end
|
:call-seq:
whitespace
Returns +true+ if whitespace is respected for this element,
+false+ otherwise.
See {Element Context}[../doc/rexml/context_rdoc.html].
The evaluation is tested against the element's +expanded_name+,
and so is namespace-sensitive.
|
whitespace
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def ignore_whitespace_nodes
@ignore_whitespace_nodes = false
if @context
if @context[:ignore_whitespace_nodes]
@ignore_whitespace_nodes =
(@context[:ignore_whitespace_nodes] == :all or
@context[:ignore_whitespace_nodes].include? expanded_name)
end
end
end
|
:call-seq:
ignore_whitespace_nodes
Returns +true+ if whitespace nodes are ignored for the element.
See {Element Context}[../doc/rexml/context_rdoc.html].
|
ignore_whitespace_nodes
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def raw
@raw = (@context and @context[:raw] and
(@context[:raw] == :all or
@context[:raw].include? expanded_name))
@raw
end
|
:call-seq:
raw
Returns +true+ if raw mode is set for the element.
See {Element Context}[../doc/rexml/context_rdoc.html].
The evaluation is tested against +expanded_name+, and so is namespace
sensitive.
|
raw
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def prefixes
prefixes = []
prefixes = parent.prefixes if parent
prefixes |= attributes.prefixes
return prefixes
end
|
once :whitespace, :raw, :ignore_whitespace_nodes
################################################
Namespaces #
################################################
:call-seq:
prefixes -> array_of_namespace_prefixes
Returns an array of the string prefixes (names) of all defined namespaces
in the element and its ancestors:
xml_string = <<-EOT
<root>
<a xmlns:x='1' xmlns:y='2'>
<b/>
<c xmlns:z='3'/>
</a>
</root>
EOT
d = REXML::Document.new(xml_string, {compress_whitespace: :all})
d.elements['//a'].prefixes # => ["x", "y"]
d.elements['//b'].prefixes # => ["x", "y"]
d.elements['//c'].prefixes # => ["x", "y", "z"]
|
prefixes
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def namespaces
namespaces = {}
namespaces = parent.namespaces if parent
namespaces = namespaces.merge( attributes.namespaces )
return namespaces
end
|
:call-seq:
namespaces -> array_of_namespace_names
Returns a hash of all defined namespaces
in the element and its ancestors:
xml_string = <<-EOT
<root>
<a xmlns:x='1' xmlns:y='2'>
<b/>
<c xmlns:z='3'/>
</a>
</root>
EOT
d = REXML::Document.new(xml_string)
d.elements['//a'].namespaces # => {"x"=>"1", "y"=>"2"}
d.elements['//b'].namespaces # => {"x"=>"1", "y"=>"2"}
d.elements['//c'].namespaces # => {"x"=>"1", "y"=>"2", "z"=>"3"}
|
namespaces
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def namespace(prefix=nil)
if prefix.nil?
prefix = prefix()
end
if prefix == ''
prefix = "xmlns"
else
prefix = "xmlns:#{prefix}" unless prefix[0,5] == 'xmlns'
end
ns = attributes[ prefix ]
ns = parent.namespace(prefix) if ns.nil? and parent
ns = '' if ns.nil? and prefix == 'xmlns'
return ns
end
|
:call-seq:
namespace(prefix = nil) -> string_uri or nil
Returns the string namespace URI for the element,
possibly deriving from one of its ancestors.
xml_string = <<-EOT
<root>
<a xmlns='1' xmlns:y='2'>
<b/>
<c xmlns:z='3'/>
</a>
</root>
EOT
d = REXML::Document.new(xml_string)
b = d.elements['//b']
b.namespace # => "1"
b.namespace('y') # => "2"
b.namespace('nosuch') # => nil
|
namespace
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def add_namespace( prefix, uri=nil )
unless uri
@attributes["xmlns"] = prefix
else
prefix = "xmlns:#{prefix}" unless prefix =~ /^xmlns:/
@attributes[ prefix ] = uri
end
self
end
|
:call-seq:
add_namespace(prefix, uri = nil) -> self
Adds a namespace to the element; returns +self+.
With the single argument +prefix+,
adds a namespace using the given +prefix+ and the namespace URI:
e = REXML::Element.new('foo')
e.add_namespace('bar')
e.namespaces # => {"xmlns"=>"bar"}
With both arguments +prefix+ and +uri+ given,
adds a namespace using both arguments:
e.add_namespace('baz', 'bat')
e.namespaces # => {"xmlns"=>"bar", "baz"=>"bat"}
|
add_namespace
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def delete_namespace namespace="xmlns"
namespace = "xmlns:#{namespace}" unless namespace == 'xmlns'
attribute = attributes.get_attribute(namespace)
attribute.remove unless attribute.nil?
self
end
|
:call-seq:
delete_namespace(namespace = 'xmlns') -> self
Removes a namespace from the element.
With no argument, removes the default namespace:
d = REXML::Document.new "<a xmlns:foo='bar' xmlns='twiddle'/>"
d.to_s # => "<a xmlns:foo='bar' xmlns='twiddle'/>"
d.root.delete_namespace # => <a xmlns:foo='bar'/>
d.to_s # => "<a xmlns:foo='bar'/>"
With argument +namespace+, removes the specified namespace:
d.root.delete_namespace('foo')
d.to_s # => "<a/>"
Does nothing if no such namespace is found:
d.root.delete_namespace('nosuch')
d.to_s # => "<a/>"
|
delete_namespace
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def add_element element, attrs=nil
raise "First argument must be either an element name, or an Element object" if element.nil?
el = @elements.add(element)
attrs.each do |key, value|
el.attributes[key]=value
end if attrs.kind_of? Hash
el
end
|
################################################
Elements #
################################################
:call-seq:
add_element(name, attributes = nil) -> new_element
add_element(element, attributes = nil) -> element
Adds a child element, optionally setting attributes
on the added element; returns the added element.
With string argument +name+, creates a new element with that name
and adds the new element as a child:
e0 = REXML::Element.new('foo')
e0.add_element('bar')
e0[0] # => <bar/>
With argument +name+ and hash argument +attributes+,
sets attributes on the new element:
e0.add_element('baz', {'bat' => '0', 'bam' => '1'})
e0[1] # => <baz bat='0' bam='1'/>
With element argument +element+, adds that element as a child:
e0 = REXML::Element.new('foo')
e1 = REXML::Element.new('bar')
e0.add_element(e1)
e0[0] # => <bar/>
With argument +element+ and hash argument +attributes+,
sets attributes on the added element:
e0.add_element(e1, {'bat' => '0', 'bam' => '1'})
e0[1] # => <bar bat='0' bam='1'/>
|
add_element
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def delete_element element
@elements.delete element
end
|
:call-seq:
delete_element(index) -> removed_element or nil
delete_element(element) -> removed_element or nil
delete_element(xpath) -> removed_element or nil
Deletes a child element.
When 1-based integer argument +index+ is given,
removes and returns the child element at that offset if it exists;
indexing does not include text nodes;
returns +nil+ if the element does not exist:
d = REXML::Document.new '<a><b/>text<c/></a>'
a = d.root # => <a> ... </>
a.delete_element(1) # => <b/>
a.delete_element(1) # => <c/>
a.delete_element(1) # => nil
When element argument +element+ is given,
removes and returns that child element if it exists,
otherwise returns +nil+:
d = REXML::Document.new '<a><b/>text<c/></a>'
a = d.root # => <a> ... </>
c = a[2] # => <c/>
a.delete_element(c) # => <c/>
a.delete_element(c) # => nil
When xpath argument +xpath+ is given,
removes and returns the element at xpath if it exists,
otherwise returns +nil+:
d = REXML::Document.new '<a><b/>text<c/></a>'
a = d.root # => <a> ... </>
a.delete_element('//c') # => <c/>
a.delete_element('//c') # => nil
|
delete_element
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def each_element_with_attribute( key, value=nil, max=0, name=nil, &block ) # :yields: Element
each_with_something( proc {|child|
if value.nil?
child.attributes[key] != nil
else
child.attributes[key]==value
end
}, max, name, &block )
end
|
:call-seq:
each_element_with_attribute(attr_name, value = nil, max = 0, xpath = nil) {|e| ... }
Calls the given block with each child element that meets given criteria.
When only string argument +attr_name+ is given,
calls the block with each child element that has that attribute:
d = REXML::Document.new '<a><b id="1"/><c id="2"/><d id="1"/><e/></a>'
a = d.root
a.each_element_with_attribute('id') {|e| p e }
Output:
<b id='1'/>
<c id='2'/>
<d id='1'/>
With argument +attr_name+ and string argument +value+ given,
calls the block with each child element that has that attribute
with that value:
a.each_element_with_attribute('id', '1') {|e| p e }
Output:
<b id='1'/>
<d id='1'/>
With arguments +attr_name+, +value+, and integer argument +max+ given,
calls the block with at most +max+ child elements:
a.each_element_with_attribute('id', '1', 1) {|e| p e }
Output:
<b id='1'/>
With all arguments given, including +xpath+,
calls the block with only those child elements
that meet the first three criteria,
and also match the given +xpath+:
a.each_element_with_attribute('id', '1', 2, '//d') {|e| p e }
Output:
<d id='1'/>
|
each_element_with_attribute
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def each_element_with_text( text=nil, max=0, name=nil, &block ) # :yields: Element
each_with_something( proc {|child|
if text.nil?
child.has_text?
else
child.text == text
end
}, max, name, &block )
end
|
:call-seq:
each_element_with_text(text = nil, max = 0, xpath = nil) {|e| ... }
Calls the given block with each child element that meets given criteria.
With no arguments, calls the block with each child element that has text:
d = REXML::Document.new '<a><b>b</b><c>b</c><d>d</d><e/></a>'
a = d.root
a.each_element_with_text {|e| p e }
Output:
<b> ... </>
<c> ... </>
<d> ... </>
With the single string argument +text+,
calls the block with each element that has exactly that text:
a.each_element_with_text('b') {|e| p e }
Output:
<b> ... </>
<c> ... </>
With argument +text+ and integer argument +max+,
calls the block with at most +max+ elements:
a.each_element_with_text('b', 1) {|e| p e }
Output:
<b> ... </>
With all arguments given, including +xpath+,
calls the block with only those child elements
that meet the first two criteria,
and also match the given +xpath+:
a.each_element_with_text('b', 2, '//c') {|e| p e }
Output:
<c> ... </>
|
each_element_with_text
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def each_element( xpath=nil, &block ) # :yields: Element
@elements.each( xpath, &block )
end
|
:call-seq:
each_element {|e| ... }
Calls the given block with each child element:
d = REXML::Document.new '<a><b>b</b><c>b</c><d>d</d><e/></a>'
a = d.root
a.each_element {|e| p e }
Output:
<b> ... </>
<c> ... </>
<d> ... </>
<e/>
|
each_element
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def get_elements( xpath )
@elements.to_a( xpath )
end
|
:call-seq:
get_elements(xpath)
Returns an array of the elements that match the given +xpath+:
xml_string = <<-EOT
<root>
<a level='1'>
<a level='2'/>
</a>
</root>
EOT
d = REXML::Document.new(xml_string)
d.root.get_elements('//a') # => [<a level='1'> ... </>, <a level='2'/>]
|
get_elements
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def next_element
element = next_sibling
element = element.next_sibling until element.nil? or element.kind_of? Element
return element
end
|
:call-seq:
next_element
Returns the next sibling that is an element if it exists,
+niL+ otherwise:
d = REXML::Document.new '<a><b/>text<c/></a>'
d.root.elements['b'].next_element #-> <c/>
d.root.elements['c'].next_element #-> nil
|
next_element
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def previous_element
element = previous_sibling
element = element.previous_sibling until element.nil? or element.kind_of? Element
return element
end
|
:call-seq:
previous_element
Returns the previous sibling that is an element if it exists,
+niL+ otherwise:
d = REXML::Document.new '<a><b/>text<c/></a>'
d.root.elements['c'].previous_element #-> <b/>
d.root.elements['b'].previous_element #-> nil
|
previous_element
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def has_text?
not text().nil?
end
|
################################################
Text #
################################################
:call-seq:
has_text? -> true or false
Returns +true if the element has one or more text noded,
+false+ otherwise:
d = REXML::Document.new '<a><b/>text<c/></a>'
a = d.root
a.has_text? # => true
b = a[0]
b.has_text? # => false
|
has_text?
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def text( path = nil )
rv = get_text(path)
return rv.value unless rv.nil?
nil
end
|
:call-seq:
text(xpath = nil) -> text_string or nil
Returns the text string from the first text node child
in a specified element, if it exists, # +nil+ otherwise.
With no argument, returns the text from the first text node in +self+:
d = REXML::Document.new "<p>some text <b>this is bold!</b> more text</p>"
d.root.text.class # => String
d.root.text # => "some text "
With argument +xpath+, returns text from the the first text node
in the element that matches +xpath+:
d.root.text(1) # => "this is bold!"
Note that an element may have multiple text nodes,
possibly separated by other non-text children, as above.
Even so, the returned value is the string text from the first such node.
Note also that the text note is retrieved by method get_text,
and so is always normalized text.
|
text
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def get_text path = nil
rv = nil
if path
element = @elements[ path ]
rv = element.get_text unless element.nil?
else
rv = @children.find { |node| node.kind_of? Text }
end
return rv
end
|
:call-seq:
get_text(xpath = nil) -> text_node or nil
Returns the first text node child in a specified element, if it exists,
+nil+ otherwise.
With no argument, returns the first text node from +self+:
d = REXML::Document.new "<p>some text <b>this is bold!</b> more text</p>"
d.root.get_text.class # => REXML::Text
d.root.get_text # => "some text "
With argument +xpath+, returns the first text node from the element
that matches +xpath+:
d.root.get_text(1) # => "this is bold!"
|
get_text
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def add_text( text )
if text.kind_of? String
if @children[-1].kind_of? Text
@children[-1] << text
return
end
text = Text.new( text, whitespace(), nil, raw() )
end
self << text unless text.nil?
return self
end
|
:call-seq:
add_text(string) -> nil
add_text(text_node) -> self
Adds text to the element.
When string argument +string+ is given, returns +nil+.
If the element has no child text node,
creates a \REXML::Text object using the string,
honoring the current settings for whitespace and raw,
then adds that node to the element:
d = REXML::Document.new('<a><b/></a>')
a = d.root
a.add_text('foo')
a.to_a # => [<b/>, "foo"]
If the element has child text nodes,
appends the string to the _last_ text node:
d = REXML::Document.new('<a>foo<b/>bar</a>')
a = d.root
a.add_text('baz')
a.to_a # => ["foo", <b/>, "barbaz"]
a.add_text('baz')
a.to_a # => ["foo", <b/>, "barbazbaz"]
When text node argument +text_node+ is given,
appends the node as the last text node in the element;
returns +self+:
d = REXML::Document.new('<a>foo<b/>bar</a>')
a = d.root
a.add_text(REXML::Text.new('baz'))
a.to_a # => ["foo", <b/>, "bar", "baz"]
a.add_text(REXML::Text.new('baz'))
a.to_a # => ["foo", <b/>, "bar", "baz", "baz"]
|
add_text
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def xpath
path_elements = []
cur = self
path_elements << __to_xpath_helper( self )
while cur.parent
cur = cur.parent
path_elements << __to_xpath_helper( cur )
end
return path_elements.reverse.join( "/" )
end
|
:call-seq:
xpath -> string_xpath
Returns the string xpath to the element
relative to the most distant parent:
d = REXML::Document.new('<a><b><c/></b></a>')
a = d.root # => <a> ... </>
b = a[0] # => <b> ... </>
c = b[0] # => <c/>
d.xpath # => ""
a.xpath # => "/a"
b.xpath # => "/a/b"
c.xpath # => "/a/b/c"
If there is no parent, returns the expanded name of the element:
e = REXML::Element.new('foo')
e.xpath # => "foo"
|
xpath
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def attribute( name, namespace=nil )
prefix = nil
if namespaces.respond_to? :key
prefix = namespaces.key(namespace) if namespace
else
prefix = namespaces.index(namespace) if namespace
end
prefix = nil if prefix == 'xmlns'
ret_val =
attributes.get_attribute( "#{prefix ? prefix + ':' : ''}#{name}" )
return ret_val unless ret_val.nil?
return nil if prefix.nil?
# now check that prefix'es namespace is not the same as the
# default namespace
return nil unless ( namespaces[ prefix ] == namespaces[ 'xmlns' ] )
attributes.get_attribute( name )
end
|
:call-seq:
attribute(name, namespace = nil)
Returns the string value for the given attribute name.
With only argument +name+ given,
returns the value of the named attribute if it exists, otherwise +nil+:
xml_string = <<-EOT
<root xmlns="ns0">
<a xmlns="ns1" attr="value"></a>
<b xmlns="ns2" attr="value"></b>
<c attr="value"/>
</root>
EOT
d = REXML::Document.new(xml_string)
root = d.root
a = root[1] # => <a xmlns='ns1' attr='value'/>
a.attribute('attr') # => attr='value'
a.attribute('nope') # => nil
With arguments +name+ and +namespace+ given,
returns the value of the named attribute if it exists, otherwise +nil+:
xml_string = "<root xmlns:a='a' a:x='a:x' x='x'/>"
document = REXML::Document.new(xml_string)
document.root.attribute("x") # => x='x'
document.root.attribute("x", "a") # => a:x='a:x'
|
attribute
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def has_attributes?
return [email protected]?
end
|
:call-seq:
has_attributes? -> true or false
Returns +true+ if the element has attributes, +false+ otherwise:
d = REXML::Document.new('<root><a attr="val"/><b/></root>')
a, b = *d.root
a.has_attributes? # => true
b.has_attributes? # => false
|
has_attributes?
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def add_attribute( key, value=nil )
if key.kind_of? Attribute
@attributes << key
else
@attributes[key] = value
end
end
|
:call-seq:
add_attribute(name, value) -> value
add_attribute(attribute) -> attribute
Adds an attribute to this element, overwriting any existing attribute
by the same name.
With string argument +name+ and object +value+ are given,
adds the attribute created with that name and value:
e = REXML::Element.new
e.add_attribute('attr', 'value') # => "value"
e['attr'] # => "value"
e.add_attribute('attr', 'VALUE') # => "VALUE"
e['attr'] # => "VALUE"
With only attribute object +attribute+ given,
adds the given attribute:
a = REXML::Attribute.new('attr', 'value')
e.add_attribute(a) # => attr='value'
e['attr'] # => "value"
a = REXML::Attribute.new('attr', 'VALUE')
e.add_attribute(a) # => attr='VALUE'
e['attr'] # => "VALUE"
|
add_attribute
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def add_attributes hash
if hash.kind_of? Hash
hash.each_pair {|key, value| @attributes[key] = value }
elsif hash.kind_of? Array
hash.each { |value| @attributes[ value[0] ] = value[1] }
end
end
|
:call-seq:
add_attributes(hash) -> hash
add_attributes(array)
Adds zero or more attributes to the element;
returns the argument.
If hash argument +hash+ is given,
each key must be a string;
adds each attribute created with the key/value pair:
e = REXML::Element.new
h = {'foo' => 'bar', 'baz' => 'bat'}
e.add_attributes(h)
If argument +array+ is given,
each array member must be a 2-element array <tt>[name, value];
each name must be a string:
e = REXML::Element.new
a = [['foo' => 'bar'], ['baz' => 'bat']]
e.add_attributes(a)
|
add_attributes
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def delete_attribute(key)
attr = @attributes.get_attribute(key)
attr.remove unless attr.nil?
end
|
:call-seq:
delete_attribute(name) -> removed_attribute or nil
Removes a named attribute if it exists;
returns the removed attribute if found, otherwise +nil+:
e = REXML::Element.new('foo')
e.add_attribute('bar', 'baz')
e.delete_attribute('bar') # => <bar/>
e.delete_attribute('bar') # => nil
|
delete_attribute
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def cdatas
find_all { |child| child.kind_of? CData }.freeze
end
|
################################################
Other Utilities #
################################################
:call-seq:
cdatas -> array_of_cdata_children
Returns a frozen array of the REXML::CData children of the element:
xml_string = <<-EOT
<root>
<![CDATA[foo]]>
<![CDATA[bar]]>
</root>
EOT
d = REXML::Document.new(xml_string)
cds = d.root.cdatas # => ["foo", "bar"]
cds.frozen? # => true
cds.map {|cd| cd.class } # => [REXML::CData, REXML::CData]
|
cdatas
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def comments
find_all { |child| child.kind_of? Comment }.freeze
end
|
:call-seq:
comments -> array_of_comment_children
Returns a frozen array of the REXML::Comment children of the element:
xml_string = <<-EOT
<root>
<!--foo-->
<!--bar-->
</root>
EOT
d = REXML::Document.new(xml_string)
cs = d.root.comments
cs.frozen? # => true
cs.map {|c| c.class } # => [REXML::Comment, REXML::Comment]
cs.map {|c| c.to_s } # => ["foo", "bar"]
|
comments
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def instructions
find_all { |child| child.kind_of? Instruction }.freeze
end
|
:call-seq:
instructions -> array_of_instruction_children
Returns a frozen array of the REXML::Instruction children of the element:
xml_string = <<-EOT
<root>
<?target0 foo?>
<?target1 bar?>
</root>
EOT
d = REXML::Document.new(xml_string)
is = d.root.instructions
is.frozen? # => true
is.map {|i| i.class } # => [REXML::Instruction, REXML::Instruction]
is.map {|i| i.to_s } # => ["<?target0 foo?>", "<?target1 bar?>"]
|
instructions
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def texts
find_all { |child| child.kind_of? Text }.freeze
end
|
:call-seq:
texts -> array_of_text_children
Returns a frozen array of the REXML::Text children of the element:
xml_string = '<root><a/>text<b/>more<c/></root>'
d = REXML::Document.new(xml_string)
ts = d.root.texts
ts.frozen? # => true
ts.map {|t| t.class } # => [REXML::Text, REXML::Text]
ts.map {|t| t.to_s } # => ["text", "more"]
|
texts
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def initialize parent
@element = parent
end
|
:call-seq:
new(parent) -> new_elements_object
Returns a new \Elements object with the given +parent+.
Does _not_ assign <tt>parent.elements = self</tt>:
d = REXML::Document.new(xml_string)
eles = REXML::Elements.new(d.root)
eles # => #<REXML::Elements @element=<bookstore> ... </>>
eles == d.root.elements # => false
|
initialize
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def empty?
@element.find{ |child| child.kind_of? Element}.nil?
end
|
:call-seq:
empty? -> true or false
Returns +true+ if there are no children, +false+ otherwise.
d = REXML::Document.new('')
d.elements.empty? # => true
d = REXML::Document.new(xml_string)
d.elements.empty? # => false
|
empty?
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def index element
rv = 0
found = @element.find do |child|
child.kind_of? Element and
(rv += 1) and
child == element
end
return rv if found == element
return -1
end
|
:call-seq:
index(element)
Returns the 1-based index of the given +element+, if found;
otherwise, returns -1:
d = REXML::Document.new(xml_string)
elements = d.root.elements
ele_1, ele_2, ele_3, ele_4 = *elements
elements.index(ele_4) # => 4
elements.delete(ele_3)
elements.index(ele_4) # => 3
elements.index(ele_3) # => -1
|
index
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def delete element
if element.kind_of? Element
@element.delete element
else
el = self[element]
el.remove if el
end
end
|
:call-seq:
delete(index) -> removed_element or nil
delete(element) -> removed_element or nil
delete(xpath) -> removed_element or nil
Removes an element; returns the removed element, or +nil+ if none removed.
With integer argument +index+ given,
removes the child element at that offset:
d = REXML::Document.new(xml_string)
elements = d.root.elements
elements.size # => 4
elements[2] # => <book category='children'> ... </>
elements.delete(2) # => <book category='children'> ... </>
elements.size # => 3
elements[2] # => <book category='web'> ... </>
elements.delete(50) # => nil
With element argument +element+ given,
removes that child element:
d = REXML::Document.new(xml_string)
elements = d.root.elements
ele_1, ele_2, ele_3, ele_4 = *elements
elements.size # => 4
elements[2] # => <book category='children'> ... </>
elements.delete(ele_2) # => <book category='children'> ... </>
elements.size # => 3
elements[2] # => <book category='web'> ... </>
elements.delete(ele_2) # => nil
With string argument +xpath+ given,
removes the first element found via that xpath:
d = REXML::Document.new(xml_string)
elements = d.root.elements
elements.delete('//book') # => <book category='cooking'> ... </>
elements.delete('//book [@category="children"]') # => <book category='children'> ... </>
elements.delete('//nosuch') # => nil
|
delete
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def delete_all( xpath )
rv = []
XPath::each( @element, xpath) {|element|
rv << element if element.kind_of? Element
}
rv.each do |element|
@element.delete element
element.remove
end
return rv
end
|
:call-seq:
delete_all(xpath)
Removes all elements found via the given +xpath+;
returns the array of removed elements, if any, else +nil+.
d = REXML::Document.new(xml_string)
elements = d.root.elements
elements.size # => 4
deleted_elements = elements.delete_all('//book [@category="web"]')
deleted_elements.size # => 2
elements.size # => 2
deleted_elements = elements.delete_all('//book')
deleted_elements.size # => 2
elements.size # => 0
elements.delete_all('//book') # => []
|
delete_all
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def add element=nil
if element.nil?
Element.new("", self, @element.context)
elsif not element.kind_of?(Element)
Element.new(element, self, @element.context)
else
@element << element
element.context = @element.context
element
end
end
|
:call-seq:
add -> new_element
add(name) -> new_element
add(element) -> element
Adds an element; returns the element added.
With no argument, creates and adds a new element.
The new element has:
- No name.
- \Parent from the \Elements object.
- Context from the that parent.
Example:
d = REXML::Document.new(xml_string)
elements = d.root.elements
parent = elements.parent # => <bookstore> ... </>
parent.context = {raw: :all}
elements.size # => 4
new_element = elements.add # => </>
elements.size # => 5
new_element.name # => nil
new_element.parent # => <bookstore> ... </>
new_element.context # => {:raw=>:all}
With string argument +name+, creates and adds a new element.
The new element has:
- Name +name+.
- \Parent from the \Elements object.
- Context from the that parent.
Example:
d = REXML::Document.new(xml_string)
elements = d.root.elements
parent = elements.parent # => <bookstore> ... </>
parent.context = {raw: :all}
elements.size # => 4
new_element = elements.add('foo') # => <foo/>
elements.size # => 5
new_element.name # => "foo"
new_element.parent # => <bookstore> ... </>
new_element.context # => {:raw=>:all}
With argument +element+,
creates and adds a clone of the given +element+.
The new element has name, parent, and context from the given +element+.
d = REXML::Document.new(xml_string)
elements = d.root.elements
elements.size # => 4
e0 = REXML::Element.new('foo')
e1 = REXML::Element.new('bar', e0, {raw: :all})
element = elements.add(e1) # => <bar/>
elements.size # => 5
element.name # => "bar"
element.parent # => <bookstore> ... </>
element.context # => {:raw=>:all}
|
add
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def each( xpath=nil )
XPath::each( @element, xpath ) {|e| yield e if e.kind_of? Element }
end
|
:call-seq:
each(xpath = nil) {|element| ... } -> self
Iterates over the elements.
With no argument, calls the block with each element:
d = REXML::Document.new(xml_string)
elements = d.root.elements
elements.each {|element| p element }
Output:
<book category='cooking'> ... </>
<book category='children'> ... </>
<book category='web'> ... </>
<book category='web' cover='paperback'> ... </>
With argument +xpath+, calls the block with each element
that matches the given +xpath+:
elements.each('//book [@category="web"]') {|element| p element }
Output:
<book category='web'> ... </>
<book category='web' cover='paperback'> ... </>
|
each
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def collect( xpath=nil )
collection = []
XPath::each( @element, xpath ) {|e|
collection << yield(e) if e.kind_of?(Element)
}
collection
end
|
:call-seq:
collect(xpath = nil) {|element| ... } -> array
Iterates over the elements; returns the array of block return values.
With no argument, iterates over all elements:
d = REXML::Document.new(xml_string)
elements = d.root.elements
elements.collect {|element| element.size } # => [9, 9, 17, 9]
With argument +xpath+, iterates over elements that match
the given +xpath+:
xpath = '//book [@category="web"]'
elements.collect(xpath) {|element| element.size } # => [17, 9]
|
collect
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def inject( xpath=nil, initial=nil )
first = true
XPath::each( @element, xpath ) {|e|
if (e.kind_of? Element)
if (first and initial == nil)
initial = e
first = false
else
initial = yield( initial, e ) if e.kind_of? Element
end
end
}
initial
end
|
:call-seq:
inject(xpath = nil, initial = nil) -> object
Calls the block with elements; returns the last block return value.
With no argument, iterates over the elements, calling the block
<tt>elements.size - 1</tt> times.
- The first call passes the first and second elements.
- The second call passes the first block return value and the third element.
- The third call passes the second block return value and the fourth element.
- And so on.
In this example, the block returns the passed element,
which is then the object argument to the next call:
d = REXML::Document.new(xml_string)
elements = d.root.elements
elements.inject do |object, element|
p [elements.index(object), elements.index(element)]
element
end
Output:
[1, 2]
[2, 3]
[3, 4]
With the single argument +xpath+, calls the block only with
elements matching that xpath:
elements.inject('//book [@category="web"]') do |object, element|
p [elements.index(object), elements.index(element)]
element
end
Output:
[3, 4]
With argument +xpath+ given as +nil+
and argument +initial+ also given,
calls the block once for each element.
- The first call passes the +initial+ and the first element.
- The second call passes the first block return value and the second element.
- The third call passes the second block return value and the third element.
- And so on.
In this example, the first object index is <tt>-1</tt>
elements.inject(nil, 'Initial') do |object, element|
p [elements.index(object), elements.index(element)]
element
end
Output:
[-1, 1]
[1, 2]
[2, 3]
[3, 4]
In this form the passed object can be used as an accumulator:
elements.inject(nil, 0) do |total, element|
total += element.size
end # => 44
With both arguments +xpath+ and +initial+ are given,
calls the block only with elements matching that xpath:
elements.inject('//book [@category="web"]', 0) do |total, element|
total += element.size
end # => 26
|
inject
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def size
count = 0
@element.each {|child| count+=1 if child.kind_of? Element }
count
end
|
:call-seq:
size -> integer
Returns the count of \Element children:
d = REXML::Document.new '<a>sean<b/>elliott<b/>russell<b/></a>'
d.root.elements.size # => 3 # Three elements.
d.root.size # => 6 # Three elements plus three text nodes..
|
size
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def literalize name
name = name[1..-2] if name[0] == ?' or name[0] == ?" #'
name
end
|
Private helper class. Removes quotes from quoted strings
|
literalize
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def initialize element
@element = element
end
|
:call-seq:
new(element)
Creates and returns a new \REXML::Attributes object.
The element given by argument +element+ is stored,
but its own attributes are not modified:
ele = REXML::Element.new('foo')
attrs = REXML::Attributes.new(ele)
attrs.object_id == ele.attributes.object_id # => false
Other instance methods in class \REXML::Attributes may refer to:
- +element.document+.
- +element.prefix+.
- +element.expanded_name+.
|
initialize
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def length
c = 0
each_attribute { c+=1 }
c
end
|
:call-seq:
length
Returns the count of attributes:
xml_string = <<-EOT
<root xmlns:foo="http://foo" xmlns:bar="http://bar">
<ele foo:att='1' bar:att='2' att='<'/>
</root>
EOT
d = REXML::Document.new(xml_string)
ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='<'/>
ele.attributes.length # => 3
|
length
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def each_attribute # :yields: attribute
return to_enum(__method__) unless block_given?
each_value do |val|
if val.kind_of? Attribute
yield val
else
val.each_value { |atr| yield atr }
end
end
end
|
:call-seq:
each_attribute {|attr| ... }
Calls the given block with each \REXML::Attribute object:
xml_string = <<-EOT
<root xmlns:foo="http://foo" xmlns:bar="http://bar">
<ele foo:att='1' bar:att='2' att='<'/>
</root>
EOT
d = REXML::Document.new(xml_string)
ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='<'/>
ele.attributes.each_attribute do |attr|
p [attr.class, attr]
end
Output:
[REXML::Attribute, foo:att='1']
[REXML::Attribute, bar:att='2']
[REXML::Attribute, att='<']
|
each_attribute
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def each
return to_enum(__method__) unless block_given?
each_attribute do |attr|
yield [attr.expanded_name, attr.value]
end
end
|
:call-seq:
each {|expanded_name, value| ... }
Calls the given block with each expanded-name/value pair:
xml_string = <<-EOT
<root xmlns:foo="http://foo" xmlns:bar="http://bar">
<ele foo:att='1' bar:att='2' att='<'/>
</root>
EOT
d = REXML::Document.new(xml_string)
ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='<'/>
ele.attributes.each do |expanded_name, value|
p [expanded_name, value]
end
Output:
["foo:att", "1"]
["bar:att", "2"]
["att", "<"]
|
each
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def get_attribute( name )
attr = fetch( name, nil )
if attr.nil?
return nil if name.nil?
# Look for prefix
name =~ Namespace::NAMESPLIT
prefix, n = $1, $2
if prefix
attr = fetch( n, nil )
# check prefix
if attr == nil
elsif attr.kind_of? Attribute
return attr if prefix == attr.prefix
else
attr = attr[ prefix ]
return attr
end
end
element_document = @element.document
if element_document and element_document.doctype
expn = @element.expanded_name
expn = element_document.doctype.name if expn.size == 0
attr_val = element_document.doctype.attribute_of(expn, name)
return Attribute.new( name, attr_val ) if attr_val
end
return nil
end
if attr.kind_of? Hash
attr = attr[ @element.prefix ]
end
return attr
end
|
:call-seq:
get_attribute(name) -> attribute_object or nil
Returns the \REXML::Attribute object for the given +name+:
xml_string = <<-EOT
<root xmlns:foo="http://foo" xmlns:bar="http://bar">
<ele foo:att='1' bar:att='2' att='<'/>
</root>
EOT
d = REXML::Document.new(xml_string)
ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='<'/>
attrs = ele.attributes
attrs.get_attribute('foo:att') # => foo:att='1'
attrs.get_attribute('foo:att').class # => REXML::Attribute
attrs.get_attribute('bar:att') # => bar:att='2'
attrs.get_attribute('att') # => att='<'
attrs.get_attribute('nosuch') # => nil
|
get_attribute
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def prefixes
ns = []
each_attribute do |attribute|
ns << attribute.name if attribute.prefix == 'xmlns'
end
if @element.document and @element.document.doctype
expn = @element.expanded_name
expn = @element.document.doctype.name if expn.size == 0
@element.document.doctype.attributes_of(expn).each {
|attribute|
ns << attribute.name if attribute.prefix == 'xmlns'
}
end
ns
end
|
:call-seq:
prefixes -> array_of_prefix_strings
Returns an array of prefix strings in the attributes.
The array does not include the default
namespace declaration, if one exists.
xml_string = '<a xmlns="foo" xmlns:x="bar" xmlns:y="twee" z="glorp"/>'
d = REXML::Document.new(xml_string)
d.root.attributes.prefixes # => ["x", "y"]
|
prefixes
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def namespaces
namespaces = {}
each_attribute do |attribute|
namespaces[attribute.name] = attribute.value if attribute.prefix == 'xmlns' or attribute.name == 'xmlns'
end
if @element.document and @element.document.doctype
expn = @element.expanded_name
expn = @element.document.doctype.name if expn.size == 0
@element.document.doctype.attributes_of(expn).each {
|attribute|
namespaces[attribute.name] = attribute.value if attribute.prefix == 'xmlns' or attribute.name == 'xmlns'
}
end
namespaces
end
|
:call-seq:
namespaces
Returns a hash of name/value pairs for the namespaces:
xml_string = '<a xmlns="foo" xmlns:x="bar" xmlns:y="twee" z="glorp"/>'
d = REXML::Document.new(xml_string)
d.root.attributes.namespaces # => {"xmlns"=>"foo", "x"=>"bar", "y"=>"twee"}
|
namespaces
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def delete( attribute )
name = nil
prefix = nil
if attribute.kind_of? Attribute
name = attribute.name
prefix = attribute.prefix
else
attribute =~ Namespace::NAMESPLIT
prefix, name = $1, $2
prefix = '' unless prefix
end
old = fetch(name, nil)
if old.kind_of? Hash # the supplied attribute is one of many
old.delete(prefix)
if old.size == 1
repl = nil
old.each_value{|v| repl = v}
store name, repl
end
elsif old.nil?
return @element
else # the supplied attribute is a top-level one
super(name)
end
@element
end
|
:call-seq:
delete(name) -> element
delete(attribute) -> element
Removes a specified attribute if it exists;
returns the attributes' element.
When string argument +name+ is given,
removes the attribute of that name if it exists:
xml_string = <<-EOT
<root xmlns:foo="http://foo" xmlns:bar="http://bar">
<ele foo:att='1' bar:att='2' att='<'/>
</root>
EOT
d = REXML::Document.new(xml_string)
ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='<'/>
attrs = ele.attributes
attrs.delete('foo:att') # => <ele bar:att='2' att='<'/>
attrs.delete('foo:att') # => <ele bar:att='2' att='<'/>
When attribute argument +attribute+ is given,
removes that attribute if it exists:
attr = REXML::Attribute.new('bar:att', '2')
attrs.delete(attr) # => <ele att='<'/> # => <ele att='<'/>
attrs.delete(attr) # => <ele att='<'/> # => <ele/>
|
delete
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def add( attribute )
self[attribute.name] = attribute
end
|
:call-seq:
add(attribute) -> attribute
Adds attribute +attribute+, replacing the previous
attribute of the same name if it exists;
returns +attribute+:
xml_string = <<-EOT
<root xmlns:foo="http://foo" xmlns:bar="http://bar">
<ele foo:att='1' bar:att='2' att='<'/>
</root>
EOT
d = REXML::Document.new(xml_string)
ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='<'/>
attrs = ele.attributes
attrs # => {"att"=>{"foo"=>foo:att='1', "bar"=>bar:att='2', ""=>att='<'}}
attrs.add(REXML::Attribute.new('foo:att', '2')) # => foo:att='2'
attrs.add(REXML::Attribute.new('baz', '3')) # => baz='3'
attrs.include?('baz') # => true
|
add
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def delete_all( name )
rv = []
each_attribute { |attribute|
rv << attribute if attribute.expanded_name == name
}
rv.each{ |attr| attr.remove }
return rv
end
|
:call-seq:
delete_all(name) -> array_of_removed_attributes
Removes all attributes matching the given +name+;
returns an array of the removed attributes:
xml_string = <<-EOT
<root xmlns:foo="http://foo" xmlns:bar="http://bar">
<ele foo:att='1' bar:att='2' att='<'/>
</root>
EOT
d = REXML::Document.new(xml_string)
ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='<'/>
attrs = ele.attributes
attrs.delete_all('att') # => [att='<']
|
delete_all
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def get_attribute_ns(namespace, name)
result = nil
each_attribute() { |attribute|
if name == attribute.name &&
namespace == attribute.namespace() &&
( !namespace.empty? || !attribute.fully_expanded_name.index(':') )
# foo will match xmlns:foo, but only if foo isn't also an attribute
result = attribute if !result or !namespace.empty? or
!attribute.fully_expanded_name.index(':')
end
}
result
end
|
:call-seq:
get_attribute_ns(namespace, name)
Returns the \REXML::Attribute object among the attributes
that matches the given +namespace+ and +name+:
xml_string = <<-EOT
<root xmlns:foo="http://foo" xmlns:bar="http://bar">
<ele foo:att='1' bar:att='2' att='<'/>
</root>
EOT
d = REXML::Document.new(xml_string)
ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='<'/>
attrs = ele.attributes
attrs.get_attribute_ns('http://foo', 'att') # => foo:att='1'
attrs.get_attribute_ns('http://foo', 'nosuch') # => nil
|
get_attribute_ns
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/element.rb
|
Apache-2.0
|
def initialize stream, value=nil, parent=nil, reference=false
super(parent)
@ndata = @pubid = @value = @external = nil
if stream.kind_of? Array
@name = stream[1]
if stream[-1] == '%'
@reference = true
stream.pop
else
@reference = false
end
if stream[2] =~ /SYSTEM|PUBLIC/
@external = stream[2]
if @external == 'SYSTEM'
@ref = stream[3]
@ndata = stream[4] if stream.size == 5
else
@pubid = stream[3]
@ref = stream[4]
end
else
@value = stream[2]
end
else
@reference = reference
@external = nil
@name = stream
@value = value
end
end
|
Create a new entity. Simple entities can be constructed by passing a
name, value to the constructor; this creates a generic, plain entity
reference. For anything more complicated, you have to pass a Source to
the constructor with the entity definition, or use the accessor methods.
+WARNING+: There is no validation of entity state except when the entity
is read from a stream. If you start poking around with the accessors,
you can easily create a non-conformant Entity.
e = Entity.new( 'amp', '&' )
|
initialize
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/entity.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/entity.rb
|
Apache-2.0
|
def unnormalized
document.record_entity_expansion unless document.nil?
v = value()
return nil if v.nil?
@unnormalized = Text::unnormalize(v, parent)
@unnormalized
end
|
Evaluates to the unnormalized value of this entity; that is, replacing
all entities -- both %ent; and &ent; entities. This differs from
+value()+ in that +value+ only replaces %ent; entities.
|
unnormalized
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/entity.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/entity.rb
|
Apache-2.0
|
def write out, indent=-1
out << '<!ENTITY '
out << '% ' if @reference
out << @name
out << ' '
if @external
out << @external << ' '
if @pubid
q = @pubid.include?('"')?"'":'"'
out << q << @pubid << q << ' '
end
q = @ref.include?('"')?"'":'"'
out << q << @ref << q
out << ' NDATA ' << @ndata if @ndata
else
q = @value.include?('"')?"'":'"'
out << q << @value << q
end
out << '>'
end
|
Write out a fully formed, correct entity definition (assuming the Entity
object itself is valid.)
out::
An object implementing <TT><<</TT> to which the entity will be
output
indent::
*DEPRECATED* and ignored
|
write
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/entity.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/entity.rb
|
Apache-2.0
|
def to_s
rv = ''
write rv
rv
end
|
Returns this entity as a string. See write().
|
to_s
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/entity.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/entity.rb
|
Apache-2.0
|
def value
if @value
matches = @value.scan(PEREFERENCE_RE)
rv = @value.clone
if @parent
sum = 0
matches.each do |entity_reference|
entity_value = @parent.entity( entity_reference[0] )
if sum + entity_value.bytesize > Security.entity_expansion_text_limit
raise "entity expansion has grown too large"
else
sum += entity_value.bytesize
end
rv.gsub!( /%#{entity_reference.join};/um, entity_value )
end
end
return rv
end
nil
end
|
Returns the value of this entity. At the moment, only internal entities
are processed. If the value contains internal references (IE,
%blah;), those are replaced with their values. IE, if the doctype
contains:
<!ENTITY % foo "bar">
<!ENTITY yada "nanoo %foo; nanoo>
then:
doctype.entity('yada').value #-> "nanoo bar nanoo"
|
value
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/entity.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/entity.rb
|
Apache-2.0
|
def initialize(target, content=nil)
case target
when String
super()
@target = target
@content = content
when Instruction
super(content)
@target = target.target
@content = target.content
else
message =
"processing instruction target must be String or REXML::Instruction: "
message << "<#{target.inspect}>"
raise ArgumentError, message
end
@content.strip! if @content
end
|
Constructs a new Instruction
@param target can be one of a number of things. If String, then
the target of this instruction is set to this. If an Instruction,
then the Instruction is shallowly cloned (target and content are
copied).
@param content Must be either a String, or a Parent. Can only
be a Parent if the target argument is a Source. Otherwise, this
String is set as the content of this instruction.
|
initialize
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/instruction.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/instruction.rb
|
Apache-2.0
|
def write writer, indent=-1, transitive=false, ie_hack=false
Kernel.warn( "#{self.class.name}.write is deprecated", uplevel: 1)
indent(writer, indent)
writer << START
writer << @target
if @content
writer << ' '
writer << @content
end
writer << STOP
end
|
== DEPRECATED
See the rexml/formatters package
|
write
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/instruction.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/instruction.rb
|
Apache-2.0
|
def fully_expanded_name
ns = prefix
return "#{ns}:#@name" if ns.size > 0
return @name
end
|
Fully expand the name, even if the prefix wasn't specified in the
source file.
|
fully_expanded_name
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/namespace.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/namespace.rb
|
Apache-2.0
|
def next_sibling_node
return nil if @parent.nil?
@parent[ @parent.index(self) + 1 ]
end
|
@return the next sibling (nil if unset)
|
next_sibling_node
|
ruby
|
collabnix/kubelabs
|
.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/node.rb
|
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/rexml-3.2.5/lib/rexml/node.rb
|
Apache-2.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.