Skip to content

Commit

Permalink
Upgrades quick-xml to 0.26
Browse files Browse the repository at this point in the history
  • Loading branch information
Tpt committed Dec 6, 2022
1 parent 05fe3a5 commit 14077d6
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 164 deletions.
2 changes: 1 addition & 1 deletion xml/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ default = []
oxilangtag = "0.1"
oxiri = "0.2"
rio_api = { version = "0.7", path="../api" }
quick-xml = "0.23"
quick-xml = "0.26"
20 changes: 10 additions & 10 deletions xml/src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ impl<W: Write> RdfXmlFormatter<W> {

fn write_start(mut self) -> io::Result<Self> {
self.writer
.write_event(Event::Decl(BytesDecl::new(b"1.0", Some(b"UTF-8"), None)))
.write_event(Event::Decl(BytesDecl::new("1.0", Some("UTF-8"), None)))
.map_err(map_err)?;
let mut rdf_open = BytesStart::borrowed_name(b"rdf:RDF");
let mut rdf_open = BytesStart::new("rdf:RDF");
rdf_open.push_attribute(("xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"));
self.writer
.write_event(Event::Start(rdf_open))
Expand All @@ -69,11 +69,11 @@ impl<W: Write> RdfXmlFormatter<W> {
pub fn finish(mut self) -> io::Result<W> {
if self.current_subject.is_some() {
self.writer
.write_event(Event::End(BytesEnd::borrowed(b"rdf:Description")))
.write_event(Event::End(BytesEnd::new("rdf:Description")))
.map_err(map_err)?;
}
self.writer
.write_event(Event::End(BytesEnd::borrowed(b"rdf:RDF")))
.write_event(Event::End(BytesEnd::new("rdf:RDF")))
.map_err(map_err)?;
let mut inner = self.writer.into_inner();
inner.flush()?;
Expand All @@ -89,11 +89,11 @@ impl<W: Write> TriplesFormatter for RdfXmlFormatter<W> {
if self.current_subject.as_ref().map(|v| v.into()) != Some(triple.subject) {
if self.current_subject.is_some() {
self.writer
.write_event(Event::End(BytesEnd::borrowed(b"rdf:Description")))
.write_event(Event::End(BytesEnd::new("rdf:Description")))
.map_err(map_err)?;
}

let mut description_open = BytesStart::borrowed_name(b"rdf:Description");
let mut description_open = BytesStart::new("rdf:Description");
match triple.subject {
Subject::NamedNode(n) => description_open.push_attribute(("rdf:about", n.iri)),
Subject::BlankNode(n) => description_open.push_attribute(("rdf:nodeID", n.id)),
Expand All @@ -115,7 +115,7 @@ impl<W: Write> TriplesFormatter for RdfXmlFormatter<W> {
} else {
(prop_value, ("xmlns", prop_prefix))
};
let mut property_open = BytesStart::borrowed_name(prop_qname.as_bytes());
let mut property_open = BytesStart::new(prop_qname);
property_open.push_attribute(prop_xmlns);
let content = match triple.object {
Term::NamedNode(n) => {
Expand Down Expand Up @@ -149,10 +149,10 @@ impl<W: Write> TriplesFormatter for RdfXmlFormatter<W> {
.write_event(Event::Start(property_open))
.map_err(map_err)?;
self.writer
.write_event(Event::Text(BytesText::from_plain_str(content)))
.write_event(Event::Text(BytesText::new(content)))
.map_err(map_err)?;
self.writer
.write_event(Event::End(BytesEnd::borrowed(prop_qname.as_bytes())))
.write_event(Event::End(BytesEnd::new(prop_qname)))
.map_err(map_err)?;
} else {
self.writer
Expand Down Expand Up @@ -203,7 +203,7 @@ mod test {

#[cfg(feature = "rio_api/star")]
#[test]
fn formmatting_rdf_star_fails_cleanly() {
fn formatting_rdf_star_fails_cleanly() {
use rio_api::formatter::TriplesFormatter;
let iri = NamedNode { iri: "tag:iri" };
let triple = Triple {
Expand Down
Loading

0 comments on commit 14077d6

Please sign in to comment.