Skip to content

Commit

Permalink
parse10 already takes care of remaining data
Browse files Browse the repository at this point in the history
  • Loading branch information
Nitin Kumar committed Oct 21, 2019
1 parent 3270352 commit 3855350
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions ncclient/transport/third_party/junos/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,11 @@ def _delimiter_check(self, data):
msg, delim, remaining = data.partition(MSG_DELIM)
self._session._buffer.seek(0, os.SEEK_END)
self._session._buffer.write(delim.encode())
if remaining.strip() != '':
self._session._buffer.write(remaining.encode())
# we need to renew parser, as old parser is gone.
self.sax_parser = make_parser()
self.sax_parser.setContentHandler(SAXParser(self._session))
if remaining.strip() != '':
try:
self.sax_parser.feed(remaining)
except SAXFilterXMLNotFoundError:
self._parse10()
self.logger.debug('switching from sax to dom parsing')
self._session.parser = DefaultXMLParser(self._session)
self._session.parser.parse(remaining.encode())
elif RPC_REPLY_END_TAG in data:
logger.warning("Check for rpc reply end tag within data received: %s" % data)
msg, delim, remaining = data.partition(RPC_REPLY_END_TAG)
Expand Down

0 comments on commit 3855350

Please sign in to comment.