Class: XMLUtils::XMLStreamParser
- Inherits:
-
Object
- Object
- XMLUtils::XMLStreamParser
show all
- Defined in:
- lib/stream_parser.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of XMLStreamParser.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(methId, *args) ⇒ Object
Ignore everything except tags and text for now
105
106
|
# File 'lib/stream_parser.rb', line 105
def method_missing(methId, *args)
end
|
Instance Attribute Details
#contents ⇒ Object
Returns the value of attribute contents.
59
60
61
|
# File 'lib/stream_parser.rb', line 59
def contents
@contents
end
|
Instance Method Details
#consume ⇒ Object
100
101
102
|
# File 'lib/stream_parser.rb', line 100
def consume
@contents.erase_from(@elements[-1].elstart)
end
|
#content ⇒ Object
96
97
98
|
# File 'lib/stream_parser.rb', line 96
def content
@contents.text_from(@elements[-1].elstart)
end
|
#new_element_id ⇒ Object
68
69
70
71
72
|
# File 'lib/stream_parser.rb', line 68
def new_element_id
previous = @elid
@elid += 1
previous
end
|
#parse(text) ⇒ Object
74
75
76
|
# File 'lib/stream_parser.rb', line 74
def parse(text)
REXML::Document.parse_stream(text, self)
end
|
#tag_end(name) ⇒ Object
88
89
90
91
92
93
94
|
# File 'lib/stream_parser.rb', line 88
def tag_end(name)
@contents << "</"+name+">"
if @listener.respond_to? 'el_'+name
@listener.send('el_'+name, @elements[-1])
end
@elements.pop()
end
|
#tag_start(name, attrs) ⇒ Object
#text(text) ⇒ Object
84
85
86
|
# File 'lib/stream_parser.rb', line 84
def text(text)
@contents << XMLUtils.escape_xml(text)
end
|