SPARQL XML results: circumvent quick-xml crash

pull/519/head
Tpt 2 years ago committed by Thomas Tanon
parent 3e51020222
commit 5d253c6afb
  1. 4
      lib/sparesults/src/xml.rs

@ -186,6 +186,7 @@ impl<R: BufRead> XmlQueryResultsReader<R> {
//Read header //Read header
loop { loop {
buffer.clear();
let event = reader.read_event_into(&mut buffer)?; let event = reader.read_event_into(&mut buffer)?;
match event { match event {
Event::Start(event) => match state { Event::Start(event) => match state {
@ -275,7 +276,6 @@ impl<R: BufRead> XmlQueryResultsReader<R> {
Event::Eof => return Err(SyntaxError::msg("Unexpected early file end. All results file should have a <head> and a <result> or <boolean> tag").into()), Event::Eof => return Err(SyntaxError::msg("Unexpected early file end. All results file should have a <head> and a <result> or <boolean> tag").into()),
_ => (), _ => (),
} }
buffer.clear();
} }
} }
} }
@ -315,6 +315,7 @@ impl<R: BufRead> XmlSolutionsReader<R> {
let mut lang = None; let mut lang = None;
let mut datatype = None; let mut datatype = None;
loop { loop {
self.buffer.clear();
let event = self.reader.read_event_into(&mut self.buffer)?; let event = self.reader.read_event_into(&mut self.buffer)?;
match event { match event {
Event::Start(event) => match state { Event::Start(event) => match state {
@ -563,7 +564,6 @@ impl<R: BufRead> XmlSolutionsReader<R> {
Event::Eof => return Ok(None), Event::Eof => return Ok(None),
_ => (), _ => (),
} }
self.buffer.clear();
} }
} }
} }

Loading…
Cancel
Save