-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parser pull: Add support for reusing parser #220
Conversation
@naitoh Do you want to review this? |
reset
option to PullParser
Looks good to me. |
test/test_pullparser.rb
Outdated
"<message>Third valid and complete message</message>" | ||
] | ||
|
||
reader, writer = IO.pipe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use IO.pipe do |reader, writer| ...
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
test/test_pullparser.rb
Outdated
messages = [] | ||
while parser.has_next? | ||
start_event = parser.pull | ||
if start_event.start_element? and start_event[0] == 'message' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need start_element?
check?
Can we simplify this like the following?
_message_start = parser.pull
message_text = parser.pull
messages << message_text[0]
_message_end = parser.pull
parser.reset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, we don't need these checks in tests because we know our test example. Fixed.
37c3994
to
926afc7
Compare
Thanks. |
GitHub: Fix GH-214
This is for parsing XML documents stream. We can use one parser to parse multiple XML documents with this feature.