From 3855350db3afa41fc0c1c9a6ab054be9c545edc5 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Mon, 21 Oct 2019 09:19:07 +0530 Subject: [PATCH] parse10 already takes care of remaining data --- ncclient/transport/third_party/junos/parser.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ncclient/transport/third_party/junos/parser.py b/ncclient/transport/third_party/junos/parser.py index 7c305f9d..6c72ae85 100644 --- a/ncclient/transport/third_party/junos/parser.py +++ b/ncclient/transport/third_party/junos/parser.py @@ -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)