Upgrades quick-xml

pull/662/head
Tpt 1 year ago committed by Thomas Tanon
parent a2a6c5a41e
commit ab5f5c1c60
  1. 4
      Cargo.lock
  2. 2
      lib/oxrdfxml/Cargo.toml
  3. 2
      lib/oxrdfxml/src/parser.rs
  4. 2
      lib/sparesults/Cargo.toml
  5. 16
      lib/sparesults/src/xml.rs
  6. 2
      testsuite/src/lib.rs

4
Cargo.lock generated

@ -1376,9 +1376,9 @@ dependencies = [
[[package]] [[package]]
name = "quick-xml" name = "quick-xml"
version = "0.30.0" version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33"
dependencies = [ dependencies = [
"memchr", "memchr",
"tokio", "tokio",

@ -22,7 +22,7 @@ async-tokio = ["dep:tokio", "quick-xml/async-tokio"]
oxrdf = { version = "0.2.0-alpha.1-dev", path = "../oxrdf" } oxrdf = { version = "0.2.0-alpha.1-dev", path = "../oxrdf" }
oxilangtag = "0.1" oxilangtag = "0.1"
oxiri = "0.2" oxiri = "0.2"
quick-xml = ">=0.29, <0.31" quick-xml = ">=0.29, <0.32"
tokio = { version = "1.29", optional = true, features = ["io-util"] } tokio = { version = "1.29", optional = true, features = ["io-util"] }
[dev-dependencies] [dev-dependencies]

@ -1144,7 +1144,7 @@ impl<R> RdfXmlReader<R> {
fn convert_attribute(&self, attribute: &Attribute) -> Result<String, ParseError> { fn convert_attribute(&self, attribute: &Attribute) -> Result<String, ParseError> {
Ok(attribute Ok(attribute
.decode_and_unescape_value_with(&self.reader, |e| self.resolve_entity(e))? .decode_and_unescape_value_with(&self.reader, |e| self.resolve_entity(e))?
.to_string()) .into_owned())
} }
fn convert_iri_attribute( fn convert_iri_attribute(

@ -22,7 +22,7 @@ rdf-star = ["oxrdf/rdf-star"]
json-event-parser = "0.2.0-alpha.1" json-event-parser = "0.2.0-alpha.1"
memchr = "2.5" memchr = "2.5"
oxrdf = { version = "0.2.0-alpha.1-dev", path="../oxrdf" } oxrdf = { version = "0.2.0-alpha.1-dev", path="../oxrdf" }
quick-xml = ">=0.29, <0.31" quick-xml = ">=0.29, <0.32"
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true

@ -28,7 +28,7 @@ fn do_write_boolean_xml_result<W: Write>(sink: W, value: bool) -> Result<W, quic
.write_text_content(BytesText::new(""))? .write_text_content(BytesText::new(""))?
.create_element("boolean") .create_element("boolean")
.write_text_content(BytesText::new(if value { "true" } else { "false" }))?; .write_text_content(BytesText::new(if value { "true" } else { "false" }))?;
Ok(()) quick_xml::Result::Ok(())
})?; })?;
Ok(writer.into_inner()) Ok(writer.into_inner())
} }
@ -57,7 +57,7 @@ impl<W: Write> XmlSolutionsWriter<W> {
.with_attribute(("name", variable.as_str())) .with_attribute(("name", variable.as_str()))
.write_empty()?; .write_empty()?;
} }
Ok(()) quick_xml::Result::Ok(())
})?; })?;
writer.write_event(Event::Start(BytesStart::new("results")))?; writer.write_event(Event::Start(BytesStart::new("results")))?;
Ok(Self { writer }) Ok(Self { writer })
@ -81,12 +81,9 @@ impl<W: Write> XmlSolutionsWriter<W> {
writer writer
.create_element("binding") .create_element("binding")
.with_attribute(("name", variable.as_str())) .with_attribute(("name", variable.as_str()))
.write_inner_content(|writer| { .write_inner_content(|writer| write_xml_term(value, writer))?;
write_xml_term(value, writer)?;
Ok(())
})?;
} }
Ok(()) quick_xml::Result::Ok(())
})?; })?;
Ok(()) Ok(())
} }
@ -150,7 +147,7 @@ fn write_xml_term(
.write_inner_content(|writer| { .write_inner_content(|writer| {
write_xml_term(triple.object.as_ref(), writer) write_xml_term(triple.object.as_ref(), writer)
})?; })?;
Ok(()) quick_xml::Result::Ok(())
})?; })?;
} }
} }
@ -370,7 +367,8 @@ impl<R: Read> XmlSolutionsReader<R> {
} else if event.local_name().as_ref() == b"bnode" { } else if event.local_name().as_ref() == b"bnode" {
state = State::BNode; state = State::BNode;
} else if event.local_name().as_ref() == b"literal" { } else if event.local_name().as_ref() == b"literal" {
for attr in event.attributes().flatten() { for attr in event.attributes() {
let attr = attr.map_err(quick_xml::Error::from)?;
if attr.key.as_ref() == b"xml:lang" { if attr.key.as_ref() == b"xml:lang" {
lang = Some( lang = Some(
attr.decode_and_unescape_value(&self.reader)?.to_string(), attr.decode_and_unescape_value(&self.reader)?.to_string(),

@ -27,7 +27,7 @@ pub fn check_testsuite(manifest_url: &str, ignored_tests: &[&str]) -> Result<()>
for result in results { for result in results {
if let Err(error) = &result.outcome { if let Err(error) = &result.outcome {
if !ignored_tests.contains(&result.test.as_str()) { if !ignored_tests.contains(&result.test.as_str()) {
errors.push(format!("{}: failed with error {}", result.test, error)) errors.push(format!("{}: failed with error {error:?}", result.test))
} }
} }
} }

Loading…
Cancel
Save