Class: XMLUtils::XMLSParserElement

Inherits:
Object
  • Object
show all
Defined in:
lib/stream_parser.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, elstart, parser, parent) ⇒ XMLSParserElement

Returns a new instance of XMLSParserElement.



36
37
38
39
40
41
42
43
# File 'lib/stream_parser.rb', line 36

def initialize(name, elstart, parser, parent)
  @name = name
  @parser = parser
  @elstart = elstart
  @element_id = parser.new_element_id
  @parent = parent
  @parent_id = parent.element_id if parent
end

Instance Attribute Details

#element_idObject (readonly)

Returns the value of attribute element_id.



32
33
34
# File 'lib/stream_parser.rb', line 32

def element_id
  @element_id
end

#elstartObject (readonly)

Returns the value of attribute elstart.



34
35
36
# File 'lib/stream_parser.rb', line 34

def elstart
  @elstart
end

#nameObject (readonly)

Returns the value of attribute name.



31
32
33
# File 'lib/stream_parser.rb', line 31

def name
  @name
end

#parentObject (readonly)

Returns the value of attribute parent.



33
34
35
# File 'lib/stream_parser.rb', line 33

def parent
  @parent
end

#parent_idObject (readonly)

Returns the value of attribute parent_id.



33
34
35
# File 'lib/stream_parser.rb', line 33

def parent_id
  @parent_id
end

Class Method Details

.root(parser) ⇒ Object



45
46
47
# File 'lib/stream_parser.rb', line 45

def self.root(parser)
  self.new("__XML_ROOT__", 0, parser, nil)
end

Instance Method Details

#consumeObject



53
54
55
# File 'lib/stream_parser.rb', line 53

def consume
  @parser.consume
end

#contentObject



49
50
51
# File 'lib/stream_parser.rb', line 49

def content
  @parser.contents.text_from(@elstart)
end