From 49a1ad2533d653ad94adf00953d9e26ce241bfe3 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 18 Oct 2023 15:47:03 +0900 Subject: [PATCH] Update yaserde to 0.8 and handle namespace --- Cargo.toml | 5 +++-- src/deserialize.rs | 7 +++---- src/funcs.rs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d9b760a..7261f31 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,9 +13,10 @@ repository = "https://github.com/openrr/urdf-rs" [dependencies] once_cell = "1" regex = "1.4.2" -yaserde = "0.7.0" -yaserde_derive = "0.7.0" thiserror = "1.0.7" +xml-rs = "0.8.3" +yaserde = "0.8" +yaserde_derive = "0.8" [dev-dependencies] assert_approx_eq = "1" diff --git a/src/deserialize.rs b/src/deserialize.rs index b0c053a..ee7fd0c 100644 --- a/src/deserialize.rs +++ b/src/deserialize.rs @@ -1,6 +1,5 @@ -use yaserde::xml; -use yaserde::xml::attribute::OwnedAttribute; -use yaserde::xml::namespace::Namespace; +use xml::attribute::OwnedAttribute; +use xml::namespace::Namespace; use yaserde::{YaDeserialize, YaSerialize}; use yaserde_derive::{YaDeserialize, YaSerialize}; @@ -503,7 +502,7 @@ pub struct Dynamics { /// Top level struct to access urdf. #[derive(Debug, YaDeserialize, YaSerialize, Clone)] -#[yaserde(rename = "robot")] +#[yaserde(rename = "robot", namespace = "http://www.ros.org")] pub struct Robot { #[yaserde(attribute)] pub name: String, diff --git a/src/funcs.rs b/src/funcs.rs index 58a4a7c..609b479 100644 --- a/src/funcs.rs +++ b/src/funcs.rs @@ -172,7 +172,7 @@ mod tests { #[test] fn deserialization() { let s = r#" - +